From 4c3eae567682051b710827223b9f6e7d9d1b21ea Mon Sep 17 00:00:00 2001 From: rusefillc Date: Thu, 3 Dec 2020 23:54:08 -0500 Subject: [PATCH] FORD ST170 CAM TRIGGER PATTERN fix #2009 --- firmware/CHANGELOG.md | 4 ++ .../controllers/algo/auto_generated_enums.cpp | 8 ++-- .../controllers/algo/auto_generated_enums.cpp | 8 ++-- .../controllers/algo/auto_generated_enums.cpp | 8 ++-- firmware/controllers/algo/engine.cpp | 2 + firmware/controllers/algo/rusefi_enums.h | 4 +- .../trigger/decoders/trigger_misc.cpp | 38 +++++++++++++++---- .../trigger/decoders/trigger_misc.h | 1 + .../trigger/decoders/trigger_structure.cpp | 5 ++- .../controllers/trigger/trigger_central.cpp | 1 + 10 files changed, 60 insertions(+), 19 deletions(-) diff --git a/firmware/CHANGELOG.md b/firmware/CHANGELOG.md index 0e66d2f72e..16046d7cde 100644 --- a/firmware/CHANGELOG.md +++ b/firmware/CHANGELOG.md @@ -27,6 +27,10 @@ All notable user-facing or behavior-altering changes will be documented in this ## XXX 202X Release +### Added + - DAIHATSU 3/4 cylinder trigger https://rusefi.com/images/triggers/trigger_6.png + - Ford ST170 VVT cam trigger https://rusefi.com/images/triggers/trigger_42.png + ## December 2020 National Mutt Day ### Fixed diff --git a/firmware/config/boards/hellen/cypress/config/controllers/algo/auto_generated_enums.cpp b/firmware/config/boards/hellen/cypress/config/controllers/algo/auto_generated_enums.cpp index c1707f35a8..243eb8944a 100644 --- a/firmware/config/boards/hellen/cypress/config/controllers/algo/auto_generated_enums.cpp +++ b/firmware/config/boards/hellen/cypress/config/controllers/algo/auto_generated_enums.cpp @@ -1,7 +1,7 @@ #include "global.h" #include "rusefi_enums.h" #include "rusefi_hw_enums.h" -// was generated automatically by rusEfi tool from rusefi_hw_enums.h // was generated automatically by rusEfi tool from rusefi_enums.h // by enum2string.jar tool on Fri Dec 04 02:59:12 UTC 2020 +// was generated automatically by rusEfi tool from rusefi_hw_enums.h // was generated automatically by rusEfi tool from rusefi_enums.h // by enum2string.jar tool on Thu Dec 03 23:48:52 EST 2020 // see also gen_config_and_enums.bat @@ -1355,6 +1355,8 @@ case TT_FIAT_IAW_P8: return "TT_FIAT_IAW_P8"; case TT_FORD_ASPIRE: return "TT_FORD_ASPIRE"; +case TT_FORD_ST170: + return "TT_FORD_ST170"; case TT_GM_7X: return "TT_GM_7X"; case TT_GM_LS_24: @@ -1421,8 +1423,6 @@ case TT_UNUSED: return "TT_UNUSED"; case TT_UNUSED_30: return "TT_UNUSED_30"; -case TT_UNUSED_42: - return "TT_UNUSED_42"; case TT_VVT_BOSCH_QUICK_START: return "TT_VVT_BOSCH_QUICK_START"; case TT_VVT_JZ: @@ -1494,6 +1494,8 @@ case VVT_BOSCH_QUICK_START: return "VVT_BOSCH_QUICK_START"; case VVT_FIRST_HALF: return "VVT_FIRST_HALF"; +case VVT_FORD_ST170: + return "VVT_FORD_ST170"; case VVT_INACTIVE: return "VVT_INACTIVE"; case VVT_SECOND_HALF: 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 6197089c17..d0e8b0e68f 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 @@ -1,7 +1,7 @@ #include "global.h" #include "rusefi_enums.h" #include "rusefi_hw_enums.h" -// was generated automatically by rusEfi tool from rusefi_hw_enums.h // was generated automatically by rusEfi tool from rusefi_enums.h // by enum2string.jar tool on Fri Dec 04 02:59:12 UTC 2020 +// was generated automatically by rusEfi tool from rusefi_hw_enums.h // was generated automatically by rusEfi tool from rusefi_enums.h // by enum2string.jar tool on Thu Dec 03 23:48:51 EST 2020 // see also gen_config_and_enums.bat @@ -1151,6 +1151,8 @@ case TT_FIAT_IAW_P8: return "TT_FIAT_IAW_P8"; case TT_FORD_ASPIRE: return "TT_FORD_ASPIRE"; +case TT_FORD_ST170: + return "TT_FORD_ST170"; case TT_GM_7X: return "TT_GM_7X"; case TT_GM_LS_24: @@ -1217,8 +1219,6 @@ case TT_UNUSED: return "TT_UNUSED"; case TT_UNUSED_30: return "TT_UNUSED_30"; -case TT_UNUSED_42: - return "TT_UNUSED_42"; case TT_VVT_BOSCH_QUICK_START: return "TT_VVT_BOSCH_QUICK_START"; case TT_VVT_JZ: @@ -1290,6 +1290,8 @@ case VVT_BOSCH_QUICK_START: return "VVT_BOSCH_QUICK_START"; case VVT_FIRST_HALF: return "VVT_FIRST_HALF"; +case VVT_FORD_ST170: + return "VVT_FORD_ST170"; case VVT_INACTIVE: return "VVT_INACTIVE"; case VVT_SECOND_HALF: diff --git a/firmware/controllers/algo/auto_generated_enums.cpp b/firmware/controllers/algo/auto_generated_enums.cpp index fd5a68bb14..892d77d50c 100644 --- a/firmware/controllers/algo/auto_generated_enums.cpp +++ b/firmware/controllers/algo/auto_generated_enums.cpp @@ -1,7 +1,7 @@ #include "global.h" #include "rusefi_enums.h" #include "rusefi_hw_enums.h" -// was generated automatically by rusEfi tool from rusefi_hw_enums.h // was generated automatically by rusEfi tool from rusefi_enums.h // by enum2string.jar tool on Fri Dec 04 02:59:11 UTC 2020 +// was generated automatically by rusEfi tool from rusefi_hw_enums.h // was generated automatically by rusEfi tool from rusefi_enums.h // by enum2string.jar tool on Thu Dec 03 23:48:51 EST 2020 // see also gen_config_and_enums.bat @@ -1297,6 +1297,8 @@ case TT_FIAT_IAW_P8: return "TT_FIAT_IAW_P8"; case TT_FORD_ASPIRE: return "TT_FORD_ASPIRE"; +case TT_FORD_ST170: + return "TT_FORD_ST170"; case TT_GM_7X: return "TT_GM_7X"; case TT_GM_LS_24: @@ -1363,8 +1365,6 @@ case TT_UNUSED: return "TT_UNUSED"; case TT_UNUSED_30: return "TT_UNUSED_30"; -case TT_UNUSED_42: - return "TT_UNUSED_42"; case TT_VVT_BOSCH_QUICK_START: return "TT_VVT_BOSCH_QUICK_START"; case TT_VVT_JZ: @@ -1436,6 +1436,8 @@ case VVT_BOSCH_QUICK_START: return "VVT_BOSCH_QUICK_START"; case VVT_FIRST_HALF: return "VVT_FIRST_HALF"; +case VVT_FORD_ST170: + return "VVT_FORD_ST170"; case VVT_INACTIVE: return "VVT_INACTIVE"; case VVT_SECOND_HALF: diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index 53734d50f8..69deb25e6f 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -93,6 +93,8 @@ trigger_type_e getVvtTriggerType(vvt_mode_e vvtMode) { return TT_ONE; case VVT_4_1: return TT_ONE; + case VVT_FORD_ST170: + return TT_FORD_ST170; default: return TT_ONE; } diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index ad69c7a767..3686332477 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -214,7 +214,6 @@ typedef enum { * @see http://rusefi.com/wiki/index.php?title=Manual:Software:Trigger */ typedef enum { - TT_UNUSED_42 = 42, TT_TOOTHED_WHEEL = TT_TT_TOOTHED_WHEEL, TT_FORD_ASPIRE = TT_TT_FORD_ASPIRE, @@ -338,6 +337,7 @@ typedef enum { // https://rusefi.com/forum/viewtopic.php?f=5&t=1440 TT_FIAT_IAW_P8 = 41, + TT_FORD_ST170 = TT_TT_FORD_ST170, /** * cam sensor of Mazda Miata NB2 - the VVT signal shape @@ -439,6 +439,8 @@ typedef enum { */ VVT_4_1 = 6, + VVT_FORD_ST170 = 7, + Force_4_bytes_size_vvt_mode = ENUM_32_BITS, } vvt_mode_e; diff --git a/firmware/controllers/trigger/decoders/trigger_misc.cpp b/firmware/controllers/trigger/decoders/trigger_misc.cpp index c23a5a3585..16e01007d9 100644 --- a/firmware/controllers/trigger/decoders/trigger_misc.cpp +++ b/firmware/controllers/trigger/decoders/trigger_misc.cpp @@ -25,6 +25,28 @@ void configureFiatIAQ_P8(TriggerWaveform * s) { s->setTriggerSynchronizationGap(3); } +void configureFordST170(TriggerWaveform * s) { + s->initialize(FOUR_STROKE_CAM_SENSOR); + s->isSynchronizationNeeded = true; + int width = 10; + + int total = s->getCycleDuration() / 8; + + s->addEventAngle(1 * total - width, T_PRIMARY, TV_RISE); + s->addEventAngle(1 * total, T_PRIMARY, TV_FALL); + + s->addEventAngle(2 * total - width, T_PRIMARY, TV_RISE); + s->addEventAngle(2 * total, T_PRIMARY, TV_FALL); + + s->addEventAngle(4 * total - width, T_PRIMARY, TV_RISE); + s->addEventAngle(4 * total, T_PRIMARY, TV_FALL); + + s->addEventAngle(6 * total - width, T_PRIMARY, TV_RISE); + s->addEventAngle(6 * total, T_PRIMARY, TV_FALL); + + s->addEventAngle(8 * total - width, T_PRIMARY, TV_RISE); + s->addEventAngle(8 * total, T_PRIMARY, TV_FALL); +} void configureDaihatsu4(TriggerWaveform * s) { s->initialize(FOUR_STROKE_CAM_SENSOR); @@ -35,17 +57,17 @@ void configureDaihatsu4(TriggerWaveform * s) { s->setTriggerSynchronizationGap(0.125); - s->addEvent720(30 - width, T_PRIMARY, TV_RISE); - s->addEvent720(30, T_PRIMARY, TV_FALL); + s->addEventAngle(30 - width, T_PRIMARY, TV_RISE); + s->addEventAngle(30, T_PRIMARY, TV_FALL); - s->addEvent720(s->getCycleDuration() / 3 - width, T_PRIMARY, TV_RISE); - s->addEvent720(s->getCycleDuration() / 3, T_PRIMARY, TV_FALL); + s->addEventAngle(s->getCycleDuration() / 3 - width, T_PRIMARY, TV_RISE); + s->addEventAngle(s->getCycleDuration() / 3, T_PRIMARY, TV_FALL); - s->addEvent720(s->getCycleDuration() / 3 * 2 - width, T_PRIMARY, TV_RISE); - s->addEvent720(s->getCycleDuration() / 3 * 2, T_PRIMARY, TV_FALL); + s->addEventAngle(s->getCycleDuration() / 3 * 2 - width, T_PRIMARY, TV_RISE); + s->addEventAngle(s->getCycleDuration() / 3 * 2, T_PRIMARY, TV_FALL); - s->addEvent720(s->getCycleDuration() - width, T_PRIMARY, TV_RISE); - s->addEvent720(s->getCycleDuration(), T_PRIMARY, TV_FALL); + s->addEventAngle(s->getCycleDuration() - width, T_PRIMARY, TV_RISE); + s->addEventAngle(s->getCycleDuration(), T_PRIMARY, TV_FALL); } diff --git a/firmware/controllers/trigger/decoders/trigger_misc.h b/firmware/controllers/trigger/decoders/trigger_misc.h index 38be33cef4..4a63240dbf 100644 --- a/firmware/controllers/trigger/decoders/trigger_misc.h +++ b/firmware/controllers/trigger/decoders/trigger_misc.h @@ -11,4 +11,5 @@ void configureFiatIAQ_P8(TriggerWaveform * s); void configureDaihatsu4(TriggerWaveform * s); +void configureFordST170(TriggerWaveform * s); diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index 7c556ec39d..5ec2190775 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -476,7 +476,10 @@ void TriggerWaveform::initializeTriggerWaveform(Logging *logger, operation_mode_ initializeMazdaMiataVVtTestShape(this); break; - case TT_UNUSED_42: + case TT_FORD_ST170: + configureFordST170(this); + break; + case TT_VVT_MIATA_NB2: initializeMazdaMiataVVtCamShape(this); break; diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index c2b9021138..e87bc694a8 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -82,6 +82,7 @@ angle_t TriggerCentral::getVVTPosition() { static bool vvtWithRealDecoder(vvt_mode_e vvtMode) { return vvtMode == MIATA_NB2 || vvtMode == VVT_BOSCH_QUICK_START + || vvtMode == VVT_FORD_ST170 || vvtMode == VVT_4_1; }