1
0
mirror of https://github.com/esp8266/Arduino.git synced 2025-06-03 07:02:28 +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)
return;
_data[address] = value;
_dirty = true;
// Optimise _dirty. Only flagged if data written is different.
uint8_t* pData = &_data[address];
if (*pData != value)
{
*pData = value;
_dirty = true;
}
}
bool EEPROMClass::commit() {