diff --git a/firmware/config/boards/subaru_eg33/config/controllers/algo/auto_generated_enums.cpp b/firmware/config/boards/subaru_eg33/config/controllers/algo/auto_generated_enums.cpp index 885bf7cf67..d8185ea8b0 100644 --- a/firmware/config/boards/subaru_eg33/config/controllers/algo/auto_generated_enums.cpp +++ b/firmware/config/boards/subaru_eg33/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 Thu Jul 01 17:26:03 EDT 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 Thu Jul 01 19:48:34 EDT 2021 // see also gen_config_and_enums.bat @@ -1474,6 +1474,8 @@ case TT_VVT_JZ: return "TT_VVT_JZ"; case TT_VVT_MIATA_NB2: return "TT_VVT_MIATA_NB2"; +case TT_VVT_NISSAN_VQ: + return "TT_VVT_NISSAN_VQ"; } return NULL; } diff --git a/firmware/controllers/algo/auto_generated_enums.cpp b/firmware/controllers/algo/auto_generated_enums.cpp index 0ce5929ab7..ad0b5a8b73 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 Thu Jul 01 17:26:01 EDT 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 Thu Jul 01 19:48:33 EDT 2021 // see also gen_config_and_enums.bat @@ -1450,6 +1450,8 @@ case TT_VVT_JZ: return "TT_VVT_JZ"; case TT_VVT_MIATA_NB2: return "TT_VVT_MIATA_NB2"; +case TT_VVT_NISSAN_VQ: + return "TT_VVT_NISSAN_VQ"; } return NULL; } diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index 3f8ae9db12..af31d16128 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -396,13 +396,15 @@ typedef enum { TT_NISSAN_VQ = TT_TT_NISSAN_VQ, + TT_VVT_NISSAN_VQ = TT_TT_VVT_NISSAN_VQ, + // do not forget to edit "#define trigger_type_e_enum" line in integration/rusefi_config.txt file to propogate new value to rusefi.ini TS project // do not forget to invoke "gen_config.bat" once you make changes to integration/rusefi_config.txt // todo: one day a hero would integrate some of these things into Makefile in order to reduce manual magic // // Another point: once you add a new trigger, run get_trigger_images.bat which would run rusefi_test.exe from unit_tests // - TT_UNUSED = 59, // this is used if we want to iterate over all trigger types + TT_UNUSED = 60, // this is used if we want to iterate over all trigger types Force_4_bytes_size_trigger_type = ENUM_32_BITS, } trigger_type_e; // TriggerProcessor.java has this "trigger_type_e" name hard-coded! diff --git a/firmware/controllers/trigger/decoders/trigger_nissan.cpp b/firmware/controllers/trigger/decoders/trigger_nissan.cpp index edea639de4..ecfbdfab17 100644 --- a/firmware/controllers/trigger/decoders/trigger_nissan.cpp +++ b/firmware/controllers/trigger/decoders/trigger_nissan.cpp @@ -105,3 +105,33 @@ void initializeNissanSR20VE_4(TriggerWaveform *s) { void initializeNissanSR20VE_4_360(TriggerWaveform *s) { initializeNissanSR20VE_4_optional_360(s, true); } + +static void addPrimaryToothEndingAt(TriggerWaveform *s, float fallAngle) { + int vvtWidth = 20; + + s->addEventAngle(fallAngle - vvtWidth, T_PRIMARY, TV_RISE); + s->addEventAngle(fallAngle, T_PRIMARY, TV_FALL); + +} + +void initializeNissanVQvvt(TriggerWaveform *s) { + s->initialize(FOUR_STROKE_CAM_SENSOR); + + int offset = 720 - 520; + + + + addPrimaryToothEndingAt(s, offset + 40); + + addPrimaryToothEndingAt(s, offset + 160); + addPrimaryToothEndingAt(s, offset + 200); + + + addPrimaryToothEndingAt(s, offset + 280); + + + addPrimaryToothEndingAt(s, offset + 320); + + addPrimaryToothEndingAt(s, offset + 520); + +} diff --git a/firmware/controllers/trigger/decoders/trigger_nissan.h b/firmware/controllers/trigger/decoders/trigger_nissan.h index 1589967393..3abdf6979b 100644 --- a/firmware/controllers/trigger/decoders/trigger_nissan.h +++ b/firmware/controllers/trigger/decoders/trigger_nissan.h @@ -11,3 +11,6 @@ void initializeNissanSR20VE_4(TriggerWaveform *s); void initializeNissanSR20VE_4_360(TriggerWaveform *s); + +void initializeNissanVQvvt(TriggerWaveform *s); +void initializeNissanVQcrank(TriggerWaveform *s); diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index 841febb9af..b07e4c7111 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -545,6 +545,10 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e ambiguousOperat configureFordAspireTriggerWaveform(this); break; + case TT_VVT_NISSAN_VQ: + initializeNissanVQvvt(this); + break; + case TT_TT_NISSAN_VQ: case TT_KAWA_KX450F: configureKawaKX450F(this);