Fixed EEProm set bug.

git-svn-id: https://arducopter.googlecode.com/svn/trunk@1243 f9c3cf11-9bcb-44bc-f272-b75c42450872
This commit is contained in:
james.goppert 2010-12-24 04:25:40 +00:00
parent f8f9575c3d
commit bc7068b4df
2 changed files with 3 additions and 3 deletions

View File

@ -65,8 +65,8 @@ public:
eepromRegistry.add(this,_id,_address,sizeof(_data)); eepromRegistry.add(this,_id,_address,sizeof(_data));
} }
void set(type val) { void set(type val) {
if (_sync) save();
_data = val; _data = val;
if (_sync) save();
} }
type get() { type get() {
if (_sync) load(); if (_sync) load();

View File

@ -72,8 +72,8 @@ void loop()
Serial.printf_P(PSTR("\neepromRegistry(id)->getEntry(): %f\n"), eepromRegistry(id)->getEntry()); Serial.printf_P(PSTR("\neepromRegistry(id)->getEntry(): %f\n"), eepromRegistry(id)->getEntry());
delay(2000); delay(2000);
eepromRegistry(id)->setEntry(456); eepromRegistry(id)->setEntry(4.56);
Serial.printf_P(PSTR("\neepromRegistry(id)->setEntry(456): %d\n"), var2.get()); Serial.printf_P(PSTR("\neepromRegistry(id)->setEntry(4.56): %f\n"), var2.get());
delay(2000); delay(2000);
Serial.printf_P(PSTR("\nprint the parameters name by id: %s\n"), eepromRegistry(id)->getName()); Serial.printf_P(PSTR("\nprint the parameters name by id: %s\n"), eepromRegistry(id)->getName());