EEPROM wear levelling

The EEPROM location must be erased before a new value is written to it, unless the EEPROM location is already erased (which has a value of 0xFF). The erase happens "automatically" when needed, but it still happens nonetheless.

Let's say we use the value 0xDF as the non-value marker, and we want to write 0xFE (aka -2 as a signed 8-bit value); the cell must be erased before 0xFE can be written to it. Then it must be erased again before 0xDF can be written to it.

On the other hand, if we use 0xFF as the non-value marker, the cell does not have to be erased before 0x7E (0xFE with the high bit inverted, to distinguish valid values from the non-value marker) can be written to it, and the cell must be erased only when it's turned back to the non-value marker.