diff --git a/libraries/AP_EEProm/AP_EEProm.h b/libraries/AP_EEProm/AP_EEProm.h index afd70c6ca5..02f260b61f 100644 --- a/libraries/AP_EEProm/AP_EEProm.h +++ b/libraries/AP_EEProm/AP_EEProm.h @@ -65,8 +65,8 @@ public: eepromRegistry.add(this,_id,_address,sizeof(_data)); } void set(type val) { - if (_sync) save(); _data = val; + if (_sync) save(); } type get() { if (_sync) load(); diff --git a/libraries/AP_EEProm/examples/AP_EEProm/AP_EEProm.pde b/libraries/AP_EEProm/examples/AP_EEProm/AP_EEProm.pde index 6be26c968a..3a807d8955 100644 --- a/libraries/AP_EEProm/examples/AP_EEProm/AP_EEProm.pde +++ b/libraries/AP_EEProm/examples/AP_EEProm/AP_EEProm.pde @@ -72,8 +72,8 @@ void loop() Serial.printf_P(PSTR("\neepromRegistry(id)->getEntry(): %f\n"), eepromRegistry(id)->getEntry()); delay(2000); - eepromRegistry(id)->setEntry(456); - Serial.printf_P(PSTR("\neepromRegistry(id)->setEntry(456): %d\n"), var2.get()); + eepromRegistry(id)->setEntry(4.56); + Serial.printf_P(PSTR("\neepromRegistry(id)->setEntry(4.56): %f\n"), var2.get()); delay(2000); Serial.printf_P(PSTR("\nprint the parameters name by id: %s\n"), eepromRegistry(id)->getName());