Instead of having a separate menu item that's calback contains menuMgr.save(eeprom); , i thought I could just add menuMgr.save(eeprom); to the end of each menu item's callback so after setting the value it "auto saves".
However, 2 things happen. One, the value isn't written to EEPROM, and two some values fail to load on the next boot cycle.
Example:
Two basic callbacks updating an integer.
void CALLBACK_FUNCTION setBoilerTemp(int id) {
serviceBoilerSetTemp = menuConfigurationMachineSettingsServiceBoiler.getCurrentValue();
//menuMgr.save(eeprom);
}
void CALLBACK_FUNCTION setCoffeeBoilerTemp(int id) {
coffeeBoilerSetTemp = menuConfigurationMachineSettingsCoffeeBoiler.getCurrentValue();
//menuMgr.save(eeprom);
}
I have a seperate callback for "Save Settings" action item built into the menu. It works fine.
void CALLBACK_FUNCTION saveSettings(int id) {
menuMgr.save(eeprom);
}
Again, with the menuMg.save(eeprom); commented out, the EEPROM values are saved correctly, when the menu option "Save Settings" is selected. The values are read correctly on start up.
With them un-commented some values are loaded with a 0 value, and when adjusting the value they do not save as expected.
What am I doing wrong?
Thanks!
Jon