@@ -45,6 +45,10 @@ const int FIRMWARE_VERSION_MINOR = 3;
4545#define IDLE_COUNT_PER_SECOND 196289
4646#define IDLE_TIME_DISPLAY_SECONDS 5
4747#define MAX_IDLE_TIME_COUNT (IDLE_TIME_DISPLAY_SECONDS * IDLE_COUNT_PER_SECOND)
48+ #define MILLISECONDS_IN_A_SECOND 1000
49+ #define MILLISECONDS_IN_A_MINUTE (60 * MILLISECONDS_IN_A_SECOND)
50+ #define MILLISECONDS_IN_AN_HOUR (60 * MILLISECONDS_IN_A_MINUTE)
51+ #define MILLISECONDS_IN_A_DAY (24 * MILLISECONDS_IN_AN_HOUR)
4852
4953// Hardware connections
5054// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -426,6 +430,9 @@ uint32_t cpuIdleCount[MAX_CPU_CORES];
426430TaskHandle_t idleTaskHandle[MAX_CPU_CORES];
427431uint32_t cpuLastIdleDisplayTime;
428432
433+ uint64_t uptime;
434+ uint32_t previousMilliseconds;
435+
429436// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
430437
431438void setup ()
@@ -484,7 +491,7 @@ void setup()
484491void loop ()
485492{
486493 uint32_t delayTime;
487-
494+ uint32_t currentMilliseconds;
488495
489496 if (online.gnss == true )
490497 {
@@ -524,6 +531,13 @@ void loop()
524531 if (settings.enablePrintIdleTime )
525532 printIdleTimes ();
526533
534+ // Monitor the days in uptime
535+ currentMilliseconds = millis ();
536+ uptime = (uptime & 0xffffffff00000000ull ) | currentMilliseconds;
537+ if (currentMilliseconds < previousMilliseconds)
538+ uptime += 0x100000000ull ;
539+ previousMilliseconds = currentMilliseconds;
540+
527541 // A small delay prevents panic if no other I2C or functions are called
528542 delay (10 );
529543}
0 commit comments