ESP8266: remove redundant EEPROM check (#668)

This commit is contained in:
Olivier
2016-12-03 16:53:36 +01:00
committed by Patrick Fallberg
parent 0fe9df1a77
commit f59be0aa2a
+2 -6
View File
@@ -43,15 +43,11 @@ void hwWriteConfigBlock(void* buf, void* addr, size_t length)
{ {
uint8_t* src = static_cast<uint8_t*>(buf); uint8_t* src = static_cast<uint8_t*>(buf);
int pos = reinterpret_cast<int>(addr); int pos = reinterpret_cast<int>(addr);
bool doCommit = false;
while (length-- > 0) { while (length-- > 0) {
doCommit |= EEPROM.read(pos) != *src;
EEPROM.write(pos++, *src++); EEPROM.write(pos++, *src++);
} }
// only commit if there are changes // see implementation, commit only executed if diff
if (doCommit) { EEPROM.commit();
EEPROM.commit();
}
} }
uint8_t hwReadConfig(const int addr) uint8_t hwReadConfig(const int addr)