diff --git a/speeduino/globals.h b/speeduino/globals.h index 3a5a531e99..8330059d69 100644 --- a/speeduino/globals.h +++ b/speeduino/globals.h @@ -648,7 +648,7 @@ struct statuses { unsigned int PW8; ///< In uS volatile byte runSecs; /**< Counter of seconds since cranking commenced (Maxes out at 255 to prevent overflow) */ volatile byte secl; /**< Counter incrementing once per second. Will overflow after 255 and begin again. This is used by TunerStudio to maintain comms sync */ - volatile uint32_t loopsPerSecond; /**< A performance indicator showing the number of main loops that are being executed each second */ + volatile uint16_t loopsPerSecond; /**< A performance indicator showing the number of main loops that are being executed each second */ bool launchingSoft; /**< Indicator showing whether soft launch control adjustments are active */ bool launchingHard; /**< Indicator showing whether hard launch control adjustments are active */ uint16_t freeRAM; diff --git a/speeduino/logger.cpp b/speeduino/logger.cpp index 912f405d21..380aaac6c3 100644 --- a/speeduino/logger.cpp +++ b/speeduino/logger.cpp @@ -50,11 +50,9 @@ byte getTSLogEntry(uint16_t byteNum) case 25: statusValue = currentStatus.TPS; break; // TPS (0% to 100%) case 26: - if(currentStatus.loopsPerSecond > 60000U) { currentStatus.loopsPerSecond = 60000U;} statusValue = lowByte(currentStatus.loopsPerSecond); break; case 27: - if(currentStatus.loopsPerSecond > 60000U) { currentStatus.loopsPerSecond = 60000U;} statusValue = highByte(currentStatus.loopsPerSecond); break; diff --git a/speeduino/speeduino.ino b/speeduino/speeduino.ino index d69e7e07ef..1d0e930fd7 100644 --- a/speeduino/speeduino.ino +++ b/speeduino/speeduino.ino @@ -99,7 +99,7 @@ inline uint16_t applyFuelTrimToPW(trimTable3d *pTrimTable, int16_t fuelLoad, int // it to inline, so we need to suppress the resulting warning. void __attribute__((always_inline)) loop(void) { - mainLoopCount++; + if(mainLoopCount < UINT16_MAX) { mainLoopCount++; } LOOP_TIMER = TIMER_mask; //SERIAL Comms