dhiltonp/hexbright — pull request #30 by ptesarik (2013-07-14 19:51:59+00:00)
Title: up_n_down:Improve EEPROM usage pattern

The original program writes to fixed EEPROM locations, stressing the first two cells only. The modified algorithm distributes the stress across all of the EEPROM memory. It is implemented as follows:

1. All configuration is kept in a single data structure.
2. The EEPROM memory space is divided into slots.
3. Each slot has a sequence number.
4. A new slot is always used to write the configuration, and it gets
the next highest available sequence number.
5. Number of slots is not a multiple of the highest sequence number.
6. Both sequence numbers and slot numbers can overflow eventually, but
thanks to point 5, there will always be a "gap" after the last
sequence number.

The configuration is read once at startup, and written once before switching off, and only if any values actually changed.