I have a variable uint8_t a_ram
which needs to be initialized from the EEPROM variable a_eeprom
when the ESP boots up. Whenever a_ram
changes, the new value has to be stored to the EEPROM (a_eeprom
), so that the ESP will initialize a_ram
to this new value after the next reboot.
The problem I have is to understand, how the value of a_eeprom
can be initialized for the very first boot. If a_eeprom
has not been set before (that means, that a_ram
has not been stored to EEPROM yet), my variable will be initialized to 0
, which must not be the case.
I could introduce an extra variable to the EEPROM (kind of a flag), which tells me whether a_ram
has been stored to EEPROM or not and only initialize a_ram
to a_eeprom
if that is the case. But as I don't want to spend this memory if it isn't neccessary, I'd like to know if there is a possibility to set an EEPROM value when flashing the ESP.
Btw, I'm using the arduino IDE.