Store current state of state machine in EEPROM and on next boot initalize state machine with that state
Opened this issue · 1 comments
jmozmoz commented
This is a question/feature request:
Store current state of state machine in EEPROM and on next boot initalize state machine with that state.
I guess these sub-issues had to be solved for this to work:
- get the current state of the state machine (the pull request #24 implements this).
- either serialize the current state object or create a unique identifier of it and store this in EEPROM/flash. Again pull request #24 adds names for states which could be used as identifiers; but currently these names are not guaranteed to be unique.
- after reboot: create state objects in a way that one of the newly created ones can be identified as the stored one (or detect incompatible state).
- if state from EEPROM is valid, initialize state machine with that state.
This would be useful if deep sleep is used to save battery/energy.
LennartHennigs commented
Hey @jmozmoz,
to catch up on your question (better late then never), I added unique IDs to the states in my branch:
https://github.com/LennartHennigs/arduino-fsm
This now allows to store the state in the EEPROM of the ESP32.
I'll take a look at this and add another commit.
Cheers.
l.