Chat freely about anything...

User avatar
By ChrixXenon
#58898 I'm writing a system on the ESP8266-12 which stores some values in EEPROM.
I declare a structure:

Code: Select alltypedef struct
{ char    thisSSID[32];
  char    thisPassword[32];
  int     setMoisture;
  int     loggingInterval;
  int     pumpDuration;
  int     dumpPercentage;
  boolean powerSaving;
  boolean systemActive;
} EEPROMarea;

EEPROMarea ROMstatus;


- and use that structure in the program to read and write the variables. And it all worked fine until today.
Today, is one of those days when 2 + 2 = orange. Code lines are plain ignored. Code which worked well and has remained untouched now fails. I'm not looking for help with that, but the most likely explanation I can think of is that I'm corrupting the program somehow by incorrectly writing to EEPROM. Is that possible? Or is the block allocated separately?

I am reading back the values I wrote and one value is wrong - an integer reports its value as the SSID stored nearby. I'm sure that should nail it for me but I can't get there. Anyone?

I've read about structure packing, but I don't know if it's necessary here. Anyone know?

I'm starting the EEPROM malarkey with EEPROM begin(sizeof(ROMstatus)); and finishing with EEPROM.end(). I do the write with EEPROM.put(0, ROMstatus); Is this OK?