From 39364ced5915f823c0c701b492f39ed332b5f510 Mon Sep 17 00:00:00 2001 From: Andrey Date: Sat, 17 Jul 2021 01:10:13 -0400 Subject: [PATCH] kaiju is asking for vq30de trigger wheel decoder #2974 --- .../trigger/decoders/trigger_nissan.cpp | 35 +++++++++++++++++++ .../trigger/decoders/trigger_structure.cpp | 3 ++ 2 files changed, 38 insertions(+) diff --git a/firmware/controllers/trigger/decoders/trigger_nissan.cpp b/firmware/controllers/trigger/decoders/trigger_nissan.cpp index 28d4135707..d21ed59b63 100644 --- a/firmware/controllers/trigger/decoders/trigger_nissan.cpp +++ b/firmware/controllers/trigger/decoders/trigger_nissan.cpp @@ -143,7 +143,42 @@ void initializeNissanVQ35crank(TriggerWaveform *s) { } } +static void addvq30tooth(TriggerWaveform *s, float angle) { + s->addEvent360(angle - 4, T_PRIMARY, TV_RISE); + s->addEvent360(angle, T_PRIMARY, TV_FALL); +} + void initializeNissanVQ30cam(TriggerWaveform *s) { s->initialize(FOUR_STROKE_CAM_SENSOR); + addvq30tooth(s, 52 + 9 * 0); + addvq30tooth(s, 52 + 9 * 1); + + addvq30tooth(s, 85 + 9 * 0); + addvq30tooth(s, 85 + 9 * 1); + addvq30tooth(s, 85 + 9 * 2); + addvq30tooth(s, 85 + 9 * 3); + addvq30tooth(s, 85 + 9 * 4); + + addvq30tooth(s, 152 + 9 * 0); + addvq30tooth(s, 152 + 9 * 1); + addvq30tooth(s, 152 + 9 * 2); + addvq30tooth(s, 152 + 9 * 3); + + addvq30tooth(s, 236 ); + + addvq30tooth(s, 252 + 9 * 0); + addvq30tooth(s, 252 + 9 * 1); + addvq30tooth(s, 252 + 9 * 2); + addvq30tooth(s, 252 + 9 * 3); + addvq30tooth(s, 252 + 9 * 4); + addvq30tooth(s, 252 + 9 * 5); + + addvq30tooth(s, 360 - 9 * 2); + addvq30tooth(s, 360 - 9 * 1); + addvq30tooth(s, 360 - 9 * 0); + + s->setTriggerSynchronizationGap3(/*gapIndex*/0, 5.78 * TRIGGER_GAP_DEVIATION_LOW, 5.78 * TRIGGER_GAP_DEVIATION_HIGH); + s->setTriggerSynchronizationGap3(/*gapIndex*/1, 1.00 * TRIGGER_GAP_DEVIATION_LOW, 1.00 * TRIGGER_GAP_DEVIATION_HIGH); + s->setTriggerSynchronizationGap3(/*gapIndex*/2, 0.20 * TRIGGER_GAP_DEVIATION_LOW, 0.20 * TRIGGER_GAP_DEVIATION_HIGH); } diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index c9157f4b7f..8279c5e948 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -550,6 +550,9 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e ambiguousOperat break; case TT_NISSAN_VQ30: + initializeNissanVQ30cam(this); + break; + case TT_NISSAN_VQ35: initializeNissanVQ35crank(this); break;