I have checked with two datasheets: one for some ATMegas and one for some ATTinys MCUs and could not find what the EEPROM.get()
call would read back if the EEPROM was empty (or contained default factory values). I have written a program in order to find out and it looks like on Arduino Uno the EEPROM bytes are all FF
by default.
Is this the case with every Arduino board or just some of them ? Or perhaps we can not assume that all the MCUs of a certain type (such as ATMega328) will have this factory preloaded value of FF
for the EEPROM bytes ?
edit
Following the fuses - thanks @Chris Stratton - I was able to find this in the datasheet:
Skip writing the data value 0xFF, that is the contents of the entire EEPROM (unless the EESAVE Fuse is programmed) and Flash after a Chip Erase.
Seems like we could get the factory pre-loaded value by not programming the EESAVE fuse, which is what the Arduino Uno does by default, and just reading them.
uno.bootloader.low_fuses=0xFF
uno.bootloader.high_fuses=0xDE
uno.bootloader.extendedfuses=0xFD
However, having a way to set them to a known value is fine too for my needs, so I shall just write that fuse and havea guaranteed 0xFF
all over the EEPROM.