diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index 5525e1267b..57cda5dbbf 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -86,6 +86,8 @@ trigger_type_e getVvtTriggerType(vvt_mode_e vvtMode) { return trigger_type_e::TT_VVT_BARRA_3_PLUS_1; case VVT_MAZDA_SKYACTIV: return trigger_type_e::TT_VVT_MAZDA_SKYACTIV; + case VVT_MAZDA_L: + return trigger_type_e::TT_VVT_MAZDA_L; case VVT_NISSAN_VQ: return trigger_type_e::TT_VVT_NISSAN_VQ35; case VVT_TOYOTA_4_1: diff --git a/firmware/controllers/algo/engine_types.h b/firmware/controllers/algo/engine_types.h index bb2898c503..b3e7c44322 100644 --- a/firmware/controllers/algo/engine_types.h +++ b/firmware/controllers/algo/engine_types.h @@ -489,13 +489,15 @@ enum class trigger_type_e : uint32_t { TT_MITSU_4G9x_CAM = 29, TT_MITSU_4G63_CAM = 34, + TT_VVT_MAZDA_L = 75, + // 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 fome_test.exe from unit_tests // - TT_UNUSED = 75, // this is used if we want to iterate over all trigger types + TT_UNUSED = 76, // this is used if we want to iterate over all trigger types }; typedef enum { diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index 0d14a20ff2..a0b704ebf1 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -99,6 +99,8 @@ typedef enum __attribute__ ((__packed__)) { VVT_MITSUBISHI_4G9x = 17, VVT_MITSUBISHI_4G63 = 18, + VVT_MAZDA_L = 19, + } vvt_mode_e; /** diff --git a/firmware/controllers/trigger/decoders/trigger_mazda.cpp b/firmware/controllers/trigger/decoders/trigger_mazda.cpp index 74b2072630..b9275b0583 100644 --- a/firmware/controllers/trigger/decoders/trigger_mazda.cpp +++ b/firmware/controllers/trigger/decoders/trigger_mazda.cpp @@ -218,3 +218,39 @@ void initializeMazdaSkyactivCam(TriggerWaveform *s) { s->setSecondTriggerSynchronizationGap(0.78); s->setThirdTriggerSynchronizationGap(1.12); // 3rd gap is not required but let's have it for some resiliency } + +void initializeMazdaLCam(TriggerWaveform* s) { + s->initialize(FOUR_STROKE_CAM_SENSOR, SyncEdge::RiseOnly); + + // 6 teeth: + // 0, 60, 90, 150, 180, 270 + // Tooth at 0 is just before #1 TDC + + // 60 + s->addEvent360(50, true, TriggerWheel::T_PRIMARY); + s->addEvent360(60, false, TriggerWheel::T_PRIMARY); + + // 90 + s->addEvent360(80, true, TriggerWheel::T_PRIMARY); + s->addEvent360(90, false, TriggerWheel::T_PRIMARY); + + // 150 + s->addEvent360(140, true, TriggerWheel::T_PRIMARY); + s->addEvent360(150, false, TriggerWheel::T_PRIMARY); + + // 180 + s->addEvent360(170, true, TriggerWheel::T_PRIMARY); + s->addEvent360(180, false, TriggerWheel::T_PRIMARY); + + // 270 + s->addEvent360(260, true, TriggerWheel::T_PRIMARY); + s->addEvent360(270, false, TriggerWheel::T_PRIMARY); + + // 0 (aka 360) + s->addEvent360(350, true, TriggerWheel::T_PRIMARY); + s->addEvent360(360, false, TriggerWheel::T_PRIMARY); + + s->setTriggerSynchronizationGap(0.5); + s->setSecondTriggerSynchronizationGap(2); + s->setThirdTriggerSynchronizationGap(0.5); +} diff --git a/firmware/controllers/trigger/decoders/trigger_mazda.h b/firmware/controllers/trigger/decoders/trigger_mazda.h index 52a9b9e0e0..11faf97993 100644 --- a/firmware/controllers/trigger/decoders/trigger_mazda.h +++ b/firmware/controllers/trigger/decoders/trigger_mazda.h @@ -25,3 +25,5 @@ void configureMazdaProtegeLx(TriggerWaveform *s); void initializeMazdaMiataVVtCamShape(TriggerWaveform *s); void initializeMazdaSkyactivCam(TriggerWaveform *s); + +void initializeMazdaLCam(TriggerWaveform* s); diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index d7c7d6ad18..da5e230ddc 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -609,6 +609,10 @@ void TriggerWaveform::initializeTriggerWaveform(operation_mode_e triggerOperatio initializeMazdaSkyactivCam(this); break; + case trigger_type_e::TT_VVT_MAZDA_L: + initializeMazdaLCam(this); + break; + case trigger_type_e::TT_BENELLI_TRE: configureBenelli(this); break; diff --git a/firmware/integration/rusefi_config.txt b/firmware/integration/rusefi_config.txt index 676398d5cd..0729be4fbe 100644 --- a/firmware/integration/rusefi_config.txt +++ b/firmware/integration/rusefi_config.txt @@ -267,7 +267,7 @@ end_struct #define debug_mode_e_enum "INVALID", "TPS acceleration enrichment", "INVALID", "Stepper Idle Control", "Engine Load accl enrich", "Trigger Counters", "Soft Spark Cut", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "INVALID", "SD card", "sr5", "Knock", "INVALID", "Electronic Throttle", "Executor", "Bench Test / TS commands", "INVALID", "Analog inputs #1", "INSTANT_RPM", "INVALID", "Status", "INVALID", "INVALID", "MAP", "Metrics", "INVALID", "Ion Sense", "TLE8888", "Analog inputs #2", "Dwell Metric", "INVALID", "INVALID", "Boost Control", "INVALID", "INVALID", "ETB Autotune", "Composite Log", "INVALID", "INVALID", "INVALID", "Dyno_View", "Logic_Analyzer", "INVALID", "TCU", "Lua" custom debug_mode_e 1 bits, U08, @OFFSET@, [0:5], @@debug_mode_e_enum@@ -#define vvt_mode_e_enum "Inactive", "Single Tooth", "Toyota 3 Tooth", "Miata NB2", "INVALID", "Bosch Quick Start", "4/1", "ST 170", "Ford Barra 3+1", "Nissan VQ", "Honda K Intake", "Nissan MR18", "Mitsu 3A92", "VTwin by MAP", "Mitsu 6G75", "Mazda Skyactiv", "Honda K Exhaust", "Mitsubishi 4G92/93/94", "Mitsubishi 4G63" +#define vvt_mode_e_enum "Inactive", "Single Tooth", "Toyota 3 Tooth", "Miata NB2", "INVALID", "Bosch Quick Start", "4/1", "ST 170", "Ford Barra 3+1", "Nissan VQ", "Honda K Intake", "Nissan MR18", "Mitsu 3A92", "VTwin by MAP", "Mitsu 6G75", "Mazda Skyactiv", "Honda K Exhaust", "Mitsubishi 4G92/93/94", "Mitsubishi 4G63", "Mazda L" custom vvt_mode_e 1 bits, U08, @OFFSET@, [0:5], @@vvt_mode_e_enum@@ ! At the moment TIM1, TIM2, TIM3 and TIM9 are configured as ICU @@ -532,7 +532,7 @@ adc_channel_e fuelLevelSensor;This is the processor pin that your fuel level sen struct trigger_config_s -#define trigger_type_e_enum "custom toothed wheel", "Ford Aspire", "Dodge Neon 1995", "Miata NA", "Mitsubishi Mess 4", "GM_7X", "Cooper R50", "Mazda SOHC 4", "60/2", "36/1", "Mercedes Two Segment", "Mitsubishi 4G93 11", "EZ30", "INVALID", "Dodge Neon 2003", "Mazda DOHC 1+4", "1+1", "INVALID", "Single Tooth", "Dodge Ram 1+16", "60/2 VW", "Benelli Tre", "Dodge Stratus", "36_2_2_2", "Nissan Primera", "dev 2JZ 3/34 simulator", "Rover K", "GM 24x 5 degree", "Honda CBR 600", "Mitsubishi 4G92/93/94 Cam 29", "Honda CBR 600 custom", "3/1 skipped", "Dodge Neon 2003 crank", "Miata NB", "Mitsubishi 4G63 Cam 34", "INVALID", "Subaru 7+6", "Jeep 18-2-2-2", "12 tooth crank", "Dodge Neon 1995 crank only", "Jeep XJ 4 cyl", "FiatIAQ_P8", "Mazda Z5", "INVALID", "Renix 44-2-2", "Renix 66-2-2-2", "Honda K 12+1", "INVALID", "36/2", "Subaru SVX", "1+16", "Subaru 7 without 6", "INVALID", "TriTach", "GM 60/2/2/2", "Skoda Favorit", "Barra 3+1 Cam", "Kawa KX450F", "Nissan VQ35", "INVALID", "Nissan VQ30", "Nissan QR25", "Mitsubishi 3A92", "Subaru SVX Crank 1", "Subaru SVX Cam VVT", "Ford PIP", "Suzuki G13B", "Honda K 4+1", "Nissan MR18 Crank", "32/2", "36-2-1", "36-2-1-1", "INVALID", "INVALID", "GM 24x 3 degree", "trg75" +#define trigger_type_e_enum "custom toothed wheel", "Ford Aspire", "Dodge Neon 1995", "Miata NA", "Mitsubishi Mess 4", "GM_7X", "Cooper R50", "Mazda SOHC 4", "60/2", "36/1", "Mercedes Two Segment", "Mitsubishi 4G93 11", "EZ30", "INVALID", "Dodge Neon 2003", "Mazda DOHC 1+4", "1+1", "INVALID", "Single Tooth", "Dodge Ram 1+16", "60/2 VW", "Benelli Tre", "Dodge Stratus", "36_2_2_2", "Nissan Primera", "dev 2JZ 3/34 simulator", "Rover K", "GM 24x 5 degree", "Honda CBR 600", "Mitsubishi 4G92/93/94 Cam 29", "Honda CBR 600 custom", "3/1 skipped", "Dodge Neon 2003 crank", "Miata NB", "Mitsubishi 4G63 Cam 34", "INVALID", "Subaru 7+6", "Jeep 18-2-2-2", "12 tooth crank", "Dodge Neon 1995 crank only", "Jeep XJ 4 cyl", "FiatIAQ_P8", "Mazda Z5", "INVALID", "Renix 44-2-2", "Renix 66-2-2-2", "Honda K 12+1", "INVALID", "36/2", "Subaru SVX", "1+16", "Subaru 7 without 6", "INVALID", "TriTach", "GM 60/2/2/2", "Skoda Favorit", "Barra 3+1 Cam", "Kawa KX450F", "Nissan VQ35", "INVALID", "Nissan VQ30", "Nissan QR25", "Mitsubishi 3A92", "Subaru SVX Crank 1", "Subaru SVX Cam VVT", "Ford PIP", "Suzuki G13B", "Honda K 4+1", "Nissan MR18 Crank", "32/2", "36-2-1", "36-2-1-1", "INVALID", "INVALID", "GM 24x 3 degree", "INVALID", "trg76" custom trigger_type_e 4 bits, U32, @OFFSET@, [0:6], @@trigger_type_e_enum@@ trigger_type_e type;https://github.com/rusefi/rusefi/wiki/All-Supported-Triggers diff --git a/unit_tests/triggers.txt b/unit_tests/triggers.txt index feb24cfc4c..99360123e0 100644 --- a/unit_tests/triggers.txt +++ b/unit_tests/triggers.txt @@ -5261,3 +5261,30 @@ event 92 0 1 690.00 nan event 93 0 0 693.00 nan event 94 0 1 696.00 nan event 95 0 0 708.00 nan +TRIGGERTYPE 75 12 TT_VVT_MAZDA_L 0.00 +knownOperationMode=true +crankBased=false +hasSecondChannel=false +isSecondWheelCam=false +cycleDuration=720 +gapsCount=3 +isSynchronizationNeeded=1 +gapFrom.0=0.375000 +gapTo.0=0.625000 +gapFrom.1=1.500000 +gapTo.1=2.500000 +gapFrom.2=0.375000 +gapTo.2=0.625000 +# end of meta section +event 0 0 1 0.00 0.500000 +event 1 0 0 0.00 nan +event 2 0 1 180.00 3.000000 +event 3 0 0 180.00 nan +event 4 0 1 360.00 1.000000 +event 5 0 0 360.00 nan +event 6 0 1 480.00 0.666667 +event 7 0 0 480.00 nan +event 8 0 1 540.00 0.500000 +event 9 0 0 540.00 nan +event 10 0 1 660.00 2.000000 +event 11 0 0 660.00 nan