prosenb / eepromwearlevel Goto Github PK
View Code? Open in Web Editor NEWArduino EEPROMWearLevel reduces EEPROM wear by writing a new value to an other EEPROM location.
License: Apache License 2.0
Arduino EEPROMWearLevel reduces EEPROM wear by writing a new value to an other EEPROM location.
License: Apache License 2.0
Thanq for your great library,
Currently am using EEPROM address from 0 to 100 for other application. How I can change the index starting address to address < 100?. Kindly give your valuable reply.
It seems the library is declaring EEPROM but not using it. I assume this is a convenience so the project using the EEPROMWearLevel library can use EEPROM as before, but if so, it has the undesirable effect of generating a warning when not using EEPROM:
/home/eddy/opt/arduino-1.8.13/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -Wextra -std=gnu++11 -fpermissive -fno-exceptions -ffunction-sections -fdata-sections -fno-threadsafe-statics -Wno-error=narrowing -MMD -flto -mmcu=atmega328p -DF_CPU=16000000L -DARDUINO=10813 -DARDUINO_AVR_NANO -DARDUINO_ARCH_AVR -I/home/eddy/opt/arduino-1.8.13/hardware/arduino/avr/cores/arduino -I/home/eddy/opt/arduino-1.8.13/hardware/arduino/avr/variants/eightanaloginputs -I/home/eddy/Arduino/libraries/Low-Power -I/home/eddy/Arduino/libraries/LiquidCrystal_PCF8574/src -I/home/eddy/opt/arduino-1.8.13/hardware/arduino/avr/libraries/Wire/src -I/home/eddy/Arduino/libraries/EEPROMWearLevel -I/home/eddy/opt/arduino-1.8.13/hardware/arduino/avr/libraries/EEPROM/src /home/eddy/Arduino/libraries/EEPROMWearLevel/EEPROMWearLevel.cpp -o /tmp/arduino_build_8835/libraries/EEPROMWearLevel/EEPROMWearLevel.cpp.o
In file included from /home/eddy/Arduino/libraries/EEPROMWearLevel/EEPROMWearLevel.h:23:0,
from /home/eddy/Arduino/libraries/EEPROMWearLevel/EEPROMWearLevel.cpp:2:
/home/eddy/opt/arduino-1.8.13/hardware/arduino/avr/libraries/EEPROM/src/EEPROM.h:145:20: warning: 'EEPROM' defined but not used [-Wunused-variable]
static EEPROMClass EEPROM;
^~~~~~
As EEPROMWearLevel.cpp does not seem to use EEPROM, a simple (void) EEPROM;
in the EEPROMWearLevel code somewhere should be enough.
Unfortunately, the user of the library also has to do this, too. But accounting for the convenience and the fact that is code controlled by the user, they can add their silencing (void) EEPROM;
statement.
I get compiler errors when trying to compile the SimpleConfiguration.ino example using Arduino 1.8. The complete error message is pasted below:
`
C:\Users\me\Documents\Arduino\libraries\EEPROMWearLevel\EEPROMWearLevel.cpp:4:24: error: 'EEPROMwl' was declared 'extern' and later 'static' [-fpermissive]
static EEPROMWearLevel EEPROMwl;
^
In file included from C:\Users\me\Documents\Arduino\libraries\EEPROMWearLevel\EEPROMWearLevel.cpp:2:0:
C:\Users\me\Documents\Arduino\libraries\EEPROMWearLevel\EEPROMWearLevel.h:323:24: note: previous declaration of 'EEPROMwl'
extern EEPROMWearLevel EEPROMwl;
^
Using library EEPROMWearLevel at version 1.0.0 in folder: C:\Users\me\Documents\Arduino\libraries\EEPROMWearLevel
Using library EEPROM at version 2.0 in folder: C:\Users\me\Documents\Arduino\hardware\arduino\avr\libraries\EEPROM
exit status 1
Error compiling for board Arduino/Genuino Uno.
`
Hello!
Thank you for you library EEPROMWearLevel, it's really usefull.
I have one problem, when I use EEPROMwl.put function, Timer1 stop short time,
but and I have some problem.
Can I fix it?
Hey there! I don't have much experience in programming MCUs, so I may be misunderstanding the intent behind the code, but I noticed that you've created this concept of a control byte, whereby each bit is cleared one-by-one as you write new data to the index. Because the ATmega EEPROM writes in byte-sized blocks, each time you're clearing a bit from the control byte, it counts as a full write/erase cycle for the entire cell, meaning the control bytes will wear out approximately 8 times faster than the rest of the dataIndex
cells.
If I'm understanding this correctly, was this done as a kind of trade-off to optimize for valuable EEPROM space? If I'm not understanding correctly, mind setting me straight?
Thanks!
Hi Pete
This goes wrong
EEPROMwl.put(0, 125);
This goes well
EEPROMwl.put(0, (long)125);
Someting with overloading?
But the rest works fine, thank you for your library..
www.avdweb.nl
Albert
EEPROMWearLevel.cpp:57 is EEPROMClass::write(INDEX_VERSION, layoutVersion);
it probably should be: EEPROMClass::update(INDEX_VERSION, layoutVersion);
I'm running the ringBufffer example and it runs as expected...
but Im not clear on how to use the "AMOUNT_OF_INDEXES" , and "INDEX_RING_BUFFER".
INDEX_RING_BUFFER seems to crash the example with any value above 0,
and Im not sure how to access indexes above 1 ?
Thanks
Harry
Dear Pete
I have troubles using the ATtiny3217
https://github.com/SpenceKonde/megaTinyCore
The error is:
'EECR' was not declared in this scope
Note that the standard Arduino library EEPROM.h still works fine on the ATtiny3217, see this sketch:
#include <EEPROM.h>
void setup()
{ Serial.begin(9600);
while(!Serial);
float f = 123.456f;
int eeAddress = 0;
EEPROM.put(eeAddress, f);
EEPROM.get(eeAddress, f);
Serial.println(f, 3);
}
void loop()
{
}
So, I think it is not a big compatiblity issue.
I have looked for a solution, but I don’t have enough knowledge of the Arduino platform.
Maybe you can talk to Spence Konde what to do.
Hi Pete
Can you tell what the maximum number of allowed EEPROM writes is in the examples?
Integrating your library in my project was a breeze.
Now I have a nice MVP, and I'll have my 0.1 release soon.
https://youtu.be/MlZQGAmdXMs
https://youtu.be/N3DQ9_Ras7Y
https://youtu.be/6VTN1WMB9zE
Project is here: https://github.com/uCautomation/plant-watering-system/
The example given says there are 18 bytes used, but actually there are 19: 1 version, 2 control, 16 for data (index 0 to 15).
AIUI, either we can say the region allows using actually 16 bytes to store data, and that requires 3 extra bytes, or the entire thing has 19 bytes in total, but never 18.
Am I missing something?
When declaring the int array to pass to the begin() method, is the int value meant as the size of one piece of data the partition is going to hold or the space that is being reserved for the respective partition?
Additionally: is the int value I pass to begin() supposed to include the bytes for control bytes and layoutVersion?
Hello!
You can see my question above.
I am wondering what happens in the unlikely case that the write happens exactly as a brownout happens.
Will the library catch that and restore to a known good state or will all the data be corrupt?
Will only the variable that gets written be corrupt? If thats the case, we could fix that by storing all values three times and comparing them.
BTW: thanks for your Lib, have a nice day!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.