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 bb4549f7e8..52959e2023 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 Mon Feb 08 16:33:36 EST 2021 +// 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 Mon Feb 08 18:09:24 EST 2021 // see also gen_config_and_enums.bat @@ -1512,8 +1512,6 @@ case VE_TPS: } const char *getVvt_mode_e(vvt_mode_e value){ switch(value) { -case MIATA_NB2: - return "MIATA_NB2"; case VVT_2JZ: return "VVT_2JZ"; case VVT_4_1: @@ -1526,6 +1524,8 @@ case VVT_FORD_ST170: return "VVT_FORD_ST170"; case VVT_INACTIVE: return "VVT_INACTIVE"; +case VVT_MIATA_NB2: + return "VVT_MIATA_NB2"; case VVT_SECOND_HALF: return "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 2f597ead8f..2ee8d2af30 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 Mon Feb 08 16:33:35 EST 2021 +// 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 Mon Feb 08 18:09:24 EST 2021 // see also gen_config_and_enums.bat @@ -1308,8 +1308,6 @@ case VE_TPS: } const char *getVvt_mode_e(vvt_mode_e value){ switch(value) { -case MIATA_NB2: - return "MIATA_NB2"; case VVT_2JZ: return "VVT_2JZ"; case VVT_4_1: @@ -1322,6 +1320,8 @@ case VVT_FORD_ST170: return "VVT_FORD_ST170"; case VVT_INACTIVE: return "VVT_INACTIVE"; +case VVT_MIATA_NB2: + return "VVT_MIATA_NB2"; case VVT_SECOND_HALF: return "VVT_SECOND_HALF"; } diff --git a/firmware/config/engines/mazda_miata_vvt.cpp b/firmware/config/engines/mazda_miata_vvt.cpp index 5595b20fed..278f34b00e 100644 --- a/firmware/config/engines/mazda_miata_vvt.cpp +++ b/firmware/config/engines/mazda_miata_vvt.cpp @@ -335,7 +335,7 @@ static void setMazdaMiataEngineNB2Defaults(DECLARE_CONFIG_PARAMETER_SIGNATURE) { engineConfiguration->vvtCamSensorUseRise = true; // set vvt_mode 3 - engineConfiguration->vvtMode = MIATA_NB2; + engineConfiguration->vvtMode = VVT_MIATA_NB2; engineConfiguration->vvtOffset = 98; // 2003 red car value MEMCPY(config->veRpmBins, mazda_miata_nb2_RpmBins); diff --git a/firmware/controllers/algo/auto_generated_enums.cpp b/firmware/controllers/algo/auto_generated_enums.cpp index 12a6a7f276..aea8cc8652 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 Mon Feb 08 16:33:35 EST 2021 +// 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 Mon Feb 08 18:09:24 EST 2021 // see also gen_config_and_enums.bat @@ -1486,8 +1486,6 @@ case VE_TPS: } const char *getVvt_mode_e(vvt_mode_e value){ switch(value) { -case MIATA_NB2: - return "MIATA_NB2"; case VVT_2JZ: return "VVT_2JZ"; case VVT_4_1: @@ -1500,6 +1498,8 @@ case VVT_FORD_ST170: return "VVT_FORD_ST170"; case VVT_INACTIVE: return "VVT_INACTIVE"; +case VVT_MIATA_NB2: + return "VVT_MIATA_NB2"; case VVT_SECOND_HALF: return "VVT_SECOND_HALF"; } diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index d2ffdefab9..64997e1feb 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -86,7 +86,7 @@ trigger_type_e getVvtTriggerType(vvt_mode_e vvtMode) { switch (vvtMode) { case VVT_2JZ: return TT_VVT_JZ; - case MIATA_NB2: + case VVT_MIATA_NB2: return TT_VVT_MIATA_NB2; case VVT_BOSCH_QUICK_START: return TT_VVT_BOSCH_QUICK_START; diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index 468c70e17d..3e0edb3800 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -439,7 +439,7 @@ typedef enum __attribute__ ((__packed__)) { * Mazda NB2 has three cam tooth. We synchronize based on gap ratio. * @see TT_VVT_MIATA_NB2 */ - MIATA_NB2 = 3, + VVT_MIATA_NB2 = 3, /** * Single-tooth cam sensor mode where TDC and cam signal happen in the same 360 degree of 720 degree engine cycle diff --git a/firmware/controllers/engine_cycle/main_trigger_callback.cpp b/firmware/controllers/engine_cycle/main_trigger_callback.cpp index 91c0f1d5f6..1793712b3a 100644 --- a/firmware/controllers/engine_cycle/main_trigger_callback.cpp +++ b/firmware/controllers/engine_cycle/main_trigger_callback.cpp @@ -371,7 +371,7 @@ uint32_t *cyccnt = (uint32_t*) &DWT->CYCCNT; void mainTriggerCallback(uint32_t trgEventIndex, efitick_t edgeTimestamp DECLARE_ENGINE_PARAMETER_SUFFIX) { ScopePerf perf(PE::MainTriggerCallback); - if (CONFIG(vvtMode) == MIATA_NB2 && ENGINE(triggerCentral.vvtSyncTimeNt) == 0) { + if (CONFIG(vvtMode) == VVT_MIATA_NB2 && ENGINE(triggerCentral.vvtSyncTimeNt) == 0) { // this is a bit spaghetti code for sure // do not spark & do not fuel until we have VVT sync. NB2 is a special case // due to symmetrical crank wheel and we need to make sure no spark happens out of sync diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index bf513e324c..390c166092 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -84,7 +84,7 @@ angle_t TriggerCentral::getVVTPosition() { #define miataNbIndex (0) static bool vvtWithRealDecoder(vvt_mode_e vvtMode) { - return vvtMode == MIATA_NB2 + return vvtMode == VVT_MIATA_NB2 || vvtMode == VVT_BOSCH_QUICK_START || vvtMode == VVT_FORD_ST170 || vvtMode == VVT_4_1; @@ -197,7 +197,7 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt, int index DECL return; } break; - case MIATA_NB2: + case VVT_MIATA_NB2: case VVT_BOSCH_QUICK_START: { if (engine->triggerCentral.vvtState[bankIndex].currentCycle.current_index != 0) { @@ -258,7 +258,7 @@ void hwHandleVvtCamSignal(trigger_value_e front, efitick_t nowNt, int index DECL } } break; - case MIATA_NB2: + case VVT_MIATA_NB2: /** * NB2 is a symmetrical crank, there are four phases total */ diff --git a/unit_tests/tests/trigger/test_quad_cam.cpp b/unit_tests/tests/trigger/test_quad_cam.cpp index bc28aa2618..65c135dc02 100644 --- a/unit_tests/tests/trigger/test_quad_cam.cpp +++ b/unit_tests/tests/trigger/test_quad_cam.cpp @@ -13,7 +13,7 @@ TEST(trigger, testQuadCam) { setOperationMode(engineConfiguration, FOUR_STROKE_CRANK_SENSOR); engineConfiguration->useOnlyRisingEdgeForTrigger = true; engineConfiguration->vvtMode = VVT_2JZ; - engineConfiguration->secondVvtMode = MIATA_NB2; + engineConfiguration->secondVvtMode = VVT_MIATA_NB2; eth.setTriggerType(TT_ONE PASS_ENGINE_PARAMETER_SUFFIX); engineConfiguration->camInputs[0] = GPIOA_10; // we just need to indicate that we have CAM