From 3c2fc8d86a85f3699786c99da0d0c60d88f1dbe3 Mon Sep 17 00:00:00 2001 From: rusefi Date: Sun, 21 Oct 2018 14:55:52 -0400 Subject: [PATCH] refactoring trigger sync layer --- firmware/controllers/trigger/trigger_decoder.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index ea38652367..6357dbfc37 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -423,9 +423,10 @@ void TriggerState::decodeTriggerEvent(trigger_event_e const signal, efitime_t no ; } - toothDurations[3] = toothDurations[2]; - toothDurations[2] = toothDurations[1]; - toothDurations[1] = toothDurations[0]; + for (int i = GAP_TRACKING_LENGHT; i > 0; i--) { + toothDurations[i] = toothDurations[i - 1]; + } + toothed_previous_time = nowNt; } if (!isValidIndex(PASS_ENGINE_PARAMETER_SIGNATURE) && !isInitializingTrigger) {