37 lines
927 B
C++
37 lines
927 B
C++
LP_TIMER((long)10*60*1000, writeEEPROM);
|
|
|
|
void writeEEPROM() {
|
|
#if useEEPROM
|
|
lastEEPROMWriteTime = millis();
|
|
EEPROM.put(0, activeProfileIndex); // Store the active profile index
|
|
EEPROM.put(4, totalElapsedTime); // Store the total elapsed time
|
|
|
|
Serial.print("EEPROM written: ");
|
|
Serial.print(activeProfileIndex);
|
|
Serial.print(" ");
|
|
Serial.println(totalElapsedTime);
|
|
#endif
|
|
}
|
|
|
|
void readEEPROM() {
|
|
#if useEEPROM
|
|
long time = 0;
|
|
EEPROM.get(0, activeProfileIndex); // Store the active profile index
|
|
EEPROM.get(4, time); // Store the total elapsed time
|
|
if (activeProfileIndex != 100) {
|
|
totalStartTime = millis() - time*1000;
|
|
calculateTotalTime();
|
|
getPhaseAndTemperature();
|
|
inSelectionMode = false;
|
|
}
|
|
else {
|
|
oled.clear();
|
|
displaySelection();
|
|
}
|
|
Serial.print("EEPROM read: ");
|
|
Serial.print(activeProfileIndex);
|
|
Serial.print(" ");
|
|
Serial.println(time);
|
|
#endif
|
|
}
|