From 402f36aad6ecc47be45636f32e265b127c781727 Mon Sep 17 00:00:00 2001 From: Andrey Date: Sat, 19 Mar 2022 22:06:19 -0400 Subject: [PATCH] Mitsubishi 3A92 Support - 3 cylinder #4011 --- firmware/controllers/algo/engine.cpp | 3 +++ firmware/controllers/algo/rusefi_enums.h | 4 +++- .../trigger/decoders/trigger_mitsubishi.cpp | 22 ++++++++++++++++--- .../trigger/decoders/trigger_structure.cpp | 5 ++++- firmware/integration/rusefi_config.txt | 4 ++-- 5 files changed, 31 insertions(+), 7 deletions(-) diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index 01b005d8ff..3c809b8262 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -87,6 +87,9 @@ trigger_type_e getVvtTriggerType(vvt_mode_e vvtMode) { return TT_VVT_BARRA_3_PLUS_1; case VVT_NISSAN_VQ: return TT_VVT_NISSAN_VQ35; + case VVT_MITSUBISHI_3A92: + return TT_VVT_MITSUBISHI_3A92; + case VVT_MITSUBISHI_6G75: case VVT_NISSAN_MR: return TT_NISSAN_MR18_CAM_VVT; default: diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index f782497f6a..29e2d9fad2 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -118,10 +118,12 @@ typedef enum __attribute__ ((__packed__)) { VVT_NISSAN_MR = 11, - VVT_12 = 12, + VVT_MITSUBISHI_3A92 = 12, VVT_MAP_V_TWIN_ANOTHER = 13, + VVT_MITSUBISHI_6G75 = 14, + } vvt_mode_e; /** diff --git a/firmware/controllers/trigger/decoders/trigger_mitsubishi.cpp b/firmware/controllers/trigger/decoders/trigger_mitsubishi.cpp index 31c4e67a9a..4176048af6 100644 --- a/firmware/controllers/trigger/decoders/trigger_mitsubishi.cpp +++ b/firmware/controllers/trigger/decoders/trigger_mitsubishi.cpp @@ -83,10 +83,26 @@ void initialize36_2_1_1(TriggerWaveform *s) { } void initializeVvt3A92(TriggerWaveform *s) { -// s->shapeWithoutTdc = true; -// s->isSynchronizationNeeded = false; + s->initialize(FOUR_STROKE_CRANK_SENSOR); + + int w = 5; + s->addEvent360(120 - w, T_PRIMARY, TV_RISE); + s->addEvent360(120, T_PRIMARY, TV_FALL); + + s->addEvent360(12 + 120 - w, T_PRIMARY, TV_RISE); + s->addEvent360(12 + 120, T_PRIMARY, TV_FALL); + + s->addEvent360(240 - w, T_PRIMARY, TV_RISE); + s->addEvent360(240, T_PRIMARY, TV_FALL); + + s->addEvent360(360 - w, T_PRIMARY, TV_RISE); + s->addEvent360(360, T_PRIMARY, TV_FALL); + + s->setTriggerSynchronizationGap(9); + s->setSecondTriggerSynchronizationGap(0.11); // redundancy } void initializeVvt6G75(TriggerWaveform *s) { - + // s->shapeWithoutTdc = true; + // s->isSynchronizationNeeded = false; } diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index 011f1a5a93..c27abd290b 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -532,8 +532,11 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e ambiguousOperat initializeNissanVQvvt(this); break; - case TT_VVT_MITSUBISHI_6G75: case TT_VVT_MITSUBISHI_3A92: + initializeVvt3A92(this); + break; + + case TT_VVT_MITSUBISHI_6G75: case TT_NISSAN_QR25: initializeNissanQR25crank(this); break; diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index dd0e2dafd6..90c8be45a2 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -296,8 +296,8 @@ custom debug_mode_e 4 bits, U32, @OFFSET@, [0:5], @@debug_mode_e_enum@@ #define VM_VVT_INACTIVE 0 -#define vvt_mode_e_enum "Inactive", "Single Tooth Second Half", "2GZ", "Miata NB2", "Single Tooth First Half", "Bosch Quick Start", "4/1", "ST 170", "Ford Barra 3+1", "Nissan VQ", "Honda K 4+1", "Nissan MR18", "INVALID", "VTwin by MAP", "vvt14", "vvt15" -custom vvt_mode_e 1 bits, U08, @OFFSET@, [0:3], @@vvt_mode_e_enum@@ +#define vvt_mode_e_enum "Inactive", "Single Tooth Second Half", "2GZ", "Miata NB2", "Single Tooth First Half", "Bosch Quick Start", "4/1", "ST 170", "Ford Barra 3+1", "Nissan VQ", "Honda K 4+1", "Nissan MR18", "Mitsu 3A92", "VTwin by MAP", "Mitsu 6G75", "vvt15", "vvt16", "vvt17" +custom vvt_mode_e 1 bits, U08, @OFFSET@, [0:4], @@vvt_mode_e_enum@@ ! At the moment TIM1, TIM2, TIM3 and TIM9 are configured as ICU ! todo: as of ChibiOS3, only channels 1 & 2 are allowed to capture input, that's a ChibiOS driver limitation