@@ -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// =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
@@ -425,6 +429,9 @@ uint32_t cpuIdleCount[MAX_CPU_CORES];
425429TaskHandle_t idleTaskHandle[MAX_CPU_CORES];
426430uint32_t cpuLastIdleDisplayTime;
427431
432+ uint64_t uptime;
433+ uint32_t previousMilliseconds;
434+
428435// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
429436
430437void setup ()
@@ -482,6 +489,9 @@ void setup()
482489
483490void loop ()
484491{
492+ uint32_t delayTime;
493+ uint32_t currentMilliseconds;
494+
485495 if (online.gnss == true )
486496 {
487497 i2cGNSS.checkUblox (); // Regularly poll to get latest data and any RTCM
@@ -520,6 +530,13 @@ void loop()
520530 if (settings.enablePrintIdleTime )
521531 printIdleTimes ();
522532
533+ // Monitor the days in uptime
534+ currentMilliseconds = millis ();
535+ uptime = (uptime & 0xffffffff00000000ull ) | currentMilliseconds;
536+ if (currentMilliseconds < previousMilliseconds)
537+ uptime += 0x100000000ull ;
538+ previousMilliseconds = currentMilliseconds;
539+
523540 // A small delay prevents panic if no other I2C or functions are called
524541 delay (10 );
525542}
0 commit comments