diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index 6ce349389e..a7cb8c3a3f 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -361,13 +361,17 @@ typedef enum { TT_1_16 = 50, + TT_51 = TT_TT_51, + + TT_52 = TT_TT_52, + // 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 = 51, // this is used if we want to iterate over all trigger types + TT_UNUSED = 53, // this is used if we want to iterate over all trigger types Force_4_bytes_size_trigger_type = ENUM_32_BITS, } trigger_type_e; diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index f4cbd86a4a..4fcc32a4b9 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -664,6 +664,11 @@ void TriggerWaveform::initializeTriggerWaveform(Logging *logger, operation_mode_ initGmLS24(this); break; + case TT_51: + case TT_52: + initializeSubaruOnly7(this); + break; + case TT_SUBARU_SVX: initializeSubaru_SVX(this); break; diff --git a/firmware/controllers/trigger/decoders/trigger_subaru.cpp b/firmware/controllers/trigger/decoders/trigger_subaru.cpp index 2d0daaf8ab..5d662dc510 100644 --- a/firmware/controllers/trigger/decoders/trigger_subaru.cpp +++ b/firmware/controllers/trigger/decoders/trigger_subaru.cpp @@ -46,16 +46,19 @@ void initialize36_2_2_2(TriggerWaveform *s) { s->useOnlyPrimaryForSync = true; } -void initializeSubaru7_6(TriggerWaveform *s) { +static void initializeSubaru7_6(TriggerWaveform *s, bool withCrankWheel) { s->initialize(FOUR_STROKE_CAM_SENSOR); float magic = 333; + s->tdcPosition = 192; + float width = 5; s->addEvent720(25 - width, T_PRIMARY, TV_RISE); s->addEvent720(25, T_PRIMARY, TV_FALL); + if (withCrankWheel) { s->addEvent720(magic - 180 - 87 - width, T_SECONDARY, TV_RISE); s->addEvent720(magic - 180 - 87, T_SECONDARY, TV_FALL); @@ -75,6 +78,7 @@ void initializeSubaru7_6(TriggerWaveform *s) { s->addEvent720(magic - 55, T_SECONDARY, TV_FALL); s->addEvent720(magic - width, T_SECONDARY, TV_RISE); s->addEvent720(magic, T_SECONDARY, TV_FALL); + } s->addEvent720(343 - width, T_PRIMARY, TV_RISE); @@ -86,23 +90,26 @@ void initializeSubaru7_6(TriggerWaveform *s) { s->addEvent720(384 - width, T_PRIMARY, TV_RISE); s->addEvent720(384, T_PRIMARY, TV_FALL); + if (withCrankWheel) { s->addEvent720(magic + 180 - 87 - width, T_SECONDARY, TV_RISE); s->addEvent720(magic + 180 - 87, T_SECONDARY, TV_FALL); s->addEvent720(magic + 180 - 55 - width, T_SECONDARY, TV_RISE); s->addEvent720(magic + 180 - 55, T_SECONDARY, TV_FALL); s->addEvent720(magic + 180 - width, T_SECONDARY, TV_RISE); s->addEvent720(magic + 180, T_SECONDARY, TV_FALL); - + } s->addEvent720(538 - width, T_PRIMARY, TV_RISE); s->addEvent720(538, T_PRIMARY, TV_FALL); + if (withCrankWheel) { s->addEvent720(magic + 360 - 87 - width, T_SECONDARY, TV_RISE); s->addEvent720(magic + 360 - 87, T_SECONDARY, TV_FALL); s->addEvent720(magic + 360 - 55 - width, T_SECONDARY, TV_RISE); s->addEvent720(magic + 360 - 55, T_SECONDARY, TV_FALL); s->addEvent720(magic + 360 - width, T_SECONDARY, TV_RISE); s->addEvent720(magic + 360, T_SECONDARY, TV_FALL); + } s->addEvent720(720 - width, T_PRIMARY, TV_RISE); s->addEvent720(720, T_PRIMARY, TV_FALL); @@ -116,6 +123,14 @@ void initializeSubaru7_6(TriggerWaveform *s) { } +void initializeSubaruOnly7(TriggerWaveform *s) { + initializeSubaru7_6(s, false); +} + +void initializeSubaru7_6(TriggerWaveform *s) { + initializeSubaru7_6(s, true); +} + void initializeSubaru_SVX(TriggerWaveform *s) { int n; /* crank 2 falling happens between crank #1 fallings */ diff --git a/firmware/controllers/trigger/decoders/trigger_subaru.h b/firmware/controllers/trigger/decoders/trigger_subaru.h index 8beaace9ab..c4afe5c14f 100644 --- a/firmware/controllers/trigger/decoders/trigger_subaru.h +++ b/firmware/controllers/trigger/decoders/trigger_subaru.h @@ -11,5 +11,6 @@ void initialize36_2_2_2(TriggerWaveform *s); void initializeSubaru7_6(TriggerWaveform *s); +void initializeSubaruOnly7(TriggerWaveform *s); void initializeSubaru_SVX(TriggerWaveform *s);