From 30e566068cb86430c70fbe53f45ef9e4582c1984 Mon Sep 17 00:00:00 2001 From: Josh Stewart Date: Tue, 21 Dec 2021 12:54:38 +1100 Subject: [PATCH] Remove extra tooth log buffer definition. Slight RAM free up --- speeduino/decoders.ino | 2 +- speeduino/globals.h | 6 ++---- speeduino/globals.ino | 4 ++-- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/speeduino/decoders.ino b/speeduino/decoders.ino index e2095ca7..bb981038 100644 --- a/speeduino/decoders.ino +++ b/speeduino/decoders.ino @@ -152,7 +152,7 @@ static inline void addToothLogEntry(unsigned long toothTime, bool whichTooth) //If there has been a value logged above, update the indexes if(valueLogged == true) { - if(toothHistoryIndex < TOOTH_LOG_SIZE) { toothHistoryIndex++; BIT_CLEAR(currentStatus.status1, BIT_STATUS1_TOOTHLOG1READY); } + if(toothHistoryIndex < (TOOTH_LOG_SIZE-1)) { toothHistoryIndex++; BIT_CLEAR(currentStatus.status1, BIT_STATUS1_TOOTHLOG1READY); } else { BIT_SET(currentStatus.status1, BIT_STATUS1_TOOTHLOG1READY); } } diff --git a/speeduino/globals.h b/speeduino/globals.h index 2d02b6f4..3598ec96 100644 --- a/speeduino/globals.h +++ b/speeduino/globals.h @@ -235,10 +235,8 @@ #ifndef UNIT_TEST #define TOOTH_LOG_SIZE 127 -#define TOOTH_LOG_BUFFER 128 //256 #else #define TOOTH_LOG_SIZE 1 -#define TOOTH_LOG_BUFFER 1 //256 #endif #define COMPOSITE_LOG_PRI 0 @@ -569,8 +567,8 @@ extern volatile unsigned long ms_counter; //A counter that increments once per m extern uint16_t fixedCrankingOverride; extern bool clutchTrigger; extern bool previousClutchTrigger; -extern volatile uint32_t toothHistory[TOOTH_LOG_BUFFER]; -extern volatile uint8_t compositeLogHistory[TOOTH_LOG_BUFFER]; +extern volatile uint32_t toothHistory[TOOTH_LOG_SIZE]; +extern volatile uint8_t compositeLogHistory[TOOTH_LOG_SIZE]; extern volatile bool fpPrimed; //Tracks whether or not the fuel pump priming has been completed yet extern volatile bool injPrimed; //Tracks whether or not the injector priming has been completed yet extern volatile unsigned int toothHistoryIndex; diff --git a/speeduino/globals.ino b/speeduino/globals.ino index 744c09e2..a637c5be 100644 --- a/speeduino/globals.ino +++ b/speeduino/globals.ino @@ -131,8 +131,8 @@ volatile unsigned long ms_counter = 0; //A counter that increments once per ms uint16_t fixedCrankingOverride = 0; bool clutchTrigger; bool previousClutchTrigger; -volatile uint32_t toothHistory[TOOTH_LOG_BUFFER]; ///< Tooth trigger history - delta time (in uS) from last tooth (Indexed by @ref toothHistoryIndex) -volatile uint8_t compositeLogHistory[TOOTH_LOG_BUFFER]; +volatile uint32_t toothHistory[TOOTH_LOG_SIZE]; ///< Tooth trigger history - delta time (in uS) from last tooth (Indexed by @ref toothHistoryIndex) +volatile uint8_t compositeLogHistory[TOOTH_LOG_SIZE]; volatile bool fpPrimed = false; ///< Tracks whether or not the fuel pump priming has been completed yet volatile bool injPrimed = false; ///< Tracks whether or not the injectors priming has been completed yet volatile unsigned int toothHistoryIndex = 0; ///< Current index to @ref toothHistory array