1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-10 14:42:08 +03:00

Optimised _dirty flag.

_dirty set only if the value being written is different from the existing value in the cache.
This commit is contained in:
timw1971
2016-01-15 15:15:22 +00:00
parent 87c59b1ca2
commit b3a503a9ef

View File

@ -86,8 +86,13 @@ void EEPROMClass::write(int address, uint8_t value) {
if(!_data) if(!_data)
return; return;
_data[address] = value; // Optimise _dirty. Only flagged if data written is different.
_dirty = true; uint8_t* pData = &_data[address];
if (*pData != value)
{
*pData = value;
_dirty = true;
}
} }
bool EEPROMClass::commit() { bool EEPROMClass::commit() {