diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index bbc658bcbd..19a9b4c744 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -236,20 +236,20 @@ float getEngineCycle(operation_mode_e operationMode) { } void addSkippedToothTriggerEvents(trigger_wheel_e wheel, TriggerShape *s, int totalTeethCount, int skippedCount, - operation_mode_e operationMode, float filterLeft, float filterRight) { + float offset, + float engineCycle, float filterLeft, float filterRight) { float toothWidth = 0.5; - float engineCycle = getEngineCycle(operationMode); for (int i = 0; i < totalTeethCount - skippedCount - 1; i++) { float angleDown = engineCycle / totalTeethCount * (i + toothWidth); float angleUp = engineCycle / totalTeethCount * (i + 1); - s->addEvent(angleDown, wheel, TV_HIGH, filterLeft, filterRight); - s->addEvent(angleUp, wheel, TV_LOW, filterLeft, filterRight); + s->addEvent(offset + angleDown, wheel, TV_HIGH, filterLeft, filterRight); + s->addEvent(offset + angleUp, wheel, TV_LOW, filterLeft, filterRight); } float angleDown = engineCycle / totalTeethCount * (totalTeethCount - skippedCount - 1 + toothWidth); - s->addEvent(angleDown, wheel, TV_HIGH, filterLeft, filterRight); - s->addEvent(engineCycle, wheel, TV_LOW, filterLeft, filterRight); + s->addEvent(offset + angleDown, wheel, TV_HIGH, filterLeft, filterRight); + s->addEvent(offset + engineCycle, wheel, TV_LOW, filterLeft, filterRight); } void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount, int skippedCount, @@ -266,7 +266,7 @@ void initializeSkippedToothTriggerShapeExt(TriggerShape *s, int totalTeethCount, efiAssertVoid(s != NULL, "TriggerShape is NULL"); s->reset(operationMode, false); - addSkippedToothTriggerEvents(T_PRIMARY, s, totalTeethCount, skippedCount, operationMode, NO_LEFT_FILTER, NO_RIGHT_FILTER); + addSkippedToothTriggerEvents(T_PRIMARY, s, totalTeethCount, skippedCount, 0, getEngineCycle(operationMode), NO_LEFT_FILTER, NO_RIGHT_FILTER); } static void configureOnePlusOne(TriggerShape *s, operation_mode_e operationMode) { @@ -290,9 +290,11 @@ static void configureOnePlus60_2(TriggerShape *s, operation_mode_e operationMode int skippedCount = 2; s->addEvent(2, T_PRIMARY, TV_HIGH); - addSkippedToothTriggerEvents(T_SECONDARY, s, totalTeethCount, skippedCount, operationMode, 2, 20); + addSkippedToothTriggerEvents(T_SECONDARY, s, totalTeethCount, skippedCount, 0, 360, 2, 20); s->addEvent(20, T_PRIMARY, TV_LOW); - addSkippedToothTriggerEvents(T_SECONDARY, s, totalTeethCount, skippedCount, operationMode, 20, NO_RIGHT_FILTER); + addSkippedToothTriggerEvents(T_SECONDARY, s, totalTeethCount, skippedCount, 0, 360, 20, NO_RIGHT_FILTER); + + addSkippedToothTriggerEvents(T_SECONDARY, s, totalTeethCount, skippedCount, 360, 360, NO_LEFT_FILTER, NO_RIGHT_FILTER); s->isSynchronizationNeeded = false; }