Vars
struct _settings {
int id;
int wlan_mode;
};
_settings settings;
function readSettings
void readSettings() {
int i = 0;
byte e[4096];
unsigned long size = 0;
Serial.println("read 4096 bytes");
for (i = 0; i < 4096; i++) {
e[i] = EEPROM.read(i);
}
Serial.println("copy data to settings");
size = sizeof(_settings);
memcpy(&settings,e,size);
Serial.println("done");
}
Setup
void setup() {
// put your setup code here, to run once:
Serial.begin(9600, SERIAL_8N1);
Serial.println("");
Serial.println("Init");
Serial.println("Init");
WiFi.mode(WIFI_OFF);
EEPROM.begin(4096);
readSettings();
Serial.println("Ready");
}
Main
void loop() {
while(1) {
delay(10);
}
}
i call the function readSettings and got the message "done" on Serial. then the module resets.
if i comment out the line with memcpy i got no reset. i also used os_memcpy to test. same result: reset
Any idea?