From 836dabdc1d9c728c8f7049043fddd7af55002d26 Mon Sep 17 00:00:00 2001 From: rusEfi Date: Mon, 13 Jun 2016 16:03:13 -0400 Subject: [PATCH] auto-sync --- firmware/config/engines/toyota_jzs147.cpp | 1 + .../controllers/algo/auto_generated_enums.cpp | 6 +++-- firmware/controllers/algo/rusefi_enums.h | 7 +++-- .../controllers/trigger/trigger_decoder.cpp | 8 ++++-- .../controllers/trigger/trigger_toyota.cpp | 26 ++++++++++++++++++- firmware/controllers/trigger/trigger_toyota.h | 3 ++- 6 files changed, 43 insertions(+), 8 deletions(-) diff --git a/firmware/config/engines/toyota_jzs147.cpp b/firmware/config/engines/toyota_jzs147.cpp index 79990cd911..4cd8ce405a 100644 --- a/firmware/config/engines/toyota_jzs147.cpp +++ b/firmware/config/engines/toyota_jzs147.cpp @@ -34,6 +34,7 @@ void setToyota_jzs147EngineConfiguration(DECLARE_ENGINE_PARAMETER_F) { // temporary while I am fixing trigger bug setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR); + //set_trigger_type 16 engineConfiguration->trigger.type = TT_TOOTHED_WHEEL; engineConfiguration->trigger.customTotalToothCount = 36; engineConfiguration->trigger.customSkippedToothCount = 2; diff --git a/firmware/controllers/algo/auto_generated_enums.cpp b/firmware/controllers/algo/auto_generated_enums.cpp index 2ff430e651..d530cde29d 100644 --- a/firmware/controllers/algo/auto_generated_enums.cpp +++ b/firmware/controllers/algo/auto_generated_enums.cpp @@ -175,8 +175,10 @@ case TT_UNUSED: return "TT_UNUSED"; case TT_NISSAN: return "TT_NISSAN"; -case TT_2JZ: - return "TT_2JZ"; +case TT_2JZ_1_12: + return "TT_2JZ_1_12"; +case TT_2JZ_3_34: + return "TT_2JZ_3_34"; case TT_ROVER_K: return "TT_ROVER_K"; } diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index f670de3ae7..9e7624ba8d 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -173,7 +173,7 @@ typedef enum { TT_NISSAN = 24, - TT_2JZ = 25, + TT_2JZ_3_34 = 25, TT_ROVER_K = 26, @@ -181,7 +181,10 @@ typedef enum { TT_HONDA_CBR_600 = 28, - TT_UNUSED = 29, // this is used if we want to iterate over all trigger types + TT_2JZ_1_12 = 29, + + TT_UNUSED = 30, // this is used if we want to iterate over all trigger types + Force_4b_trigger_type = ENUM_32_BITS, } trigger_type_e; diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index 8087e57dbd..61d8184c3d 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -522,8 +522,12 @@ void TriggerShape::initializeTriggerShape(Logging *logger DECLARE_ENGINE_PARAMET initialize36_2_2_2(triggerShape); break; - case TT_2JZ: - initialize2jzGE(triggerShape); + case TT_2JZ_3_34: + initialize2jzGE3_34(triggerShape); + break; + + case TT_2JZ_1_12: + initialize2jzGE1_12(triggerShape); break; case TT_NISSAN: diff --git a/firmware/controllers/trigger/trigger_toyota.cpp b/firmware/controllers/trigger/trigger_toyota.cpp index fa67b776a5..d9d1482c55 100644 --- a/firmware/controllers/trigger/trigger_toyota.cpp +++ b/firmware/controllers/trigger/trigger_toyota.cpp @@ -11,7 +11,31 @@ EXTERN_ENGINE; -void initialize2jzGE(TriggerShape *s) { +void initialize2jzGE1_12(TriggerShape *s) { + s->initialize(FOUR_STROKE_CAM_SENSOR, true); + + float crankD = 360 / 12 / 2; // 15 + + float crankAngle = 10; + + for (int i = 0; i < 2; i++) { + s->addEvent(crankAngle + crankD, T_SECONDARY, TV_RISE, -1, 721); + crankAngle += crankD; + s->addEvent(crankAngle + crankD, T_SECONDARY, TV_FALL, -1, 721); // 120 + crankAngle += crankD; + } // 2 + 10 + + + s->addEvent(75, T_PRIMARY, TV_RISE, -1, 721); + + + + s->addEvent(720, T_PRIMARY, TV_FALL, -1, 721); + + s->isSynchronizationNeeded = false; +} + +void initialize2jzGE3_34(TriggerShape *s) { s->initialize(FOUR_STROKE_CAM_SENSOR, true); float camD = 720 / 6; // 120 diff --git a/firmware/controllers/trigger/trigger_toyota.h b/firmware/controllers/trigger/trigger_toyota.h index 25c11b04e2..eb3162cf30 100644 --- a/firmware/controllers/trigger/trigger_toyota.h +++ b/firmware/controllers/trigger/trigger_toyota.h @@ -10,6 +10,7 @@ #include "engine.h" -void initialize2jzGE(TriggerShape *s); +void initialize2jzGE1_12(TriggerShape *s); +void initialize2jzGE3_34(TriggerShape *s); #endif /* CONTROLLERS_TRIGGER_TRIGGER_TOYOTA_H_ */