Added runtime time logger

This commit is contained in:
Magnus Persson
2022-01-30 22:54:48 +01:00
parent 2e67bd1d57
commit 22ade61af8
7 changed files with 124 additions and 57 deletions

View File

@ -274,6 +274,8 @@ void loopGravityOnInterval() {
}
}
bool skipRunTimeLog = false;
//
// Main loop that determines if device should go to sleep
//
@ -281,6 +283,11 @@ void goToSleep(int sleepInterval) {
float volt = myBatteryVoltage.getVoltage();
float runtime = (millis() - runtimeMillis);
if (!skipRunTimeLog) {
FloatHistoryLog runLog(RUNTIME_FILENAME);
runLog.addEntry(runtime);
}
Log.notice(F("MAIN: Entering deep sleep for %ds, run time %Fs, "
"battery=%FV." CR),
sleepInterval, reduceFloatPrecision(runtime / 1000, 2), volt);
@ -301,6 +308,10 @@ void loop() {
myWebServerHandler.loop();
myWifi.loop();
loopGravityOnInterval();
// If we switched mode, dont include this in the log.
if (runMode!=RunMode::configurationMode)
skipRunTimeLog = true;
break;
case RunMode::gravityMode: