Saves critical data as key-value pairs to the NVS partition to prevent data loss after shutdown (to avoid blocking program execution, data is actually written after 5 seconds).
EEPROM write key value
EEPROM read key
EEPROM read key to int
Create a key-value pair to write into the NVS partition and read the data.