From a9b15e3ceee8a8d1d9dde185ad1a64274562c607 Mon Sep 17 00:00:00 2001 From: rusefi Date: Sun, 10 May 2020 02:36:01 -0400 Subject: [PATCH] that's embarrassing --- .../controllers/algo/auto_generated_enums.cpp | 4 ++-- firmware/config/engines/toyota_jzs147.cpp | 2 +- firmware/controllers/algo/auto_generated_enums.cpp | 4 ++-- firmware/controllers/algo/rusefi_enums.h | 14 +++++++++++++- firmware/controllers/trigger/trigger_central.h | 4 ++++ 5 files changed, 22 insertions(+), 6 deletions(-) diff --git a/firmware/config/boards/kinetis/config/controllers/algo/auto_generated_enums.cpp b/firmware/config/boards/kinetis/config/controllers/algo/auto_generated_enums.cpp index 4d71158447..e1d6ab9059 100644 --- a/firmware/config/boards/kinetis/config/controllers/algo/auto_generated_enums.cpp +++ b/firmware/config/boards/kinetis/config/controllers/algo/auto_generated_enums.cpp @@ -1101,8 +1101,8 @@ case Force_4_bytes_size_vvt_mode: return "Force_4_bytes_size_vvt_mode"; case MIATA_NB2: return "MIATA_NB2"; -case VVT_2GZ: - return "VVT_2GZ"; +case VVT_2JZ: + return "VVT_2JZ"; case VVT_FIRST_HALF: return "VVT_FIRST_HALF"; case VVT_SECOND_HALF: diff --git a/firmware/config/engines/toyota_jzs147.cpp b/firmware/config/engines/toyota_jzs147.cpp index b978594adc..b6547caf39 100644 --- a/firmware/config/engines/toyota_jzs147.cpp +++ b/firmware/config/engines/toyota_jzs147.cpp @@ -110,7 +110,7 @@ void setToyota_2jz_vics(DECLARE_CONFIG_PARAMETER_SIGNATURE) { engineConfiguration->triggerInputPins[1] = GPIO_UNASSIGNED; // cam sensor will he handled by custom vtti code engineConfiguration->camInputs[0] = GPIOC_6; - engineConfiguration->vvtMode = VVT_2GZ; + engineConfiguration->vvtMode = VVT_2JZ; // set global_trigger_offset_angle 155 engineConfiguration->globalTriggerAngleOffset = 155; // todo diff --git a/firmware/controllers/algo/auto_generated_enums.cpp b/firmware/controllers/algo/auto_generated_enums.cpp index 7f9ffb07a1..451fedf6bb 100644 --- a/firmware/controllers/algo/auto_generated_enums.cpp +++ b/firmware/controllers/algo/auto_generated_enums.cpp @@ -1245,8 +1245,8 @@ case Force_4_bytes_size_vvt_mode: return "Force_4_bytes_size_vvt_mode"; case MIATA_NB2: return "MIATA_NB2"; -case VVT_2GZ: - return "VVT_2GZ"; +case VVT_2JZ: + return "VVT_2JZ"; case VVT_FIRST_HALF: return "VVT_FIRST_HALF"; case VVT_SECOND_HALF: diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index f0655084a3..69b48ea11c 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -388,9 +388,21 @@ typedef enum { } trigger_event_e; typedef enum { + /** + * Single-tooth cam sensor mode where TDC and cam signal happen in the same 360 degree of 720 degree engine cycle + */ VVT_FIRST_HALF = 0, + /** + * Single-tooth cam sensor mode where TDC and cam signal happen in opposite 360 degree of 720 degree engine cycle + */ VVT_SECOND_HALF = 1, - VVT_2GZ = 2, + /** + * Toyota 2JZ has three cam tooth. We pick one of these three tooth to synchronize based on the expected angle position of the event + */ + VVT_2JZ = 2, + /** + * Mazda NB2 has three cam tooth. We synchronize based on gap ratio. + */ MIATA_NB2 = 3, Force_4_bytes_size_vvt_mode = ENUM_32_BITS, } vvt_mode_e; diff --git a/firmware/controllers/trigger/trigger_central.h b/firmware/controllers/trigger/trigger_central.h index d076f3c83d..07a169d7a8 100644 --- a/firmware/controllers/trigger/trigger_central.h +++ b/firmware/controllers/trigger/trigger_central.h @@ -50,7 +50,11 @@ public: angle_t getVVTPosition(); + // latest VVT event position (could be not synchronization event) + angle_t currentVVTEventPosition = 0; + // synchronization event position angle_t vvtPosition = 0; + /** * this is similar to TriggerState#startOfCycleNt but with the crank-only sensor magic */