Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to commit messages on EEPROM with this library #276

Open
jgarcia-atg opened this issue May 25, 2023 · 4 comments
Open

Unable to commit messages on EEPROM with this library #276

jgarcia-atg opened this issue May 25, 2023 · 4 comments

Comments

@jgarcia-atg
Copy link

Hello.

I am using IotWebConf library for configuring Wi-Fi and MQTT connection for a device based on ESP8266.
Unfortunatelly, I have to write myself some parameters on EEPROM but when y commit the write, it fails. For example:

EEPROM.write(MemWifi,48); // (default: 5; maximum: 10)
EEPROM.write(MemMQTT,48); /(default: 5; maximum: 10)
EEPROM.write(MemADC,48); //(default: 5; maximum: 10)
EEPROM.write(MemAHT,48); //(default: 5; maximum: 10)
if (EEPROM.commit()) {
Serial.println("EEPROM successfully committed");
} else {
Serial.println("ERROR! EEPROM commit failed");
}

MemWiFi and so on are previously defined like:

#define MemWifi 711

The problem is that when I call EEPROM.commit() it returns false, so I read on serial terminal "ERROR! EEPROM commit failed"
I saw another Issue (#60) and I tried his solution, but I'm still unable to commit the changes.

Any thoughs about this?

Thank you.

@prampec
Copy link
Owner

prampec commented May 25, 2023

There was a fix, that fixed EEPROM was not closed after startup: b89ac9f
Maybe that introduced new problem. E.g. it might happened, that EEPROM.end() was called, that disabled any further eeprom writes?

@jgarcia-atg
Copy link
Author

Hi @prampec .

Thanks for your reply.
Do you mean that maybe I have to modify .cpp file?

@prampec
Copy link
Owner

prampec commented May 31, 2023

Do you properly use EEPROM.begin() and EEPROM.end() ?

@jgarcia-atg
Copy link
Author

First, I obtain the real size of the EEPROM memory with
uint32_t realSize = ESP.getFlashChipRealSize()
And then I initialize the EEPROM with:
EEPROM.begin(realSize)

Also I tried calling EEPROM.end() at the beginning of the void setup but I am not even able to commit any writting

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants