storing struct which has an array of structs on EEPROM?


i'm trying to store on EEPROM of esp8266:

struct RshedDevice
 unsigned int ID;
 int availableSensorsNumber = 0;
 //Reading *reading = new Reading[SENSORS_MAX_NUMBER];
 Reading reading[SENSORS_MAX_NUMBER];     //array???????

struct Reading
  int ID;
  char dateAndTime[20];    //array??????????
  electricalValues electricalReadings;

struct electricalValues
  double voltage;
  double current;
  double power;
  double energy;

is it ok to just use EEPROM.put for RshedDevice?

thanks in advance :slight_smile:

is it ok to just use EEPROM.put for RshedDevice?

Yes in theory. Despite of the nesting level, the compiler still should transform that structure into a single contiguous space in memory (unless there are pointers as members, although explicitly declared arrays aren't a problem).

Since the resulting structure seems unusually large, I suggest you to use sizeof() just to make sure there's enough EEPROM space starting from a given address.