I am trying to store some values over flash cycles and I can't seem to accomplish this.
I have a cloud function call that I can run that writes the value to EEPROM and reads the value out of EEPROM. This seems to work correctly, and displays it correctly in the log and on the cloud.
I was having issues running the restore (EEPROM.get) in the setup function so I moved it to the loop with a flag to only run it once per reset/reflash as well as delaying. Nothing seems to work the values get cleared by a flash or reset of the module. Is there an additional command that needs to be executed?
When flashing or resetting I get these strange symbols.
String STT = "8";
int add_EE_ST_00 = 50;
bool States_Restored = false;
void loop(){
if (!States_Restored)
{
delay(10 * 1000);
EEPROM.get(add_EE_ST_00, STT);
Log.info((const char*)STT);
func_ST_00(STT);
Log.info("%s", STT.c_str());
States_Restored = true;
Log.info("This should only run once");
}
}
int func_ST_00(String H){
EEPROM.put(add_EE_ST_00, H);
EEPROM.get(add_EE_ST_00, H);
Particle.publish("EEPROM Value", H, PRIVATE);
Log.info((const char*)H);
}