diff --git a/firmware/config/engines/toyota_jzs147.cpp b/firmware/config/engines/toyota_jzs147.cpp index 3bd65f0a4c..16804abf02 100644 --- a/firmware/config/engines/toyota_jzs147.cpp +++ b/firmware/config/engines/toyota_jzs147.cpp @@ -79,7 +79,7 @@ void setToyota_2jz_vics() { engineConfiguration->triggerInputPins[1] = Gpio::Unassigned; // cam sensor will he handled by custom vtti code engineConfiguration->camInputs[0] = Gpio::C6; - engineConfiguration->vvtMode[0] = VVT_2JZ; + engineConfiguration->vvtMode[0] = VVT_TOYOTA_3_TOOTH; // set global_trigger_offset_angle 155 engineConfiguration->globalTriggerAngleOffset = 155; // todo diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index b49ebb629e..36a8085825 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -67,8 +67,8 @@ trigger_type_e getVvtTriggerType(vvt_mode_e vvtMode) { switch (vvtMode) { case VVT_INACTIVE: return trigger_type_e::TT_HALF_MOON; - case VVT_2JZ: - return trigger_type_e::TT_VVT_JZ; + case VVT_TOYOTA_3_TOOTH: + return trigger_type_e::TT_VVT_TOYOTA_3_TOOTH; case VVT_MIATA_NB: return trigger_type_e::TT_VVT_MIATA_NB; case VVT_BOSCH_QUICK_START: diff --git a/firmware/controllers/algo/engine_types.h b/firmware/controllers/algo/engine_types.h index 310cb88cde..7c60907cd4 100644 --- a/firmware/controllers/algo/engine_types.h +++ b/firmware/controllers/algo/engine_types.h @@ -327,10 +327,14 @@ enum class trigger_type_e : uint32_t { // * Note: this trigger is used only by unit tests // * see also TT_ONE a bit below TT_ONE_PLUS_ONE = 16, - // * VVT for 2JZ, three evenly spaces teeth - TT_VVT_JZ = 17, + /** + * VVT for 2JZ + * three evenly spaces teeth + */ + TT_VVT_TOYOTA_3_TOOTH = 17, // just one channel with one perfectly 180 degree tooth with proper reliable Hall sensor, see also TT_NARROW_SINGLE_TOOTH TT_HALF_MOON = 18, + TT_DODGE_RAM = 19, // * It looks like this is the VR shape if you have your wires flipped TT_60_2_VW = 20, @@ -416,7 +420,7 @@ enum class trigger_type_e : uint32_t { // Renault F3R TT_60_2_2_F3R = 75, TT_MITSU_4G63_CRANK = 76, - /* pull-up'ed(inverted in): pull down 2x 30 deg before tdc on cam, till tdc. + /* pull-up'ed(inverted in): pull down 2x 30 deg before tdc on cam, till tdc. e.g. Sovek, Saruman ignition blind type */ TT_60DEG_TOOTH = 77, TT_VVT_MITSUBISHI_4G69 = 78, diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index 8bc4ede112..b7a4295658 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -60,7 +60,7 @@ typedef enum __attribute__ ((__packed__)) { /** * 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, + VVT_TOYOTA_3_TOOTH = 2, /** * Mazda NB2 has three cam tooth. We synchronize based on gap ratio. * @see TT_VVT_MIATA_NB diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index b3bd6d97b1..ca51abb109 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -571,7 +571,7 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e triggerOperatio configureDaihatsu4(this); break; - case trigger_type_e::TT_VVT_JZ: + case trigger_type_e::TT_VVT_TOYOTA_3_TOOTH: initializeSkippedToothTrigger(this, 3, 0, triggerOperationMode, SyncEdge::RiseOnly); break; diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index 0657068ee1..b28d1c5bfd 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -116,7 +116,7 @@ static int getCrankDivider(operation_mode_e operationMode) { static bool vvtWithRealDecoder(vvt_mode_e vvtMode) { return vvtMode != VVT_INACTIVE - && vvtMode != VVT_2JZ /* VVT_2JZ is an unusual 3/0 missed tooth symmetrical wheel */ + && vvtMode != VVT_TOYOTA_3_TOOTH /* VVT_2JZ is an unusual 3/0 missed tooth symmetrical wheel */ && vvtMode != VVT_HONDA_K_INTAKE && vvtMode != VVT_MAP_V_TWIN && vvtMode != VVT_SINGLE_TOOTH; @@ -179,7 +179,7 @@ static angle_t adjustCrankPhase(int camIndex) { case VVT_NISSAN_VQ: case VVT_BOSCH_QUICK_START: case VVT_MIATA_NB: - case VVT_2JZ: + case VVT_TOYOTA_3_TOOTH: case VVT_TOYOTA_4_1: case VVT_FORD_COYOTE: case VVT_FORD_ST170: @@ -349,7 +349,7 @@ void hwHandleVvtCamSignal(TriggerValue front, efitick_t nowNt, int index) { } switch(engineConfiguration->vvtMode[camIndex]) { - case VVT_2JZ: + case VVT_TOYOTA_3_TOOTH: { int from = engineConfiguration->camDecoder2jzPosition - engineConfiguration->camDecoder2jzPrecision; int to = engineConfiguration->camDecoder2jzPosition + engineConfiguration->camDecoder2jzPrecision; diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 2a81ddd669..153dbf90ee 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -284,7 +284,7 @@ end_struct #define debug_mode_e_enum "INVALID", "TPS acceleration enrichment", "INVALID", "Stepper Idle Control", "Engine Load accl enrich", "Trigger Counters", "Soft Spark Cut", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "SD card", "sr5", "Knock", "INVALID", "Electronic Throttle", "Executor", "Bench Test / TS commands", "INVALID", "Analog inputs #1", "INSTANT_RPM", "INVALID", "Status", "INVALID", "INVALID", "MAP", "Metrics", "INVALID", "Ion Sense", "TLE8888", "Analog inputs #2", "Dwell Metric", "INVALID", "INVALID", "Boost Control", "INVALID", "INVALID", "ETB Autotune", "Composite Log", "INVALID", "INVALID", "INVALID", "Dyno_View", "Logic_Analyzer", "INVALID", "TCU", "Lua" custom debug_mode_e 1 bits, U08, @OFFSET@, [0:5], @@debug_mode_e_enum@@ -#define vvt_mode_e_enum "Inactive", "Single Tooth", "2JZ", "Miata NB2", "Mitsu 4G69", "Bosch Quick Start", "4/1", "ST 170", "Ford Barra 3+1", "Nissan VQ", "Honda K Intake", "Nissan MR18", "Mitsu 3A92", "VTwin by MAP", "Mitsu 6G75", "Mazda Skyactiv", "Honda K Exhaust", "Mitsubishi 4G92/93/94", "Mitsubishi 4G63", "Ford Coyote" +#define vvt_mode_e_enum "Inactive", "Single Tooth", "Toyota 3 Tooth", "Miata NB2", "Mitsu 4G69", "Bosch Quick Start", "4/1", "ST 170", "Ford Barra 3+1", "Nissan VQ", "Honda K Intake", "Nissan MR18", "Mitsu 3A92", "VTwin by MAP", "Mitsu 6G75", "Mazda Skyactiv", "Honda K Exhaust", "Mitsubishi 4G92/93/94", "Mitsubishi 4G63", "Ford Coyote" custom vvt_mode_e 1 bits, U08, @OFFSET@, [0:5], @@vvt_mode_e_enum@@ ! At the moment TIM1, TIM2, TIM3 and TIM9 are configured as ICU diff --git a/firmware/tunerstudio/rusefi.input b/firmware/tunerstudio/rusefi.input index ca06bff2a8..b7c0b463dd 100644 --- a/firmware/tunerstudio/rusefi.input +++ b/firmware/tunerstudio/rusefi.input @@ -2359,8 +2359,8 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_ ; todo: https://github.com/rusefi/rusefi/issues/2077 field = "Cam mode (intake)", vvtMode1, {trigger_type != @@trigger_type_e_TT_MAZDA_MIATA_NA@@} - field = "2JZ Position", camDecoder2jzPosition, 1, {vvtMode1 == @@vvt_mode_e_VVT_2JZ@@} - field = "2JZ Precision", camDecoder2jzPrecision, 1, {vvtMode1 == @@vvt_mode_e_VVT_2JZ@@} + field = "2JZ Position", camDecoder2jzPosition, 1, {vvtMode1 == @@vvt_mode_e_VVT_TOYOTA_3_TOOTH@@} + field = "2JZ Precision", camDecoder2jzPrecision, 1, {vvtMode1 == @@vvt_mode_e_VVT_TOYOTA_3_TOOTH@@} field = "Cam mode (exhaust)", vvtMode2, {trigger_type != @@trigger_type_e_TT_MAZDA_MIATA_NA@@} field = "" field = "Cam sensor bank 1 intake", camInputs1, { camInputs1 != 0 || (vvtMode1 != @@vvt_mode_e_VVT_INACTIVE@@ ) } diff --git a/unit_tests/tests/trigger/test_real_toyota_3_tooth_cam.cpp b/unit_tests/tests/trigger/test_real_toyota_3_tooth_cam.cpp index fdbb1007ed..8109377a43 100644 --- a/unit_tests/tests/trigger/test_real_toyota_3_tooth_cam.cpp +++ b/unit_tests/tests/trigger/test_real_toyota_3_tooth_cam.cpp @@ -9,7 +9,7 @@ TEST(realToyota3ToothCam, running) { engineConfiguration->isFasterEngineSpinUpEnabled = true; engineConfiguration->alwaysInstantRpm = true; - engineConfiguration->vvtMode[0] = VVT_2JZ; + engineConfiguration->vvtMode[0] = VVT_TOYOTA_3_TOOTH; engineConfiguration->vvtOffsets[0] = 152.583f; engineConfiguration->trigger.customTotalToothCount = 36;