@@ -42,7 +42,7 @@ const int FIRMWARE_VERSION_MINOR = 3;
4242#include " settings.h"
4343
4444#define MAX_CPU_CORES 2
45- #define IDLE_COUNT_PER_SECOND 196289
45+ #define IDLE_COUNT_PER_SECOND 1000
4646#define IDLE_TIME_DISPLAY_SECONDS 5
4747#define MAX_IDLE_TIME_COUNT (IDLE_TIME_DISPLAY_SECONDS * IDLE_COUNT_PER_SECOND)
4848#define MILLISECONDS_IN_A_SECOND 1000
@@ -425,9 +425,8 @@ unsigned long systemTestDisplayTime = 0; //Timestamp for swapping the graphic du
425425uint8_t systemTestDisplayNumber = 0 ; // Tracks which test screen we're looking at
426426unsigned long rtcWaitTime = 0 ; // At poweron, we give the RTC a few seconds to update during PointPerfect Key checking
427427
428- uint32_t cpuIdleCount[MAX_CPU_CORES];
429428TaskHandle_t idleTaskHandle[MAX_CPU_CORES];
430- uint32_t cpuLastIdleDisplayTime ;
429+ uint32_t max_idle_count = MAX_IDLE_TIME_COUNT ;
431430
432431uint64_t uptime;
433432uint32_t previousMilliseconds;
@@ -438,14 +437,11 @@ void setup()
438437{
439438 Serial.begin (115200 ); // UART0 for programming and debugging
440439
440+ beginIdleTasks ();
441+
441442 Wire.begin (); // Start I2C on core 1
442443 // Wire.setClock(400000);
443444
444- // Initialize the CPU idle time counts
445- for (int index = 0 ; index < MAX_CPU_CORES; index++)
446- cpuIdleCount[index] = 0 ;
447- cpuLastIdleDisplayTime = millis ();
448-
449445 beginDisplay (); // Start display first to be able to display any errors
450446
451447 beginGNSS (); // Connect to GNSS to get module type
@@ -483,8 +479,6 @@ void setup()
483479 log_d (" Boot time: %d" , millis ());
484480
485481 danceLEDs (); // Turn on LEDs like a car dashboard
486-
487- beginIdleTasks ();
488482}
489483
490484void loop ()
@@ -526,49 +520,10 @@ void loop()
526520 // Convert current system time to minutes. This is used in F9PSerialReadTask()/updateLogs() to see if we are within max log window.
527521 systemTime_minutes = millis () / 1000L / 60 ;
528522
529- // Display the CPU idle time
530- if (settings.enablePrintIdleTime )
531- printIdleTimes ();
532-
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-
540523 // A small delay prevents panic if no other I2C or functions are called
541524 delay (10 );
542525}
543526
544- // Print the CPU idle times
545- void printIdleTimes ()
546- {
547- uint32_t idleCount[MAX_CPU_CORES];
548- int index;
549-
550- // Determine if it is time to print the CPU idle times
551- if ((millis () - cpuLastIdleDisplayTime) >= (IDLE_TIME_DISPLAY_SECONDS * 1000 ))
552- {
553- // Get the idle times
554- cpuLastIdleDisplayTime = millis ();
555- for (index = 0 ; index < MAX_CPU_CORES; index++)
556- {
557- idleCount[index] = cpuIdleCount[index];
558- cpuIdleCount[index] = 0 ;
559- }
560-
561- // Display the idle times
562- for (int index = 0 ; index < MAX_CPU_CORES; index++)
563- Serial.printf (" CPU %d idle time: %d%% (%d/%d)\r\n " , index,
564- idleCount[index] * 100 / MAX_IDLE_TIME_COUNT,
565- idleCount[index], MAX_IDLE_TIME_COUNT);
566-
567- // Print the task count
568- Serial.printf (" %d Tasks\r\n " , uxTaskGetNumberOfTasks ());
569- }
570- }
571-
572527// Create or close files as needed (startup or as user changes settings)
573528// Push new data to log as needed
574529void updateLogs ()
0 commit comments