trigger code minor clean-up

This commit is contained in:
rusefi 2019-01-23 21:43:27 -05:00
parent f7a2cc9e63
commit 87930e3b49
3 changed files with 5 additions and 18 deletions

View File

@ -219,7 +219,6 @@ int TriggerCentral::getHwEventCounter(int index) {
void TriggerCentral::resetCounters() { void TriggerCentral::resetCounters() {
memset(hwEventCounters, 0, sizeof(hwEventCounters)); memset(hwEventCounters, 0, sizeof(hwEventCounters));
triggerState.resetRunningCounters();
} }
void TriggerCentral::resetAccumSignalData() { void TriggerCentral::resetAccumSignalData() {

View File

@ -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; return totalEventCountBase + currentCycle.current_index;
} }
@ -257,7 +257,6 @@ void TriggerState::resetTriggerState() {
prevSignal = SHAFT_PRIMARY_FALLING; prevSignal = SHAFT_PRIMARY_FALLING;
startOfCycleNt = 0; startOfCycleNt = 0;
resetRunningCounters();
resetCurrentCycleState(); resetCurrentCycleState();
memset(expectedTotalTime, 0, sizeof(expectedTotalTime)); memset(expectedTotalTime, 0, sizeof(expectedTotalTime));
@ -544,7 +543,6 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
startOfCycleNt = nowNt; startOfCycleNt = nowNt;
resetCurrentCycleState(); resetCurrentCycleState();
incrementTotalEventCounter(); incrementTotalEventCounter();
runningRevolutionCounter++;
totalEventCountBase += getTriggerSize(); totalEventCountBase += getTriggerSize();
@ -552,7 +550,7 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no
if (printTriggerDebug) { if (printTriggerDebug) {
printf("index=%d %d\r\n", printf("index=%d %d\r\n",
currentCycle.current_index, currentCycle.current_index,
runningRevolutionCounter); totalRevolutionCounter);
} }
#endif /* EFI_UNIT_TEST */ #endif /* EFI_UNIT_TEST */
} else { /* if (!isSynchronizationPoint) */ } else { /* if (!isSynchronizationPoint) */
@ -651,16 +649,10 @@ void initTriggerDecoderLogger(Logging *sharedLogger) {
logger = sharedLogger; logger = sharedLogger;
} }
efitime_t TriggerState::getStartOfRevolutionIndex() { efitime_t TriggerState::getStartOfRevolutionIndex() const {
return totalEventCountBase; return totalEventCountBase;
} }
void TriggerState::resetRunningCounters() {
runningRevolutionCounter = 0;
runningTriggerErrorCounter = 0;
runningOrderingErrorCounter = 0;
}
void TriggerState::runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) { void TriggerState::runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX) {
// empty base implementation // empty base implementation
} }

View File

@ -57,8 +57,8 @@ public:
*/ */
bool isEvenRevolution() const; bool isEvenRevolution() const;
void incrementTotalEventCounter(); void incrementTotalEventCounter();
efitime_t getTotalEventCounter(); efitime_t getTotalEventCounter() const;
efitime_t getStartOfRevolutionIndex(); efitime_t getStartOfRevolutionIndex() const;
void decodeTriggerEvent(trigger_event_e const signal, efitime_t nowUs DECLARE_ENGINE_PARAMETER_SUFFIX); 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. * 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 * how many times since ECU reboot we had unexpected number of teeth in trigger cycle
*/ */
uint32_t totalTriggerErrorCounter; uint32_t totalTriggerErrorCounter;
uint32_t runningTriggerErrorCounter;
uint32_t orderingErrorCounter; uint32_t orderingErrorCounter;
uint32_t runningOrderingErrorCounter;
void resetTriggerState(); void resetTriggerState();
void resetRunningCounters();
virtual void runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX); virtual void runtimeStatistics(efitime_t nowNt DECLARE_ENGINE_PARAMETER_SUFFIX);
uint32_t runningRevolutionCounter;
/** /**
* this is start of real trigger cycle * this is start of real trigger cycle
* for virtual double trigger see timeAtVirtualZeroNt * for virtual double trigger see timeAtVirtualZeroNt