diff --git a/firmware/controllers/trigger/decoders/trigger_mitsubishi.cpp b/firmware/controllers/trigger/decoders/trigger_mitsubishi.cpp index 4176048af6..b376a5fdd8 100644 --- a/firmware/controllers/trigger/decoders/trigger_mitsubishi.cpp +++ b/firmware/controllers/trigger/decoders/trigger_mitsubishi.cpp @@ -82,6 +82,31 @@ void initialize36_2_1_1(TriggerWaveform *s) { s->setSecondTriggerSynchronizationGap(1); // redundancy } +void initialize36_2_1(TriggerWaveform *s) { + s->initialize(FOUR_STROKE_CRANK_SENSOR); + s->tdcPosition = 90; + int totalTeethCount = 36; + + float engineCycle = FOUR_STROKE_ENGINE_CYCLE; + float toothWidth = 0.5; + + float oneTooth = 720 / totalTeethCount; + + float offset = (36 - 17 - 2 - 16) * oneTooth; + + addSkippedToothTriggerEvents(T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle, + NO_LEFT_FILTER, offset + 17 * oneTooth + 1); + + offset += (17 + 2) * oneTooth; + + addSkippedToothTriggerEvents(T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle, + NO_LEFT_FILTER, offset + 16 * oneTooth + 1); + + + s->setTriggerSynchronizationGap(3); + s->setSecondTriggerSynchronizationGap(1); // redundancy +} + void initializeVvt3A92(TriggerWaveform *s) { s->initialize(FOUR_STROKE_CRANK_SENSOR); diff --git a/firmware/controllers/trigger/decoders/trigger_mitsubishi.h b/firmware/controllers/trigger/decoders/trigger_mitsubishi.h index 49477eb53b..5c21271192 100644 --- a/firmware/controllers/trigger/decoders/trigger_mitsubishi.h +++ b/firmware/controllers/trigger/decoders/trigger_mitsubishi.h @@ -13,6 +13,7 @@ void initializeMitsubishi4g18(TriggerWaveform *s); void configureFordAspireTriggerWaveform(TriggerWaveform * s); void initialize36_2_1_1(TriggerWaveform *s); +void initialize36_2_1(TriggerWaveform *s); void initializeVvt3A92(TriggerWaveform *s); void initializeVvt6G75(TriggerWaveform *s); diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index c27abd290b..4e5dc14d96 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -610,6 +610,9 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e ambiguousOperat break; case TT_36_2_1: + initialize36_2_1(this); + break; + case TT_TOOTHED_WHEEL_32_2: setToothedWheelConfiguration(this, 32, 2, ambiguousOperationMode); // todo: add this second/third into 'setToothedWheelConfiguration' as long as we have enough tooth?