@@ -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
@@ -422,24 +422,20 @@ unsigned long systemTestDisplayTime = 0; //Timestamp for swapping the graphic du
422422uint8_t systemTestDisplayNumber = 0 ; // Tracks which test screen we're looking at
423423unsigned long rtcWaitTime = 0 ; // At poweron, we give the RTC a few seconds to update during PointPerfect Key checking
424424
425- uint32_t cpuIdleCount[MAX_CPU_CORES];
426425TaskHandle_t idleTaskHandle[MAX_CPU_CORES];
427- uint32_t cpuLastIdleDisplayTime ;
426+ uint32_t max_idle_count = MAX_IDLE_TIME_COUNT ;
428427
429428// -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
430429
431430void setup ()
432431{
433432 Serial.begin (115200 ); // UART0 for programming and debugging
434433
434+ beginIdleTasks ();
435+
435436 Wire.begin (); // Start I2C on core 1
436437 // Wire.setClock(400000);
437438
438- // Initialize the CPU idle time counts
439- for (int index = 0 ; index < MAX_CPU_CORES; index++)
440- cpuIdleCount[index] = 0 ;
441- cpuLastIdleDisplayTime = millis ();
442-
443439 beginDisplay (); // Start display first to be able to display any errors
444440
445441 beginGNSS (); // Connect to GNSS to get module type
@@ -477,8 +473,6 @@ void setup()
477473 log_d (" Boot time: %d" , millis ());
478474
479475 danceLEDs (); // Turn on LEDs like a car dashboard
480-
481- beginIdleTasks ();
482476}
483477
484478void loop ()
@@ -520,42 +514,10 @@ void loop()
520514 // Convert current system time to minutes. This is used in F9PSerialReadTask()/updateLogs() to see if we are within max log window.
521515 systemTime_minutes = millis () / 1000L / 60 ;
522516
523- // Display the CPU idle time
524- if (settings.enablePrintIdleTime )
525- printIdleTimes ();
526-
527517 // A small delay prevents panic if no other I2C or functions are called
528518 delay (10 );
529519}
530520
531- // Print the CPU idle times
532- void printIdleTimes ()
533- {
534- uint32_t idleCount[MAX_CPU_CORES];
535- int index;
536-
537- // Determine if it is time to print the CPU idle times
538- if ((millis () - cpuLastIdleDisplayTime) >= (IDLE_TIME_DISPLAY_SECONDS * 1000 ))
539- {
540- // Get the idle times
541- cpuLastIdleDisplayTime = millis ();
542- for (index = 0 ; index < MAX_CPU_CORES; index++)
543- {
544- idleCount[index] = cpuIdleCount[index];
545- cpuIdleCount[index] = 0 ;
546- }
547-
548- // Display the idle times
549- for (int index = 0 ; index < MAX_CPU_CORES; index++)
550- Serial.printf (" CPU %d idle time: %d%% (%d/%d)\r\n " , index,
551- idleCount[index] * 100 / MAX_IDLE_TIME_COUNT,
552- idleCount[index], MAX_IDLE_TIME_COUNT);
553-
554- // Print the task count
555- Serial.printf (" %d Tasks\r\n " , uxTaskGetNumberOfTasks ());
556- }
557- }
558-
559521// Create or close files as needed (startup or as user changes settings)
560522// Push new data to log as needed
561523void updateLogs ()
0 commit comments