-
Notifications
You must be signed in to change notification settings - Fork 7.8k
Description
What is the maximum number of bytes that can be stored in EEPROM? I found that when I store more than 3,400, it will crash, but in the actual project, I will crash in more than 2,000. After trying many ways, I still can’t solve it. Is there any solution? What about the problem?
DeviceDetails loadDetailsConfig()
{
DeviceDetails config;
int size = sizeof(config);
memset(&config, 0, size);
EEPROM.begin(size);
uint8_t *p = (uint8_t *)(&config);
for (int i = 0; i < size; i++)
{
*(p + i) = EEPROM.read(i);
}
EEPROM.commit();
EEPROM.end();
return config;
}
void saveDetailsConfig(DeviceDetails details)
{
int size = sizeof(details);
EEPROM.begin(size);
uint8_t *p = (uint8_t *)(&details);
for (int i = 0; i < size; i++)
{
EEPROM.write(i, *(p + i));
}
EEPROM.commit();
EEPROM.end();
}
