Do I understand the code in
EEPROM.cpp / write() correctly, that
val is only written to the EEPROM, if
val differs from the current EEPROM contents at the given
And if the answer is yes, what is
From library Library, see fragment:
EEPROM.write does not write to flash immediately, instead you must call EEPROM.commit() whenever you wish to save changes to flash. EEPROM.end() will also commit, and will release the RAM copy of EEPROM contents.
Probably to prevent too many writes into the same page (mostly EEPROM is divided in pages), the write stores it into some temporary buffer and the commit actually writes it to EEPROM. This decreases the number of writes, and since the number of writes has a maximum, the lifetime of the EEPROM is increased.
Update: Majenko's comment mentions no EEPROM is used, but flash, see below.
I read that after the EEPROM.commit() you need to add a delay(500). I had several issues with the EEPROM data gone after several restarts of the esp8266.