Menu/EEPROM: Factory reset support #296
Replies: 5 comments 3 replies
-
To factory reset, I normally just erase the magic key in the first two bytes and reset the device. When it comes back up the EEPROM will not load, and everything will be at the default values as if it were starting for the first time. In fact, I generally wouldn't even do the reset, just tell the user to reset in case it was not convenient. For my case of mainly audio equipment and a few garden devices, this works well for this very occasional case. There is also a change going into 3.1 that will allow for sized EEPROM, IE the largest location saved out is also stored, and the loader will ignore any item with a location above that. This allows for default values in new items. |
Beta Was this translation helpful? Give feedback.
-
Yeah, I saw you already updated the docs but the code is not yet available. I reserved two bytes already to enable this feature. Ok, your suggestion makes sense. Device reset is rather quick. Thanks! |
Beta Was this translation helpful? Give feedback.
-
I'll convert it to a discussion for now, so we can keep discussing it. How often do you think the "reset to factory" would be used? I guess that drives how feasible restarting is. |
Beta Was this translation helpful? Give feedback.
-
I think we need to think about this a bit more, maybe a function could be provided that did the reset, then if people didn't use it, it would be optimized out by the linked. Otherwise, it would be quite a penalty on large menus. |
Beta Was this translation helpful? Give feedback.
-
So I implemented the factory reset the way you suggested and it work great for my current usecase. I thought about possible scenarios where a library support would be helpful:
Having said that, at least in my appliance I don't need these usecases at the moment. Time will tell whether my current needs change. |
Beta Was this translation helpful? Give feedback.
-
Currently it is not possible to reset the menu to its factory state:
There is a workaround, which involves writing a custom code to set each menu item to a default value and then saving the config. However, in this code we duplicate the information stored inside our project file. For example:
Beta Was this translation helpful? Give feedback.
All reactions