Hi there !
I was about to use saveState function, but I first aked myself about the wearing of the EEPROM.
It seems that the EEPROM has a life of about 100.000 writes.
So, if I do 100 writes per day (4 state change every hour), it takes 1000 days to write 100k times : about 3 years and the EEPROM may start failing.
Do anyone use a wear-leveling trick ?
I've quickly searched for code over google, but hasn't tried anything yet.
@napo7 yup. I wrote an EEprom wear leveling library a while ago. Didn't publish it yet though...
I'll have a look if I can have it go public.
- you could use a circular buffer for this http://www.atmel.com/images/doc2526.pdf . I'm sure there are already libs for this.
- when it's not enough, it's maybe better to use a better mem,
- change strategy
Quick thought :
At least, if the old value is the same as the new value, don't write it !
I'm sure we can avoid a big amount of updates in case of the controller resend the same value...
I did thought of a kind of circular buffer , but it's too late for my brain to find a working solution
Reading the atmel doc will surely be easier !
We're using eeprom_update_byte which only updates if the value differs.
Now I have to implement a circular buffer and the solution will be perfect !
Edit : This reading is interresting : http://hackaday.com/2011/05/16/destroying-an-arduinos-eeprom/
The user did a test to wear out EEPROM, and did managed to get more than 1M writes before it started to fail !