diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index bd4cbfa99a..72ece4c9d0 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -219,7 +219,6 @@ int TriggerCentral::getHwEventCounter(int index) { void TriggerCentral::resetCounters() { memset(hwEventCounters, 0, sizeof(hwEventCounters)); - triggerState.resetRunningCounters(); } void TriggerCentral::resetAccumSignalData() { diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index c0753906c0..a39e920bb3 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -116,7 +116,7 @@ void calculateTriggerSynchPoint(TriggerShape *shape, TriggerState *state DECLARE } } -efitime_t TriggerState::getTotalEventCounter() { +efitime_t TriggerState::getTotalEventCounter() const { return totalEventCountBase + currentCycle.current_index; } @@ -257,7 +257,6 @@ void TriggerState::resetTriggerState() { prevSignal = SHAFT_PRIMARY_FALLING; startOfCycleNt = 0; - resetRunningCounters(); resetCurrentCycleState(); memset(expectedTotalTime, 0, sizeof(expectedTotalTime)); @@ -544,7 +543,6 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no startOfCycleNt = nowNt; resetCurrentCycleState(); incrementTotalEventCounter(); - runningRevolutionCounter++; totalEventCountBase += getTriggerSize(); @@ -552,7 +550,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no if (printTriggerDebug) { printf("index=%d %d\r\n", currentCycle.current_index, - runningRevolutionCounter); + totalRevolutionCounter); } #endif /* EFI_UNIT_TEST */ } else { /* if (!isSynchronizationPoint) */ @@ -651,16 +649,10 @@ void initTriggerDecoderLogger(Logging *sharedLogger) { logger = sharedLogger; } -efitime_t TriggerState::getStartOfRevolutionIndex() { +efitime_t TriggerState::getStartOfRevolutionIndex() const { return totalEventCountBase; } -void TriggerState::resetRunningCounters() { - runningRevolutionCounter = 0; - runningTriggerErrorCounter = 0; - runningOrderingErrorCounter = 0; -} - void TriggerState::runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) { // empty base implementation } diff --git a/firmware/controllers/trigger/trigger_decoder.h b/firmware/controllers/trigger/trigger_decoder.h index 5d3ee4c16a..1409ef5c58 100644 --- a/firmware/controllers/trigger/trigger_decoder.h +++ b/firmware/controllers/trigger/trigger_decoder.h @@ -57,8 +57,8 @@ public: */ bool isEvenRevolution() const; void incrementTotalEventCounter(); - efitime_t getTotalEventCounter(); - efitime_t getStartOfRevolutionIndex(); + efitime_t getTotalEventCounter() const; + efitime_t getStartOfRevolutionIndex() const; void decodeTriggerEvent(trigger_event_e const signal, efitime_t nowUs DECLARE_ENGINE_PARAMETER_SUFFIX); /** * Resets synchronization flag and alerts rpm_calculator to reset engine spinning flag. @@ -93,16 +93,12 @@ public: * how many times since ECU reboot we had unexpected number of teeth in trigger cycle */ uint32_t totalTriggerErrorCounter; - uint32_t runningTriggerErrorCounter; uint32_t orderingErrorCounter; - uint32_t runningOrderingErrorCounter; void resetTriggerState(); - void resetRunningCounters(); virtual void runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX); - uint32_t runningRevolutionCounter; /** * this is start of real trigger cycle * for virtual double trigger see timeAtVirtualZeroNt