diff --git a/firmware/controllers/trigger/decoders/trigger_nissan.cpp b/firmware/controllers/trigger/decoders/trigger_nissan.cpp index ecfbdfab17..d30b5fd070 100644 --- a/firmware/controllers/trigger/decoders/trigger_nissan.cpp +++ b/firmware/controllers/trigger/decoders/trigger_nissan.cpp @@ -119,19 +119,25 @@ void initializeNissanVQvvt(TriggerWaveform *s) { int offset = 720 - 520; - - addPrimaryToothEndingAt(s, offset + 40); - addPrimaryToothEndingAt(s, offset + 160); addPrimaryToothEndingAt(s, offset + 200); - - addPrimaryToothEndingAt(s, offset + 280); - - addPrimaryToothEndingAt(s, offset + 320); - addPrimaryToothEndingAt(s, offset + 520); + s->setTriggerSynchronizationGap(5); +} + +void initializeNissanVQcrank(TriggerWaveform *s) { + s->initialize(FOUR_STROKE_THREE_TIMES_CRANK_SENSOR); + s->setTriggerSynchronizationGap(0.33); + + float currentAngle = 20; + for (int i = 0;i < 10;i++) { + currentAngle += 10; + s->addEventAngle(currentAngle - 5, T_PRIMARY, TV_RISE); + s->addEventAngle(currentAngle, T_PRIMARY, TV_FALL); + } + } diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index b07e4c7111..921cc46c52 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -117,6 +117,7 @@ int TriggerWaveform::getTriggerWaveformSynchPointIndex() const { /** * physical primary trigger duration * @see getEngineCycle + * @see getCrankDivider */ angle_t TriggerWaveform::getCycleDuration() const { switch (operationMode) { @@ -550,6 +551,9 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e ambiguousOperat break; case TT_TT_NISSAN_VQ: + initializeNissanVQcrank(this); + break; + case TT_KAWA_KX450F: configureKawaKX450F(this); break;