if you add a capacitor (1000µF) and a diode, and measure when you loose Vin you can reliable write your settings to EEPROM with that 1000µF.
edit: found an old post of mine with several values/diodes:
if you add a capacitor (1000µF) and a diode, and measure when you loose Vin you can reliable write your settings to EEPROM with that 1000µF.
edit: found an old post of mine with several values/diodes: