-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy patheepromNote.txt
43 lines (28 loc) · 1.34 KB
/
eepromNote.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Either replace the EEPROM.ccp and EEPROM.h files in
windows - C:\Users\*your username*\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.6.3\libraries\EEPROM
Mac - /Users/*your username*/Library/Adruino15/packages/esp8266/hardware/esp8266/2.6.3/libraries/EEPROM
Or, change it by this step
1. go to your eeprom lib, on my win10 system the path looks like this:
windows - C:\Users\*your username*\Documents\ArduinoData\packages\esp8266\hardware\esp8266\2.6.3\libraries\EEPROM
Mac - /Users/*your username*/Library/Adruino15/packages/esp8266/hardware/esp8266/2.6.3/libraries/EEPROM
2. add something like this to your EEPROM.cpp :
void EEPROMClass::update(int const address, uint8_t const value) {
if (address < 0 || (size_t)address >= _size)
return;
if(!_data)
return;
// get data from eeprom
uint8_t storedData = read(address);
// check if the same
if (storedData == value)
return;
// call of write() because it is different
write(address, value);
}
and the coresponding header prototype to your EEPROM.h:
void update(int const address, uint8_t const val);
3. now your code will compile, but It will still not work, the problem is you need to call:
EEPROM.begin(*needed bytes of eeprom*);
and
EEPROM.commit();
after everytime you wrote data via update/put... functions.