I have this sketch I'm working on that is as of yet incomplete. The goal is to make saving and retrieving data from EEPROM super simple. My idea is that when the device boots up it needs to read a serialized data string from EEPROM and load it into a state machine. From there the device can operate in what ever way I see fit. In my specific case I've got 2 modes of operation: Access point (AP) mode and operating (OP) mode. AP mode broadcasts a network and serves up some HTML pages that allow for configuration of the preferred Wifi Network and a few other details. OP Mode connects to the configured network, enters the loop where it reads data from sensors, sends this data to a server via HTTP/S, and executes a limited set of commands that the server can send back to the device.
When a configuration option is saved it should update the state machine, state machine contents dumped to a serialized string and written to EEPROM. When the device boots up it reads in the serialized data from EEPROM memory and loads it into the state machine.
I'm looking to solve 2 problems:
1) Writing & reading data from EEPROM so that configuration persists through a power outage, and
2) have all data saved in a single serialized variable so it is easily saved and retrieved from EEPROM.
This seemed simple enough until I realized that I had a bunch of different variable types in my sketch, const, int, String, char, etc. A state machine makes sense in general, but loading state from EEPROM and saving state to EEPROM makes life nice.
Note that I'm not really concerned about the memory limitations of ESP8266 or other technical limitation unless they flat out prevent the intended purpose of the sketch from working. I'm more interested in what can be done over what might not work.
Thanks for your thoughts, if you know of anything similar to this that already exists I would like to hear about it.