MartinNohr / MagicImageWand

Paints Images in the Air with LEDs
Apache License 2.0
20 stars 6 forks source link

Save state when updating code #57

Open DaveStu opened 2 years ago

DaveStu commented 2 years ago

Is it possible when an update is uploaded, that the previous auto/manual saved settings can be loaded, either automaticslly or manually?

Each time time I set my display up the way I like/need it and other configertions, after a new code is uploaded all previous settings are gone. I do find this part annoying. I assume the saved settings are stored on internal flash and gets wiped at each new upload? If so, is it possible to save settings to SDCARD, thus allowing easy application of settings UNLESS features change considerably that the saved state causes corruption to non-existent or changed menus options? I'm not sure on the logical way to tackle this, yet.

MartinNohr commented 2 years ago

I have to clean the eeprom when the format of the saved settings changed. It is keyed to the version number so it is only done when a new version is loaded, not when an existing version is loaded again. If you want to save your settings then use the load/save settings in the menu. This saves your settings in a file on the SD card. New settings will not be set until a new file is save of course, but your old ones will be restored. Look in the manu "Saved Settings | Load/Save". The values are saved in named ascii format so it is not affected by new version of the binary settings that are stored in the eeprom. Hope that helps, let me know if it works.

MartinNohr commented 2 years ago

Just to clarify.

DaveStu commented 2 years ago

Thanks for the insight and clarification. My step was to first turn on AUTOLOAD SETTINGS and I think, it would do an autosave of current state, thus overwriting my previous saved settings? As, after doing that and THEN trying to load previous saved settings, there was nothing. I will need to do as you said, THEN turn on AUTOLOAD SETTINGS. I'll try for next version of code, as I've already applied your latest, before seeing this message. Thanks

MartinNohr commented 2 years ago

I didn't think it was a good idea to do a save when autoload was turned on, that would overwrite an existing settings file. I suppose I could have designed it to do an autosave if no saved file was saved, but I hadn't thought of that at the time. I'll think about changing that, I don't think it will cause any problems. However, turning autosave on will still use an existing settings file. I suppose I could ask if the current settings should be saved. But then again, hmmm, things get complicated!