diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index 3fc27ed07b..f9a1010c2c 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -267,39 +267,46 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no && toothDurations[i] < toothDurations[i + 1] * TRIGGER_SHAPE(syncronizationRatioTo[i])); } + bool isSync = isGapCondition[0]; + for (int index = 1; index < GAP_TRACKING_LENGTH ; index++) { + isSync = isSync && isGapCondition[index]; + } + isSynchronizationPoint = isSync; - /** - * Here I prefer to have two multiplications instead of one division, that's a micro-optimization - */ - isSynchronizationPoint = isGapCondition[0] - && isGapCondition[1] - && isGapCondition[2]; #if EFI_PROD_CODE || defined(__DOXYGEN__) if (CONFIG(isPrintTriggerSynchDetails) || (someSortOfTriggerError && !CONFIG(silentTriggerError))) { #else if (printTriggerDebug) { #endif /* EFI_PROD_CODE */ - float gap = 1.0 * toothDurations[0] / toothDurations[1]; - float prevGap = 1.0 * toothDurations[1] / toothDurations[2]; - float gap3 = 1.0 * toothDurations[2] / toothDurations[3]; + #if EFI_PROD_CODE || defined(__DOXYGEN__) - scheduleMsg(logger, "%d: cur=%.2f/prev=%.2f/3rd=%.2f @ %d while expected from %.2f to %.2f and 2nd from %.2f to %.2f and 3rd from %.2f to %.2f error=%d", - getTimeNowSeconds(), - gap, prevGap, gap3, - currentCycle.current_index, - TRIGGER_SHAPE(syncronizationRatioFrom[0]), TRIGGER_SHAPE(syncronizationRatioTo[0]), - TRIGGER_SHAPE(syncronizationRatioFrom[1]), TRIGGER_SHAPE(syncronizationRatioTo[1]), - TRIGGER_SHAPE(syncronizationRatioFrom[2]), TRIGGER_SHAPE(syncronizationRatioTo[2]), - someSortOfTriggerError); for (int i = 0;i