From 8a4831b1dcba856968b6d4e89d91f41161d6b4c7 Mon Sep 17 00:00:00 2001 From: Andrey Date: Sun, 8 Aug 2021 07:04:18 -0400 Subject: [PATCH] Nissan 4 cylinder QR trigger wheel #3118 --- .../hellen121nissan/board_configuration.cpp | 4 ---- firmware/config/engines/nissan_vq.cpp | 18 ++++++++++++++++++ .../algo/auto_generated_commonenum.cpp | 8 +++++--- .../controllers/algo/engine_configuration.cpp | 5 ++++- firmware/controllers/algo/rusefi_enums.h | 3 ++- .../tests/trigger/test_nissan_vq_vvt.cpp | 2 +- .../trigger/test_real_cranking_nissan_vq40.cpp | 2 +- 7 files changed, 31 insertions(+), 11 deletions(-) diff --git a/firmware/config/boards/hellen/hellen121nissan/board_configuration.cpp b/firmware/config/boards/hellen/hellen121nissan/board_configuration.cpp index f8d227d5ce..393036d6c8 100644 --- a/firmware/config/boards/hellen/hellen121nissan/board_configuration.cpp +++ b/firmware/config/boards/hellen/hellen121nissan/board_configuration.cpp @@ -166,11 +166,7 @@ void setBoardDefaultConfiguration(void) { // Bosch VQ40 VR56 VK56 0280158007 engineConfiguration->injector.flow = 296.2; - engineConfiguration->specs.cylindersCount = 6; - engineConfiguration->specs.firingOrder = FO_1_2_3_4_5_6; - engineConfiguration->specs.displacement = 4; strcpy(CONFIG(engineMake), ENGINE_MAKE_NISSAN); - strcpy(CONFIG(engineCode), "VQ"); engineConfiguration->ignitionMode = IM_INDIVIDUAL_COILS; // IM_WASTED_SPARK engineConfiguration->crankingInjectionMode = IM_SIMULTANEOUS; diff --git a/firmware/config/engines/nissan_vq.cpp b/firmware/config/engines/nissan_vq.cpp index 1aa8bb43b4..ef0b5bb2a2 100644 --- a/firmware/config/engines/nissan_vq.cpp +++ b/firmware/config/engines/nissan_vq.cpp @@ -8,12 +8,30 @@ #include "nissan_vq.h" void setHellen121nissanQR(DECLARE_CONFIG_PARAMETER_SIGNATURE) { + engineConfiguration->trigger.type = TT_NISSAN_QR25; + + engineConfiguration->specs.cylindersCount = 4; + engineConfiguration->specs.firingOrder = FO_1_3_4_2; + engineConfiguration->specs.displacement = 2; + strcpy(CONFIG(engineCode), "QR"); + + engineConfiguration->vvtMode[0] = VVT_NISSAN_VQ; + + // we have this here and not in board_configuration.cpp so that unit test would get this value + engineConfiguration->invertCamVVTSignal = true; + + engineConfiguration->vvtOffsets[0] = NISSAN_VQ_VVT_OFFSET; } void setHellen121nissanVQ(DECLARE_CONFIG_PARAMETER_SIGNATURE) { engineConfiguration->trigger.type = TT_NISSAN_VQ35; + engineConfiguration->specs.cylindersCount = 6; + engineConfiguration->specs.firingOrder = FO_1_2_3_4_5_6; + engineConfiguration->specs.displacement = 4; + strcpy(CONFIG(engineCode), "VQ"); + engineConfiguration->vvtMode[0] = VVT_NISSAN_VQ; // we have this here and not in board_configuration.cpp so that unit test would get this value diff --git a/firmware/controllers/algo/auto_generated_commonenum.cpp b/firmware/controllers/algo/auto_generated_commonenum.cpp index c8d237bf20..227aea83f5 100644 --- a/firmware/controllers/algo/auto_generated_commonenum.cpp +++ b/firmware/controllers/algo/auto_generated_commonenum.cpp @@ -1,6 +1,6 @@ #include "global.h" #include "rusefi_enums.h" -// was generated automatically by rusEFI tool from rusefi_enums.h // by enum2string.jar tool on Sun Aug 08 04:18:47 EDT 2021 +// was generated automatically by rusEFI tool from rusefi_enums.h // by enum2string.jar tool on Sun Aug 08 06:27:19 EDT 2021 // see also gen_config_and_enums.bat @@ -414,8 +414,10 @@ case GY6_139QMB: return "GY6_139QMB"; case HELLEN72_ETB: return "HELLEN72_ETB"; -case HELLEN_121_NISSAN: - return "HELLEN_121_NISSAN"; +case HELLEN_121_NISSAN_4_CYL: + return "HELLEN_121_NISSAN_4_CYL"; +case HELLEN_121_NISSAN_6_CYL: + return "HELLEN_121_NISSAN_6_CYL"; case HELLEN_121_VAG: return "HELLEN_121_VAG"; case HELLEN_121_VAG_5_CYL: diff --git a/firmware/controllers/algo/engine_configuration.cpp b/firmware/controllers/algo/engine_configuration.cpp index 050a8d849d..29798b88ec 100644 --- a/firmware/controllers/algo/engine_configuration.cpp +++ b/firmware/controllers/algo/engine_configuration.cpp @@ -945,7 +945,10 @@ void resetConfigurationExt(configuration_callback_t boardCallback, engine_type_e case HELLEN72_ETB: setHellen72etb(PASS_CONFIG_PARAMETER_SIGNATURE); break; - case HELLEN_121_NISSAN: + case HELLEN_121_NISSAN_4_CYL: + setHellen121nissanQR(PASS_CONFIG_PARAMETER_SIGNATURE); + break; + case HELLEN_121_NISSAN_6_CYL: setHellen121nissanVQ(PASS_CONFIG_PARAMETER_SIGNATURE); break; case HELLEN_121_VAG_5_CYL: diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index ca2d05591e..48e3e6f3fe 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -194,7 +194,7 @@ typedef enum { SUBARUEG33_DEFAULTS = 70, HELLEN_121_VAG = ET_HELLEN_121_VAG, - HELLEN_121_NISSAN = ET_HELLEN_121_NISSAN, + HELLEN_121_NISSAN_6_CYL = ET_HELLEN_121_NISSAN_6_CYL, HELLEN_55_BMW = ET_HELLEN_55_BMW, HELLEN_88_BMW = ET_HELLEN_88_BMW, HELLEN_134_BMW = ET_HELLEN_134_BMW, @@ -208,6 +208,7 @@ typedef enum { HELLEN_NA94 = ET_HELLEN_NA94, HELLEN_154_HYUNDAI = ET_HELLEN_154_HYUNDAI, + HELLEN_121_NISSAN_4_CYL = ET_HELLEN_121_NISSAN_4_CYL, /** * this configuration has as few pins configured as possible diff --git a/unit_tests/tests/trigger/test_nissan_vq_vvt.cpp b/unit_tests/tests/trigger/test_nissan_vq_vvt.cpp index 5286952def..6cc3776823 100644 --- a/unit_tests/tests/trigger/test_nissan_vq_vvt.cpp +++ b/unit_tests/tests/trigger/test_nissan_vq_vvt.cpp @@ -66,7 +66,7 @@ static void scheduleTriggerEvents(TriggerWaveform *shape, TEST(nissan, vq_vvt) { - WITH_ENGINE_TEST_HELPER (HELLEN_121_NISSAN); + WITH_ENGINE_TEST_HELPER (HELLEN_121_NISSAN_6_CYL); engineConfiguration->isIgnitionEnabled = false; engineConfiguration->isInjectionEnabled = false; diff --git a/unit_tests/tests/trigger/test_real_cranking_nissan_vq40.cpp b/unit_tests/tests/trigger/test_real_cranking_nissan_vq40.cpp index c43ea07bf1..b3b58008d7 100644 --- a/unit_tests/tests/trigger/test_real_cranking_nissan_vq40.cpp +++ b/unit_tests/tests/trigger/test_real_cranking_nissan_vq40.cpp @@ -13,7 +13,7 @@ TEST(realCrankingVQ40, normalCranking) { int indeces[] = {0}; reader.open("tests/trigger/resources/nissan_vq40_cranking-1.csv", indeces); - WITH_ENGINE_TEST_HELPER (HELLEN_121_NISSAN); + WITH_ENGINE_TEST_HELPER (HELLEN_121_NISSAN_6_CYL); bool hasSeenFirstVvt = false;