ESP8266: remove redundant EEPROM check (#668)
This commit is contained in:
committed by
Patrick Fallberg
parent
0fe9df1a77
commit
f59be0aa2a
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user