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:
parent
87c59b1ca2
commit
b3a503a9ef
@ -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() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user