From 2a05a315503611ae66a4f3a79f51df559f29425d Mon Sep 17 00:00:00 2001 From: rusefillc Date: Sun, 11 Sep 2022 03:46:50 -0400 Subject: [PATCH] refactoring: type safety --- .../algo/auto_generated_commonenum.cpp | 6 +- .../algo/auto_generated_commonenum.h | 2 +- firmware/controllers/algo/engine.cpp | 4 +- firmware/controllers/algo/rusefi_enums.h | 4 +- .../trigger/decoders/trigger_chrysler.cpp | 644 +++++++++--------- .../trigger/decoders/trigger_gm.cpp | 40 +- .../trigger/decoders/trigger_honda.cpp | 56 +- .../trigger/decoders/trigger_mazda.cpp | 134 ++-- .../trigger/decoders/trigger_mercedes.cpp | 12 +- .../trigger/decoders/trigger_misc.cpp | 78 +-- .../trigger/decoders/trigger_mitsubishi.cpp | 70 +- .../trigger/decoders/trigger_nissan.cpp | 32 +- .../trigger/decoders/trigger_renix.cpp | 8 +- .../trigger/decoders/trigger_rover.cpp | 20 +- .../trigger/decoders/trigger_structure.cpp | 28 +- .../trigger/decoders/trigger_structure.h | 14 +- .../trigger/decoders/trigger_subaru.cpp | 42 +- .../trigger/decoders/trigger_suzuki.cpp | 20 +- .../trigger/decoders/trigger_toyota.cpp | 64 +- .../trigger/decoders/trigger_universal.cpp | 44 +- .../trigger/decoders/trigger_universal.h | 2 +- .../trigger/decoders/trigger_vw.cpp | 18 +- .../controllers/trigger/trigger_central.cpp | 15 +- .../controllers/trigger/trigger_decoder.cpp | 20 +- .../ignition_injection/test_fuel_map.cpp | 20 +- .../trigger/test_real_cranking_miata_na6.cpp | 188 ++--- 26 files changed, 792 insertions(+), 793 deletions(-) diff --git a/firmware/controllers/algo/auto_generated_commonenum.cpp b/firmware/controllers/algo/auto_generated_commonenum.cpp index 3e94b6ee54..16939398ee 100644 --- a/firmware/controllers/algo/auto_generated_commonenum.cpp +++ b/firmware/controllers/algo/auto_generated_commonenum.cpp @@ -657,11 +657,11 @@ case TL_SEMI_AUTO: } -const char *getTrigger_wheel_e(trigger_wheel_e value){ +const char *getTrigger_wheel_e(TriggerWheel value){ switch(value) { -case T_PRIMARY: +case TriggerWheel::T_PRIMARY: return "T_PRIMARY"; -case T_SECONDARY: +case TriggerWheel::T_SECONDARY: return "T_SECONDARY"; } return NULL; diff --git a/firmware/controllers/algo/auto_generated_commonenum.h b/firmware/controllers/algo/auto_generated_commonenum.h index 0c80075bed..543c756b34 100644 --- a/firmware/controllers/algo/auto_generated_commonenum.h +++ b/firmware/controllers/algo/auto_generated_commonenum.h @@ -59,7 +59,7 @@ const char *getTChargeMode_e(tChargeMode_e value); const char *getTiming_mode_e(timing_mode_e value); const char *getTle8888_mode_e(tle8888_mode_e value); -const char *getTrigger_wheel_e(trigger_wheel_e value); +const char *getTrigger_wheel_e(TriggerWheel value); const char *getUart_device_e(uart_device_e value); const char *getVe_override_e(ve_override_e value); const char *getVvt_mode_e(vvt_mode_e value); diff --git a/firmware/controllers/algo/engine.cpp b/firmware/controllers/algo/engine.cpp index f78e434830..055635d991 100644 --- a/firmware/controllers/algo/engine.cpp +++ b/firmware/controllers/algo/engine.cpp @@ -415,8 +415,8 @@ void Engine::OnTriggerSyncronization(bool wasSynchronized, bool isDecodingError) if (engineConfiguration->verboseTriggerSynchDetails || (triggerCentral.triggerState.someSortOfTriggerError() && !engineConfiguration->silentTriggerError)) { efiPrintf("error: synchronizationPoint @ index %d expected %d/%d got %d/%d", triggerCentral.triggerState.currentCycle.current_index, - TRIGGER_WAVEFORM(getExpectedEventCount(0)), - TRIGGER_WAVEFORM(getExpectedEventCount(1)), + TRIGGER_WAVEFORM(getExpectedEventCount(TriggerWheel::T_PRIMARY)), + TRIGGER_WAVEFORM(getExpectedEventCount(TriggerWheel::T_SECONDARY)), triggerCentral.triggerState.currentCycle.eventCount[0], triggerCentral.triggerState.currentCycle.eventCount[1]); } diff --git a/firmware/controllers/algo/rusefi_enums.h b/firmware/controllers/algo/rusefi_enums.h index dec6bcfd8d..4f05d9433b 100644 --- a/firmware/controllers/algo/rusefi_enums.h +++ b/firmware/controllers/algo/rusefi_enums.h @@ -38,10 +38,10 @@ typedef enum __attribute__ ((__packed__)) // see also PWM_PHASE_MAX_WAVE_PER_PWM // todo: better names? -typedef enum { +enum class TriggerWheel : uint8_t { T_PRIMARY = 0, T_SECONDARY = 1, -} trigger_wheel_e; +}; typedef enum __attribute__ ((__packed__)) { /** diff --git a/firmware/controllers/trigger/decoders/trigger_chrysler.cpp b/firmware/controllers/trigger/decoders/trigger_chrysler.cpp index 7afc974a61..d10aa8d9ca 100644 --- a/firmware/controllers/trigger/decoders/trigger_chrysler.cpp +++ b/firmware/controllers/trigger/decoders/trigger_chrysler.cpp @@ -17,13 +17,13 @@ void initDodgeRam(TriggerWaveform *s) { s->isSynchronizationNeeded = false; - addSkippedToothTriggerEvents(T_SECONDARY, s, 8, 0, 0.06, -25, 360, 0, 720); + addSkippedToothTriggerEvents(TriggerWheel::T_SECONDARY, s, 8, 0, 0.06, -25, 360, 0, 720); - s->addEvent720(360, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(360, TriggerWheel::T_PRIMARY, TriggerValue::RISE); - addSkippedToothTriggerEvents(T_SECONDARY, s, 8, 0, 0.06, 360 - 25, 360, 0, 720); + addSkippedToothTriggerEvents(TriggerWheel::T_SECONDARY, s, 8, 0, 0.06, 360 - 25, 360, 0, 720); - s->addEvent720(720, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(720, TriggerWheel::T_PRIMARY, TriggerValue::FALL); } void configureNeon2003TriggerWaveformCrank(TriggerWaveform *s) { @@ -32,71 +32,71 @@ void configureNeon2003TriggerWaveformCrank(TriggerWaveform *s) { s->setTriggerSynchronizationGap(3); - s->addEvent360(25, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(30, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(35, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(40, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(45, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(50, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(55, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(60, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(65, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(70, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(75, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(80, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(85, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(90, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(95, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(100, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(105, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(110, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(115, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(120, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(125, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(130, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(135, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(140, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(145,T_PRIMARY, TriggerValue::FALL); - s->addEvent360(150, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(155, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(160, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(165, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(170, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(175, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(180, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(185, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(25, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(30, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(35, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(40, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(45, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(50, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(55, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(60, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(65, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(70, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(75, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(80, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(85, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(90, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(95, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(100, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(105, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(110, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(115, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(120, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(125, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(130, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(135, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(140, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(145,TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(150, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(155, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(160, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(165, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(170, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(175, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(180, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(185, TriggerWheel::T_PRIMARY, TriggerValue::FALL); // gap 25 - s->addEvent360(210, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(215, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(220, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(225, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(230, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(235, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(240, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(245, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(250, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(255, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(260, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(265, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(270, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(275, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(280, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(285, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(290, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(295, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(300, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(305, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(310, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(315, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(320, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(325, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(330, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(335, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(340, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(345, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(350, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(355, T_PRIMARY, TriggerValue::FALL); - s->addEvent360(360, T_PRIMARY, TriggerValue::RISE); + s->addEvent360(210, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(215, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(220, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(225, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(230, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(235, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(240, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(245, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(250, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(255, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(260, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(265, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(270, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(275, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(280, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(285, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(290, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(295, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(300, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(305, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(310, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(315, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(320, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(325, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(330, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(335, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(340, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(345, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(350, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(355, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent360(360, TriggerWheel::T_PRIMARY, TriggerValue::RISE); } void configureNeon2003TriggerWaveformCam(TriggerWaveform *s) { @@ -129,23 +129,23 @@ gap=1.43/0.71 s->useOnlyPrimaryForSync = true; if (useOnlyPrimary) { - s->addEvent720(144, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(180, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(144, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(180, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent720(216, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(252, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(216, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(252, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent720(288, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(324, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(288, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(324, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent720(360, T_PRIMARY, TriggerValue::RISE); // width = 144 - s->addEvent720(504, T_PRIMARY, TriggerValue::FALL); // width = 36 - s->addEvent720(540, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(576, T_PRIMARY, TriggerValue::FALL); - s->addEvent720(612, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(648, T_PRIMARY, TriggerValue::FALL); - s->addEvent720(684, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(720, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(360, TriggerWheel::T_PRIMARY, TriggerValue::RISE); // width = 144 + s->addEvent720(504, TriggerWheel::T_PRIMARY, TriggerValue::FALL); // width = 36 + s->addEvent720(540, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(576, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent720(612, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(648, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent720(684, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(720, TriggerWheel::T_PRIMARY, TriggerValue::FALL); } else { /** @@ -154,171 +154,171 @@ gap=1.43/0.71 * */ - s->addEvent720(25, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(30, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(35, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(40, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(45, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(50, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(55, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(60, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(65, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(70, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(75, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(80, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(85, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(90, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(95, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(100, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(105, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(110, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(115, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(120, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(125, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(130, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(135, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(140, T_SECONDARY, TriggerValue::RISE); + s->addEvent720(25, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(30, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(35, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(40, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(45, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(50, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(55, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(60, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(65, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(70, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(75, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(80, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(85, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(90, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(95, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(100, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(105, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(110, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(115, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(120, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(125, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(130, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(135, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(140, TriggerWheel::T_SECONDARY, TriggerValue::RISE); - s->addEvent720(144, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(144, TriggerWheel::T_PRIMARY, TriggerValue::RISE); - s->addEvent720(145,T_SECONDARY, TriggerValue::FALL); - s->addEvent720(150, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(155, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(160, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(165, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(170, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(175, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(180 - EPS_ANGLE, T_SECONDARY, TriggerValue::RISE); + s->addEvent720(145,TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(150, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(155, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(160, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(165, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(170, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(175, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(180 - EPS_ANGLE, TriggerWheel::T_SECONDARY, TriggerValue::RISE); - s->addEvent720(180, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(180, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent720(185, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(210, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(215, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(185, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(210, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(215, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(216, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(216, TriggerWheel::T_PRIMARY, TriggerValue::RISE); - s->addEvent720(220, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(225, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(230, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(235, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(240, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(245, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(250, T_SECONDARY, TriggerValue::RISE); + s->addEvent720(220, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(225, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(230, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(235, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(240, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(245, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(250, TriggerWheel::T_SECONDARY, TriggerValue::RISE); - s->addEvent720(252, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(252, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent720(255, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(255, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(260, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(265, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(270, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(275, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(280, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(285, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(260, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(265, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(270, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(275, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(280, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(285, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(288, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(288, TriggerWheel::T_PRIMARY, TriggerValue::RISE); - s->addEvent720(290, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(295, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(300, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(305, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(310, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(315, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(320, T_SECONDARY, TriggerValue::RISE); + s->addEvent720(290, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(295, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(300, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(305, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(310, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(315, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(320, TriggerWheel::T_SECONDARY, TriggerValue::RISE); - s->addEvent720(324, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(324, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent720(325, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(330, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(335, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(340, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(345, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(350, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(355, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(360 - EPS_ANGLE, T_SECONDARY, TriggerValue::RISE); + s->addEvent720(325, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(330, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(335, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(340, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(345, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(350, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(355, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(360 - EPS_ANGLE, TriggerWheel::T_SECONDARY, TriggerValue::RISE); - s->addEvent720(360, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(360, TriggerWheel::T_PRIMARY, TriggerValue::RISE); - s->addEvent720(385, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(390, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(395, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(400, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(405, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(410, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(415, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(420, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(425, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(430, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(435, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(440, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(445, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(450, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(455, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(460, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(465, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(470, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(475, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(480, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(485, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(490, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(495, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(500, T_SECONDARY, TriggerValue::RISE); + s->addEvent720(385, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(390, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(395, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(400, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(405, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(410, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(415, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(420, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(425, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(430, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(435, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(440, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(445, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(450, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(455, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(460, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(465, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(470, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(475, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(480, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(485, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(490, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(495, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(500, TriggerWheel::T_SECONDARY, TriggerValue::RISE); - s->addEvent720(504, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(504, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent720(505, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(510, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(515, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(520, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(525, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(530, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(535, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(540 - EPS_ANGLE, T_SECONDARY, TriggerValue::RISE); + s->addEvent720(505, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(510, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(515, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(520, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(525, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(530, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(535, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(540 - EPS_ANGLE, TriggerWheel::T_SECONDARY, TriggerValue::RISE); - s->addEvent720(540, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(540, TriggerWheel::T_PRIMARY, TriggerValue::RISE); - s->addEvent720(545, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(570, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(575, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(545, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(570, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(575, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(576, T_PRIMARY, TriggerValue::FALL); - s->addEvent720(580, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(585, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(590, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(595, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(600, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(605, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(610, T_SECONDARY, TriggerValue::RISE); + s->addEvent720(576, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent720(580, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(585, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(590, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(595, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(600, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(605, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(610, TriggerWheel::T_SECONDARY, TriggerValue::RISE); - s->addEvent720(612, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(615, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(620, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(625, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(630, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(635, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(640, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(645, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(612, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(615, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(620, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(625, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(630, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(635, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(640, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(645, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(648, T_PRIMARY, TriggerValue::FALL); - s->addEvent720(650, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(655, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(660, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(665, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(670, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(675, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(680, T_SECONDARY, TriggerValue::RISE); + s->addEvent720(648, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent720(650, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(655, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(660, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(665, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(670, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(675, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(680, TriggerWheel::T_SECONDARY, TriggerValue::RISE); - s->addEvent720(684, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(685, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(690, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(695, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(700, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(705, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(710, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(715, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(720 - EPS_ANGLE, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(720, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(684, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(685, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(690, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(695, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(700, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(705, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(710, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(715, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(720 - EPS_ANGLE, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(720, TriggerWheel::T_PRIMARY, TriggerValue::FALL); } } @@ -334,60 +334,60 @@ void configureDodgeStratusTriggerWaveform(TriggerWaveform *s) { float base = 0; // 2 teeth float angle = base + 120.0 - w; - s->addEvent720(angle, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(angle + w, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(angle, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(angle + w, TriggerWheel::T_PRIMARY, TriggerValue::FALL); angle += g; - s->addEvent720(angle, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(angle + w, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(angle, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(angle + w, TriggerWheel::T_PRIMARY, TriggerValue::FALL); base += 120; // 3 teeth angle = base + 120.0 - w; - s->addEvent720(angle, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(angle + w, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(angle, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(angle + w, TriggerWheel::T_PRIMARY, TriggerValue::FALL); angle += g; - s->addEvent720(angle, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(angle + w, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(angle, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(angle + w, TriggerWheel::T_PRIMARY, TriggerValue::FALL); angle += g; - s->addEvent720(angle, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(angle + w, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(angle, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(angle + w, TriggerWheel::T_PRIMARY, TriggerValue::FALL); base += 120; // 2 teeth angle = base + 120.0 - w; - s->addEvent720(angle, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(angle + w, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(angle, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(angle + w, TriggerWheel::T_PRIMARY, TriggerValue::FALL); angle += g; - s->addEvent720(angle, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(angle + w, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(angle, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(angle + w, TriggerWheel::T_PRIMARY, TriggerValue::FALL); base += 120; // just one angle = base + 120.0 - w; - s->addEvent720(angle, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(angle + w, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(angle, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(angle + w, TriggerWheel::T_PRIMARY, TriggerValue::FALL); base += 120; // 3 teeth angle = base + 120.0 - w; - s->addEvent720(angle, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(angle + w, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(angle, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(angle + w, TriggerWheel::T_PRIMARY, TriggerValue::FALL); angle += g; - s->addEvent720(angle, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(angle + w, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(angle, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(angle + w, TriggerWheel::T_PRIMARY, TriggerValue::FALL); angle += g; - s->addEvent720(angle, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(angle + w, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(angle, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(angle + w, TriggerWheel::T_PRIMARY, TriggerValue::FALL); base += 120; // just one again angle = base + 120.0 - w; - s->addEvent720(angle, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(angle + w, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(angle, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(angle + w, TriggerWheel::T_PRIMARY, TriggerValue::FALL); } static void configureNeon1995TriggerWaveformCommon(bool withCam, TriggerWaveform *s) { - trigger_wheel_e crank = withCam ? T_SECONDARY : T_PRIMARY; + TriggerWheel crank = withCam ? TriggerWheel::T_SECONDARY : TriggerWheel::T_PRIMARY; // voodoo magic - we always need 720 at the end int base = withCam ? 720 - 560 : 360 - 135; @@ -404,7 +404,7 @@ static void configureNeon1995TriggerWaveformCommon(bool withCam, TriggerWaveform s->addEvent720(m * (base - 44), crank, TriggerValue::FALL); if (withCam) { - s->addEvent720(base + 0, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(base + 0, TriggerWheel::T_PRIMARY, TriggerValue::FALL); } s->addEvent720(m * (base + 20), crank, TriggerValue::RISE); s->addEvent720(m * (base + 60), crank, TriggerValue::FALL); @@ -416,7 +416,7 @@ static void configureNeon1995TriggerWaveformCommon(bool withCam, TriggerWaveform s->addEvent720(m * (base + 135), crank, TriggerValue::FALL); if (withCam) { - s->addEvent720(base + 200, T_PRIMARY, TriggerValue::RISE); // width = 150 + s->addEvent720(base + 200, TriggerWheel::T_PRIMARY, TriggerValue::RISE); // width = 150 s->addEvent720(base + 236, crank, TriggerValue::RISE); s->addEvent720(base + 239, crank, TriggerValue::FALL); @@ -430,7 +430,7 @@ static void configureNeon1995TriggerWaveformCommon(bool withCam, TriggerWaveform s->addEvent720(base + 374, crank, TriggerValue::RISE); // if (withCam) - s->addEvent720(base + 395, T_PRIMARY, TriggerValue::FALL); // width = + s->addEvent720(base + 395, TriggerWheel::T_PRIMARY, TriggerValue::FALL); // width = s->addEvent720(base + 418, crank, TriggerValue::FALL); s->addEvent720(base + 436, crank, TriggerValue::RISE); @@ -441,7 +441,7 @@ static void configureNeon1995TriggerWaveformCommon(bool withCam, TriggerWaveform s->addEvent720(base + 497, crank, TriggerValue::FALL); // if (withCam) - s->addEvent720(base + 560, T_PRIMARY, TriggerValue::RISE); // width = + s->addEvent720(base + 560, TriggerWheel::T_PRIMARY, TriggerValue::RISE); // width = } } @@ -464,7 +464,7 @@ void configureNeon1995TriggerWaveform(TriggerWaveform *s) { s->useRiseEdge = false; - s->initialState[T_PRIMARY] = TriggerValue::RISE; + s->initialState[(int)TriggerWheel::T_PRIMARY] = TriggerValue::RISE; configureNeon1995TriggerWaveformCommon(true, s); @@ -478,79 +478,79 @@ void initJeep18_2_2_2(TriggerWaveform *s) { float off = 212; - s->addEvent720(534 - 720 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(536 - 720 + off, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(554 - 720 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(556 - 720 + off, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(574 - 720 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(576 - 720 + off, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(594 - 720 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(596 - 720 + off, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(534 - 720 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(536 - 720 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(554 - 720 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(556 - 720 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(574 - 720 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(576 - 720 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(594 - 720 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(596 - 720 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(654 - 720 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(656 - 720 + off, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(674 - 720 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(676 - 720 + off, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(694 - 720 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(696 - 720 + off, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(714 - 720 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(716 - 720 + off, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(654 - 720 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(656 - 720 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(674 - 720 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(676 - 720 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(694 - 720 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(696 - 720 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(714 - 720 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(716 - 720 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(54 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(56 + off, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(74 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(76 + off, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(94 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(96 + off, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(114 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(116 + off, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(54 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(56 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(74 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(76 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(94 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(96 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(114 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(116 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(148 + off, T_PRIMARY, TriggerValue::RISE); // 360 + s->addEvent720(148 + off, TriggerWheel::T_PRIMARY, TriggerValue::RISE); // 360 - s->addEvent720(174 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(176 + off, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(194 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(196 + off, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(214 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(216 + off, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(234 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(236 + off, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(174 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(176 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(194 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(196 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(214 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(216 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(234 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(236 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(294 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(296 + off, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(314 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(316 + off, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(334 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(336 + off, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(354 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(356 + off, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(294 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(296 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(314 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(316 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(334 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(336 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(354 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(356 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(414 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(416 + off, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(434 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(436 + off, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(454 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(456 + off, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(474 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(476 + off, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(414 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(416 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(434 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(436 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(454 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(456 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(474 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(476 + off, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(508 + off, T_PRIMARY, TriggerValue::FALL); // 720 + s->addEvent720(508 + off, TriggerWheel::T_PRIMARY, TriggerValue::FALL); // 720 } static void add4cylblock(int off, TriggerWaveform *s) { - s->addEvent720(114 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(114 + off + 2, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(114 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(114 + off + 2, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(134 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(134 + off + 2, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(134 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(134 + off + 2, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(154 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(154 + off + 2, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(154 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(154 + off + 2, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(174 + off, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(174 + off + 2, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(174 + off, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(174 + off + 2, TriggerWheel::T_SECONDARY, TriggerValue::FALL); } // TT_JEEP_4_CYL @@ -564,12 +564,12 @@ void initJeep_XJ_4cyl_2500(TriggerWaveform *s) { add4cylblock(offset - 180, s); add4cylblock(offset, s); - s->addEvent720(236 + offset, T_PRIMARY, TriggerValue::RISE); // 360 + s->addEvent720(236 + offset, TriggerWheel::T_PRIMARY, TriggerValue::RISE); // 360 add4cylblock(offset + 180, s); add4cylblock(offset + 360, s); - s->addEvent720(596 + offset, T_PRIMARY, TriggerValue::FALL); // 720 + s->addEvent720(596 + offset, TriggerWheel::T_PRIMARY, TriggerValue::FALL); // 720 } @@ -588,24 +588,24 @@ void configureChryslerNGC_36_2_2(TriggerWaveform *s) { float base = 0; for (int i = 0; i < 14; i++) { - s->addEventAngle(base + narrow / 2, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(base + narrow, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(base + narrow / 2, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(base + narrow, TriggerWheel::T_PRIMARY, TriggerValue::FALL); base += narrow; } - s->addEventAngle(base + narrow / 2, T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(base + narrow / 2, TriggerWheel::T_PRIMARY, TriggerValue::RISE); base += narrow / 2; - s->addEventAngle(base + wide, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(base + wide, TriggerWheel::T_PRIMARY, TriggerValue::FALL); base += wide; for (int i = 0; i < 16; i++) { - s->addEventAngle(base + narrow / 2, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(base + narrow, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(base + narrow / 2, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(base + narrow, TriggerWheel::T_PRIMARY, TriggerValue::FALL); base += narrow; } // one small tooth at the end of the engine cycle - s->addEventAngle(s->getCycleDuration() - narrow / 2, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(s->getCycleDuration(), T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(s->getCycleDuration() - narrow / 2, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(s->getCycleDuration(), TriggerWheel::T_PRIMARY, TriggerValue::FALL); s->useOnlyPrimaryForSync = true; } diff --git a/firmware/controllers/trigger/decoders/trigger_gm.cpp b/firmware/controllers/trigger/decoders/trigger_gm.cpp index 73a7563667..fd645f6d39 100644 --- a/firmware/controllers/trigger/decoders/trigger_gm.cpp +++ b/firmware/controllers/trigger/decoders/trigger_gm.cpp @@ -10,9 +10,9 @@ #include "trigger_gm.h" static float addTooth(float offset, TriggerWaveform *s) { - s->addEventAngle(offset, T_SECONDARY, TriggerValue::RISE); + s->addEventAngle(offset, TriggerWheel::T_SECONDARY, TriggerValue::RISE); offset += CRANK_MODE_MULTIPLIER * 3; - s->addEventAngle(offset, T_SECONDARY, TriggerValue::FALL); + s->addEventAngle(offset, TriggerWheel::T_SECONDARY, TriggerValue::FALL); offset += CRANK_MODE_MULTIPLIER * 3; return offset; } @@ -52,11 +52,11 @@ void configureGm60_2_2_2(TriggerWaveform *s) { } - s->addEventAngle(m * (360 - 6), T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(m * (360 - 6), TriggerWheel::T_PRIMARY, TriggerValue::RISE); offset = addTooth(offset, s); - s->addEventAngle(m * (360), T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(m * (360), TriggerWheel::T_PRIMARY, TriggerValue::FALL); } @@ -65,26 +65,26 @@ void configureGmTriggerWaveform(TriggerWaveform *s) { float w = 5; - s->addEvent360(60 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(60, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(60 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(60, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(120 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(120.0, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(120 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(120.0, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(180 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(180, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(180 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(180, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(240 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(240.0, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(240 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(240.0, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(300 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(300.0, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(300 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(300.0, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(350 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(350.0, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(350 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(350.0, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(360 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(360.0, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(360 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(360.0, TriggerWheel::T_PRIMARY, TriggerValue::FALL); s->setTriggerSynchronizationGap(6); } @@ -94,8 +94,8 @@ static int gm_tooth_pair(float startAngle, bool isShortLong, TriggerWaveform* s, int window = (isShortLong ? shortToothWidth : (15 - shortToothWidth)) * mult; int end = startAngle + mult * 15; - s->addEvent720(startAngle + window, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(end, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(startAngle + window, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(end, TriggerWheel::T_PRIMARY, TriggerValue::FALL); return end; } diff --git a/firmware/controllers/trigger/decoders/trigger_honda.cpp b/firmware/controllers/trigger/decoders/trigger_honda.cpp index 01bbf4d748..7049b7a8a6 100644 --- a/firmware/controllers/trigger/decoders/trigger_honda.cpp +++ b/firmware/controllers/trigger/decoders/trigger_honda.cpp @@ -19,36 +19,36 @@ void configureHondaCbr600(TriggerWaveform *s) { int totalTeethCount = 24; int skippedCount = 0; - addSkippedToothTriggerEvents(T_SECONDARY, s, totalTeethCount, skippedCount, 0.5, 0, 720, + addSkippedToothTriggerEvents(TriggerWheel::T_SECONDARY, s, totalTeethCount, skippedCount, 0.5, 0, 720, 0, 349); - s->addEvent720(350.0f, T_PRIMARY, TriggerValue::FALL); - s->addEvent720(360.0f, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(350.0f, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent720(360.0f, TriggerWheel::T_PRIMARY, TriggerValue::RISE); - s->addEvent720(360 + 0.2, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(360 + 0.2, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - addSkippedToothTriggerEvents(T_SECONDARY, s, totalTeethCount, skippedCount, 0.5, 0, 720, + addSkippedToothTriggerEvents(TriggerWheel::T_SECONDARY, s, totalTeethCount, skippedCount, 0.5, 0, 720, 361, 649); - s->addEvent720(650.0f, T_PRIMARY, TriggerValue::FALL); - s->addEvent720(660.0f, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(650.0f, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent720(660.0f, TriggerWheel::T_PRIMARY, TriggerValue::RISE); - s->addEvent720(660 + 0.2, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(660 + 0.2, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - addSkippedToothTriggerEvents(T_SECONDARY, s, totalTeethCount, skippedCount, 0.5, 0, 720, + addSkippedToothTriggerEvents(TriggerWheel::T_SECONDARY, s, totalTeethCount, skippedCount, 0.5, 0, 720, 661, 709); // exit(-1); - s->addEvent720(710.0f, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(710.0f, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent720(720.0f - 1, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(720.0f - 1, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(720.0f, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(720.0f, TriggerWheel::T_PRIMARY, TriggerValue::RISE); } void configureOnePlus16(TriggerWaveform *s) { @@ -58,12 +58,12 @@ void configureOnePlus16(TriggerWaveform *s) { float tooth = s->getCycleDuration() / count; float width = tooth / 2; // for VR we only handle rises so width does not matter much - s->addEventAngle(1, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(5, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(1, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(5, TriggerWheel::T_PRIMARY, TriggerValue::FALL); for (int i = 1; i <= count; i++) { - s->addEventAngle(tooth * i - width, T_SECONDARY, TriggerValue::RISE); - s->addEventAngle(tooth * i, T_SECONDARY, TriggerValue::FALL); + s->addEventAngle(tooth * i - width, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEventAngle(tooth * i, TriggerWheel::T_SECONDARY, TriggerValue::FALL); } s->isSynchronizationNeeded = false; @@ -71,8 +71,8 @@ void configureOnePlus16(TriggerWaveform *s) { static void kseriesTooth(TriggerWaveform* s, float end) { // for VR we only handle rises so width does not matter much - s->addEvent360(end - 4, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(end , T_PRIMARY, TriggerValue::FALL); + s->addEvent360(end - 4, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(end , TriggerWheel::T_PRIMARY, TriggerValue::FALL); } // TT_HONDA_K_12_1 @@ -107,18 +107,18 @@ void configureHondaK_4_1(TriggerWaveform *s) { angle_t start = 55.5; angle_t end = 70.5; - s->addEvent360(start + 90 * 0, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(end + 90 * 0, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(start + 90 * 0, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(end + 90 * 0, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(start + 90 * 1, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(end + 90 * 1, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(start + 90 * 1, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(end + 90 * 1, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(start + 90 * 2, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(end + 90 * 2, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(start + 90 * 2, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(end + 90 * 2, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(start + 90 * 3, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(end + 90 * 3, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(start + 90 * 3, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(end + 90 * 3, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(353, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(360, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(353, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(360, TriggerWheel::T_PRIMARY, TriggerValue::FALL); } diff --git a/firmware/controllers/trigger/decoders/trigger_mazda.cpp b/firmware/controllers/trigger/decoders/trigger_mazda.cpp index 09c03eb348..c2ba981200 100644 --- a/firmware/controllers/trigger/decoders/trigger_mazda.cpp +++ b/firmware/controllers/trigger/decoders/trigger_mazda.cpp @@ -43,21 +43,21 @@ void initializeMazdaMiataNaShape(TriggerWaveform *s) { /** * http://rusefi.com/forum/viewtopic.php?f=3&t=729&p=12983#p12983 */ - s->addEvent720(52.960405, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(122.635956, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(52.960405, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(122.635956, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(216.897031, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(232.640068, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(288.819688, T_PRIMARY, TriggerValue::FALL); // <-- This edge is the sync point - s->addEvent720(302.646323, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(216.897031, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(232.640068, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(288.819688, TriggerWheel::T_PRIMARY, TriggerValue::FALL); // <-- This edge is the sync point + s->addEvent720(302.646323, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(412.448056, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(482.816719, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(412.448056, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(482.816719, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(577.035495, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(592.878113, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(662.899708, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(720.0f, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(577.035495, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(592.878113, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(662.899708, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(720.0f, TriggerWheel::T_PRIMARY, TriggerValue::FALL); s->useOnlyPrimaryForSync = true; } @@ -77,13 +77,13 @@ void initializeMazdaMiataNb2Crank(TriggerWaveform *s) { s->setSecondTriggerSynchronizationGap2(0.8f, 1.8f); // todo: NB2 fronts are inverted comparing to NB1, life is not perfect :( - s->addEventAngle(180.0f - NB_CRANK_MAGIC - 4, T_PRIMARY, TriggerValue::FALL); - s->addEventAngle(180.0f - NB_CRANK_MAGIC, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(180.0f - 4, T_PRIMARY, TriggerValue::FALL); - s->addEventAngle(180.0f, T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(180.0f - NB_CRANK_MAGIC - 4, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(180.0f - NB_CRANK_MAGIC, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(180.0f - 4, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(180.0f, TriggerWheel::T_PRIMARY, TriggerValue::RISE); } -static void addNBCrankTooth(TriggerWaveform *s, angle_t angle, trigger_wheel_e const channelIndex) { +static void addNBCrankTooth(TriggerWaveform *s, angle_t angle, TriggerWheel const channelIndex) { s->addEvent720(angle, channelIndex, TriggerValue::RISE); s->addEvent720(angle + 4, channelIndex, TriggerValue::FALL); } @@ -100,25 +100,25 @@ static void initializeMazdaMiataNb1ShapeWithOffset(TriggerWaveform *s, float off /** * cam sensor is primary, crank sensor is secondary */ - s->addEvent720(20.0f, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(20.0f, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - addNBCrankTooth(s, offset + 66.0f, T_SECONDARY); - addNBCrankTooth(s, offset + 66.0f + NB_CRANK_MAGIC, T_SECONDARY); - addNBCrankTooth(s, offset + 66.0f + 180, T_SECONDARY); - addNBCrankTooth(s, offset + 66.0f + 180 + NB_CRANK_MAGIC, T_SECONDARY); + addNBCrankTooth(s, offset + 66.0f, TriggerWheel::T_SECONDARY); + addNBCrankTooth(s, offset + 66.0f + NB_CRANK_MAGIC, TriggerWheel:: T_SECONDARY); + addNBCrankTooth(s, offset + 66.0f + 180, TriggerWheel:: T_SECONDARY); + addNBCrankTooth(s, offset + 66.0f + 180 + NB_CRANK_MAGIC, TriggerWheel:: T_SECONDARY); - s->addEvent720(340.0f, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(360.0f, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(340.0f, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(360.0f, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent720(380.0f, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(400.0f, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(380.0f, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(400.0f, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - addNBCrankTooth(s, offset + 66.0f + 360, T_SECONDARY); - addNBCrankTooth(s, offset + 66.0f + 360 + NB_CRANK_MAGIC, T_SECONDARY); - addNBCrankTooth(s, offset + 66.0f + 540, T_SECONDARY); - addNBCrankTooth(s, offset + 66.0f + 540 + NB_CRANK_MAGIC, T_SECONDARY); + addNBCrankTooth(s, offset + 66.0f + 360, TriggerWheel:: T_SECONDARY); + addNBCrankTooth(s, offset + 66.0f + 360 + NB_CRANK_MAGIC, TriggerWheel:: T_SECONDARY); + addNBCrankTooth(s, offset + 66.0f + 540, TriggerWheel:: T_SECONDARY); + addNBCrankTooth(s, offset + 66.0f + 540 + NB_CRANK_MAGIC, TriggerWheel:: T_SECONDARY); - s->addEvent720(720.0f, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(720.0f, TriggerWheel::T_PRIMARY, TriggerValue::RISE); } void initializeMazdaMiataVVtTestShape(TriggerWaveform *s) { @@ -136,18 +136,18 @@ void configureMazdaProtegeSOHC(TriggerWaveform *s) { float z = 0.093; a = 180; - s->addEvent720(a - z * 720, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(a, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(a - z * 720, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(a, TriggerWheel::T_PRIMARY, TriggerValue::FALL); a += 180; - s->addEvent720(a - z * 720, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(a, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(a - z * 720, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(a, TriggerWheel::T_PRIMARY, TriggerValue::FALL); a += 180; - s->addEvent720(a - z * 720, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(a, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(a - z * 720, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(a, TriggerWheel::T_PRIMARY, TriggerValue::FALL); a += 180; - s->addEvent720(a - z * 720, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(a, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(a - z * 720, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(a, TriggerWheel::T_PRIMARY, TriggerValue::FALL); s->isSynchronizationNeeded = false; s->shapeWithoutTdc = true; @@ -159,21 +159,21 @@ void configureMazdaProtegeLx(TriggerWaveform *s) { /** * based on https://svn.code.sf.net/p/rusefi/code/trunk/misc/logs/1993_escort_gt/MAIN_rfi_report_2015-02-01%2017_39.csv */ - s->addEvent720(95.329254, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(95.329254, TriggerWheel::T_PRIMARY, TriggerValue::RISE); - s->addEvent720(95.329254 + 14.876692, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(95.329254 + 82.693557, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(95.329254 + 14.876692, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(95.329254 + 82.693557, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(95.329254 + 137.119154, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(95.329254 + 137.119154, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent720(95.329254 + 192.378308, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(95.329254 + 261.556418, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(95.329254 + 192.378308, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(95.329254 + 261.556418, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(95.329254 + 373.060597, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(95.329254 + 443.503184, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(95.329254 + 373.060597, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(95.329254 + 443.503184, TriggerWheel::T_SECONDARY, TriggerValue::FALL); - s->addEvent720(95.329254 + 555.349776, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(720, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(95.329254 + 555.349776, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(720, TriggerWheel::T_SECONDARY, TriggerValue::FALL); s->tdcPosition = 137.119154; s->isSynchronizationNeeded = false; @@ -187,14 +187,14 @@ void initializeMazdaMiataVVtCamShape(TriggerWaveform *s) { // Nominal gap is 0.128 s->setSecondTriggerSynchronizationGap2(0.04f, 0.2f); - s->addEvent720(325, T_PRIMARY, TriggerValue::FALL); - s->addEvent720(360, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(325, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent720(360, TriggerWheel::T_PRIMARY, TriggerValue::RISE); - s->addEvent720(641, T_PRIMARY, TriggerValue::FALL); - s->addEvent720(679, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(641, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent720(679, TriggerWheel::T_PRIMARY, TriggerValue::RISE); - s->addEvent720(700, T_PRIMARY, TriggerValue::FALL); - s->addEvent720(720, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(700, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent720(720, TriggerWheel::T_PRIMARY, TriggerValue::RISE); } // https://rusefi.com/forum/viewtopic.php?f=17&t=2417 @@ -203,26 +203,26 @@ void initializeMazdaSkyactivCam(TriggerWaveform *s) { s->initialize(FOUR_STROKE_CAM_SENSOR); // wide - s->addEvent360(50, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(70, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(50, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(70, TriggerWheel::T_PRIMARY, TriggerValue::FALL); // narrow - s->addEvent360(80, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(90, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(80, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(90, TriggerWheel::T_PRIMARY, TriggerValue::FALL); // wide - s->addEvent360(140, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(160, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(140, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(160, TriggerWheel::T_PRIMARY, TriggerValue::FALL); // narrow - s->addEvent360(170, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(180, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(170, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(180, TriggerWheel::T_PRIMARY, TriggerValue::FALL); // wide - s->addEvent360(250, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(270, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(250, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(270, TriggerWheel::T_PRIMARY, TriggerValue::FALL); // wide - s->addEvent360(340, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(360, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(340, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(360, TriggerWheel::T_PRIMARY, TriggerValue::FALL); s->setTriggerSynchronizationGap(0.43); s->setSecondTriggerSynchronizationGap(0.78); diff --git a/firmware/controllers/trigger/decoders/trigger_mercedes.cpp b/firmware/controllers/trigger/decoders/trigger_mercedes.cpp index d8a2f5229f..a07073b39f 100644 --- a/firmware/controllers/trigger/decoders/trigger_mercedes.cpp +++ b/firmware/controllers/trigger/decoders/trigger_mercedes.cpp @@ -6,14 +6,14 @@ void setMercedesTwoSegment(TriggerWaveform* s) { s->initialize(FOUR_STROKE_CRANK_SENSOR); - s->addEvent360(180 - 10, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(180, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(180 - 10, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(180, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(227 - 10, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(227, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(227 - 10, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(227, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(360 - 10, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(360, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(360 - 10, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(360, TriggerWheel::T_PRIMARY, TriggerValue::FALL); s->setTriggerSynchronizationGap(1.35); s->setSecondTriggerSynchronizationGap(2.84); diff --git a/firmware/controllers/trigger/decoders/trigger_misc.cpp b/firmware/controllers/trigger/decoders/trigger_misc.cpp index b1e6c0486e..2ec12097b5 100644 --- a/firmware/controllers/trigger/decoders/trigger_misc.cpp +++ b/firmware/controllers/trigger/decoders/trigger_misc.cpp @@ -17,11 +17,11 @@ void configureFiatIAQ_P8(TriggerWaveform * s) { int width = 60; s->tdcPosition = width; - s->addEvent720(width, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(180, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(width, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(180, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent720(180 + width, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(720, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(180 + width, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(720, TriggerWheel::T_PRIMARY, TriggerValue::FALL); s->setTriggerSynchronizationGap(3); } @@ -40,13 +40,13 @@ void configureTriTach(TriggerWaveform * s) { float angleDown = engineCycle / totalTeethCount * (0 + (1 - toothWidth)); float angleUp = engineCycle / totalTeethCount * (0 + 1); - s->addEventClamped(offset + angleDown, T_PRIMARY, TriggerValue::RISE, NO_LEFT_FILTER, NO_RIGHT_FILTER); - s->addEventClamped(offset + angleDown + 0.1, T_SECONDARY, TriggerValue::RISE, NO_LEFT_FILTER, NO_RIGHT_FILTER); - s->addEventClamped(offset + angleUp, T_PRIMARY, TriggerValue::FALL, NO_LEFT_FILTER, NO_RIGHT_FILTER); - s->addEventClamped(offset + angleUp + 0.1, T_SECONDARY, TriggerValue::FALL, NO_LEFT_FILTER, NO_RIGHT_FILTER); + s->addEventClamped(offset + angleDown, TriggerWheel::T_PRIMARY, TriggerValue::RISE, NO_LEFT_FILTER, NO_RIGHT_FILTER); + s->addEventClamped(offset + angleDown + 0.1, TriggerWheel::T_SECONDARY, TriggerValue::RISE, NO_LEFT_FILTER, NO_RIGHT_FILTER); + s->addEventClamped(offset + angleUp, TriggerWheel::T_PRIMARY, TriggerValue::FALL, NO_LEFT_FILTER, NO_RIGHT_FILTER); + s->addEventClamped(offset + angleUp + 0.1, TriggerWheel::T_SECONDARY, TriggerValue::FALL, NO_LEFT_FILTER, NO_RIGHT_FILTER); - addSkippedToothTriggerEvents(T_SECONDARY, s, totalTeethCount, /* skipped */ 0, toothWidth, offset, engineCycle, + addSkippedToothTriggerEvents(TriggerWheel::T_SECONDARY, s, totalTeethCount, /* skipped */ 0, toothWidth, offset, engineCycle, 1.0 * FOUR_STROKE_ENGINE_CYCLE / 135, NO_RIGHT_FILTER); } @@ -67,13 +67,13 @@ void configureFordPip(TriggerWaveform * s) { */ int oneCylinder = s->getCycleDuration() / 8; - s->addEventAngle(oneCylinder * 0.75, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(oneCylinder, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(oneCylinder * 0.75, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(oneCylinder, TriggerWheel::T_PRIMARY, TriggerValue::FALL); for (int i = 2;i<=8;i++) { - s->addEventAngle(oneCylinder * (i - 0.5), T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(oneCylinder * i, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(oneCylinder * (i - 0.5), TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(oneCylinder * i, TriggerWheel::T_PRIMARY, TriggerValue::FALL); } } @@ -84,20 +84,20 @@ void configureFordST170(TriggerWaveform * s) { int total = s->getCycleDuration() / 8; - s->addEventAngle(1 * total - width, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(1 * total, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(1 * total - width, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(1 * total, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEventAngle(2 * total - width, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(2 * total, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(2 * total - width, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(2 * total, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEventAngle(4 * total - width, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(4 * total, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(4 * total - width, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(4 * total, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEventAngle(6 * total - width, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(6 * total, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(6 * total - width, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(6 * total, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEventAngle(8 * total - width, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(8 * total, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(8 * total - width, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(8 * total, TriggerWheel::T_PRIMARY, TriggerValue::FALL); } void configureDaihatsu4(TriggerWaveform * s) { @@ -107,18 +107,18 @@ void configureDaihatsu4(TriggerWaveform * s) { s->setTriggerSynchronizationGap(0.125); - s->addEventAngle(30 - width, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(30, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(30 - width, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(30, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEventAngle(s->getCycleDuration() / 3 - width, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(s->getCycleDuration() / 3, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(s->getCycleDuration() / 3 - width, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(s->getCycleDuration() / 3, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEventAngle(s->getCycleDuration() / 3 * 2 - width, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(s->getCycleDuration() / 3 * 2, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(s->getCycleDuration() / 3 * 2 - width, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(s->getCycleDuration() / 3 * 2, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEventAngle(s->getCycleDuration() - width, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(s->getCycleDuration(), T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(s->getCycleDuration() - width, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(s->getCycleDuration(), TriggerWheel::T_PRIMARY, TriggerValue::FALL); } @@ -136,23 +136,23 @@ void configureBarra3plus1cam(TriggerWaveform *s) { { int offset = 120; - s->addEventAngle(offset + 2 * 0 - 10, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(offset + 2 * 0 + 0, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(offset + 2 * 0 - 10, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(offset + 2 * 0 + 0, TriggerWheel::T_PRIMARY, TriggerValue::FALL); // short gap 60 deg - s->addEventAngle(offset + 2 * 60 - 10, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(offset + 2 * 60 + 0, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(offset + 2 * 60 - 10, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(offset + 2 * 60 + 0, TriggerWheel::T_PRIMARY, TriggerValue::FALL); // long gap 120 deg - s->addEventAngle(offset + 2 * 180 - 10, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(offset + 2 * 180 + 0, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(offset + 2 * 180 - 10, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(offset + 2 * 180 + 0, TriggerWheel::T_PRIMARY, TriggerValue::FALL); // long gap 120 deg - s->addEventAngle(offset + 2 * 300 - 10, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(offset + 2 * 300 + 0, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(offset + 2 * 300 - 10, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(offset + 2 * 300 + 0, TriggerWheel::T_PRIMARY, TriggerValue::FALL); // short gap, 60 deg back to zero/720 } diff --git a/firmware/controllers/trigger/decoders/trigger_mitsubishi.cpp b/firmware/controllers/trigger/decoders/trigger_mitsubishi.cpp index bc5821e2f0..bf8e079666 100644 --- a/firmware/controllers/trigger/decoders/trigger_mitsubishi.cpp +++ b/firmware/controllers/trigger/decoders/trigger_mitsubishi.cpp @@ -18,17 +18,17 @@ void configureFordAspireTriggerWaveform(TriggerWaveform * s) { float x = 121.90; float y = 110.86; - s->addEvent720(x + y - 180, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(x, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(x + y, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(x + 180, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(360, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(x + y - 180, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(x, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(x + y, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(x + 180, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(360, TriggerWheel::T_PRIMARY, TriggerValue::RISE); - s->addEvent720(x + 180 + y, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(x + 360, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(x + 360 + y, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(x + 540, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(720, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(x + 180 + y, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(x + 360, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(x + 360 + y, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(x + 540, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(720, TriggerWheel::T_PRIMARY, TriggerValue::FALL); } /** @@ -40,18 +40,18 @@ void initializeMitsubishi4g18(TriggerWaveform *s) { s->setTriggerSynchronizationGap(1.6666); - s->addEvent720(106.77999999999997, T_PRIMARY, TriggerValue::FALL); - s->addEvent720(120.09999999999998, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(188.0775, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(286.33, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(298.875, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(354.91999999999996, T_PRIMARY, TriggerValue::FALL); - s->addEvent720(366.6825, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(476.45, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(543.9749999999999, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(639.52, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(653.15, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(720.0, T_SECONDARY, TriggerValue::FALL); + s->addEvent720(106.77999999999997, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent720(120.09999999999998, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(188.0775, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(286.33, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(298.875, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(354.91999999999996, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent720(366.6825, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(476.45, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(543.9749999999999, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(639.52, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(653.15, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(720.0, TriggerWheel::T_SECONDARY, TriggerValue::FALL); s->useOnlyPrimaryForSync = true; } @@ -67,18 +67,18 @@ void initialize36_2_1_1(TriggerWaveform *s) { float offset = (36 - 11 - 12 - 11) * oneTooth; - addSkippedToothTriggerEvents(T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle, + addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle, NO_LEFT_FILTER, offset + 11 * oneTooth + 1); offset += (11 + 1) * oneTooth; - addSkippedToothTriggerEvents(T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle, + addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle, NO_LEFT_FILTER, offset + 11 * oneTooth + 1); offset += (11 + 1) * oneTooth; - addSkippedToothTriggerEvents(T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle, + addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle, NO_LEFT_FILTER, offset + 10 * oneTooth + 1); s->setTriggerSynchronizationGap(3); @@ -97,12 +97,12 @@ void initialize36_2_1(TriggerWaveform *s) { float offset = (36 - 17 - 2 - 16) * oneTooth; - addSkippedToothTriggerEvents(T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle, + addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle, NO_LEFT_FILTER, offset + 17 * oneTooth + 1); offset += (17 + 2) * oneTooth; - addSkippedToothTriggerEvents(T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle, + addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, totalTeethCount, 0, toothWidth, /*offset*/offset, engineCycle, NO_LEFT_FILTER, offset + 16 * oneTooth + 1); @@ -114,17 +114,17 @@ void initializeVvt3A92(TriggerWaveform *s) { s->initialize(FOUR_STROKE_CRANK_SENSOR); int w = 5; - s->addEvent360(120 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(120, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(120 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(120, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(12 + 120 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(12 + 120, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(12 + 120 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(12 + 120, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(240 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(240, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(240 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(240, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(360 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(360, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(360 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(360, TriggerWheel::T_PRIMARY, TriggerValue::FALL); s->setTriggerSynchronizationGap(9); s->setSecondTriggerSynchronizationGap(0.11); // redundancy diff --git a/firmware/controllers/trigger/decoders/trigger_nissan.cpp b/firmware/controllers/trigger/decoders/trigger_nissan.cpp index e23f86a1ae..01403caa13 100644 --- a/firmware/controllers/trigger/decoders/trigger_nissan.cpp +++ b/firmware/controllers/trigger/decoders/trigger_nissan.cpp @@ -26,24 +26,24 @@ void initializeNissanSR20VE_4(TriggerWaveform *s) { float width = 4; - s->addEvent720(1 * 180 - 4 * width, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(1 * 180, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(1 * 180 - 4 * width, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(1 * 180, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent720(2 * 180 - width, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(2 * 180, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(2 * 180 - width, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(2 * 180, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent720(3 * 180 - width, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(3 * 180, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(3 * 180 - width, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(3 * 180, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent720(4 * 180 - width, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(4 * 180, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(4 * 180 - width, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(4 * 180, TriggerWheel::T_PRIMARY, TriggerValue::FALL); } static void addPrimaryToothEndingAt(TriggerWaveform *s, float fallAngle) { int vvtWidth = 20; - s->addEventAngle(fallAngle - vvtWidth, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(fallAngle, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(fallAngle - vvtWidth, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(fallAngle, TriggerWheel::T_PRIMARY, TriggerValue::FALL); } @@ -73,8 +73,8 @@ void makeNissanPattern(TriggerWaveform* s, size_t halfCylinderCount, size_t tota float currentAngle = missing * toothAngle; for (size_t i = 0; i < toothCount; i++) { currentAngle += toothAngle; - s->addEventAngle(currentAngle - 5, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(currentAngle, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(currentAngle - 5, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(currentAngle, TriggerWheel::T_PRIMARY, TriggerValue::FALL); } } @@ -111,14 +111,14 @@ void initializeNissanQR25crank(TriggerWaveform *s) { float currentAngle = 20; for (int i = 0;i < 16;i++) { currentAngle += 10; - s->addEventAngle(currentAngle - 5, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(currentAngle, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(currentAngle - 5, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(currentAngle, TriggerWheel::T_PRIMARY, TriggerValue::FALL); } } static void addvq30tooth(TriggerWaveform *s, float angle) { - s->addEvent360(angle - 4, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(angle, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(angle - 4, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(angle, TriggerWheel::T_PRIMARY, TriggerValue::FALL); } // yes, this is CAM shaft shape NOT crank shaft shape! diff --git a/firmware/controllers/trigger/decoders/trigger_renix.cpp b/firmware/controllers/trigger/decoders/trigger_renix.cpp index 1f4849585d..53f1f54f47 100644 --- a/firmware/controllers/trigger/decoders/trigger_renix.cpp +++ b/firmware/controllers/trigger/decoders/trigger_renix.cpp @@ -19,15 +19,15 @@ static void commonRenix(TriggerWaveform *s) { float currentAngle = 0; for (int i = 0;i < 20;i++) { - s->addEventAngle(currentAngle + tooth / 2, T_PRIMARY, TriggerValue::RISE); - s->addEventAngle(currentAngle + tooth, T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(currentAngle + tooth / 2, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(currentAngle + tooth, TriggerWheel::T_PRIMARY, TriggerValue::FALL); currentAngle += tooth; } - s->addEventAngle(currentAngle + tooth, T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(currentAngle + tooth, TriggerWheel::T_PRIMARY, TriggerValue::RISE); // float math error accumulates at this point so we have to spell out 180 - s->addEventAngle(s->getCycleDuration(), T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(s->getCycleDuration(), TriggerWheel::T_PRIMARY, TriggerValue::FALL); } // TT_RENIX_44_2_2 diff --git a/firmware/controllers/trigger/decoders/trigger_rover.cpp b/firmware/controllers/trigger/decoders/trigger_rover.cpp index dea26753b1..79726ec400 100644 --- a/firmware/controllers/trigger/decoders/trigger_rover.cpp +++ b/firmware/controllers/trigger/decoders/trigger_rover.cpp @@ -26,32 +26,32 @@ void initializeRoverK(TriggerWaveform *s) { float base = 0; for (int i = 0; i < 2; i++) { - s->addEvent720(base + tooth / 2, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(base + tooth, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(base + tooth / 2, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(base + tooth, TriggerWheel::T_PRIMARY, TriggerValue::FALL); base += tooth; } base += tooth; for (int i = 0; i < 2; i++) { - s->addEvent720(base + tooth / 2, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(base + tooth, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(base + tooth / 2, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(base + tooth, TriggerWheel::T_PRIMARY, TriggerValue::FALL); base += tooth; } base += tooth; for (int i = 0; i < 14; i++) { - s->addEvent720(base + tooth / 2, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(base + tooth, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(base + tooth / 2, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(base + tooth, TriggerWheel::T_PRIMARY, TriggerValue::FALL); base += tooth; } base += tooth; for (int i = 0; i < 3; i++) { - s->addEvent720(base + tooth / 2, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(base + tooth, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(base + tooth / 2, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(base + tooth, TriggerWheel::T_PRIMARY, TriggerValue::FALL); base += tooth; } base += tooth; for (int i = 0; i < 11; i++) { - s->addEvent720(base + tooth / 2, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(base + tooth, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(base + tooth / 2, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(base + tooth, TriggerWheel::T_PRIMARY, TriggerValue::FALL); base += tooth; } diff --git a/firmware/controllers/trigger/decoders/trigger_structure.cpp b/firmware/controllers/trigger/decoders/trigger_structure.cpp index 3c90bc987e..5e8dab30e4 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.cpp +++ b/firmware/controllers/trigger/decoders/trigger_structure.cpp @@ -168,7 +168,7 @@ angle_t TriggerWaveform::getAngle(int index) const { return cycleStartAngle + positionWithinCycle; } -void TriggerWaveform::addEventClamped(angle_t angle, trigger_wheel_e const channelIndex, TriggerValue const stateParam, float filterLeft, float filterRight) { +void TriggerWaveform::addEventClamped(angle_t angle, TriggerWheel const channelIndex, TriggerValue const stateParam, float filterLeft, float filterRight) { if (angle > filterLeft && angle < filterRight) { #if EFI_UNIT_TEST // printf("addEventClamped %f %s\r\n", angle, getTrigger_value_e(stateParam)); @@ -189,20 +189,20 @@ operation_mode_e TriggerWaveform::getWheelOperationMode() const { extern bool printTriggerDebug; #endif -size_t TriggerWaveform::getExpectedEventCount(int channelIndex) const { - return expectedEventCount[channelIndex]; +size_t TriggerWaveform::getExpectedEventCount(TriggerWheel channelIndex) const { + return expectedEventCount[(int)channelIndex]; } void TriggerWaveform::calculateExpectedEventCounts(bool useOnlyRisingEdgeForTrigger) { if (!useOnlyRisingEdgeForTrigger) { for (size_t i = 0; i < efi::size(expectedEventCount); i++) { - if (getExpectedEventCount(i) % 2 != 0) { - firmwareError(ERROR_TRIGGER_DRAMA, "Trigger: should be even number of events index=%d count=%d", i, getExpectedEventCount(i)); + if (getExpectedEventCount((TriggerWheel)i) % 2 != 0) { + firmwareError(ERROR_TRIGGER_DRAMA, "Trigger: should be even number of events index=%d count=%d", i, getExpectedEventCount((TriggerWheel)i)); } } } - bool isSingleToothOnPrimaryChannel = useOnlyRisingEdgeForTrigger ? getExpectedEventCount(0) == 1 : getExpectedEventCount(0) == 2; + bool isSingleToothOnPrimaryChannel = useOnlyRisingEdgeForTrigger ? getExpectedEventCount(TriggerWheel::T_PRIMARY) == 1 : getExpectedEventCount(TriggerWheel::T_PRIMARY) == 2; // todo: next step would be to set 'isSynchronizationNeeded' automatically based on the logic we have here if (!shapeWithoutTdc && isSingleToothOnPrimaryChannel != !isSynchronizationNeeded) { firmwareError(ERROR_TRIGGER_DRAMA, "shapeWithoutTdc isSynchronizationNeeded isSingleToothOnPrimaryChannel constraint violation"); @@ -221,23 +221,23 @@ void TriggerWaveform::calculateExpectedEventCounts(bool useOnlyRisingEdgeForTrig /** * Deprecated! many usages should be replaced by addEvent360 */ -void TriggerWaveform::addEvent720(angle_t angle, trigger_wheel_e const channelIndex, TriggerValue const state) { +void TriggerWaveform::addEvent720(angle_t angle, TriggerWheel const channelIndex, TriggerValue const state) { addEvent(angle / FOUR_STROKE_CYCLE_DURATION, channelIndex, state); } -void TriggerWaveform::addEvent360(angle_t angle, trigger_wheel_e const channelIndex, TriggerValue const state) { +void TriggerWaveform::addEvent360(angle_t angle, TriggerWheel const channelIndex, TriggerValue const state) { efiAssertVoid(CUSTOM_OMODE_UNDEF, operationMode == FOUR_STROKE_CAM_SENSOR || operationMode == FOUR_STROKE_CRANK_SENSOR, "Not a mode for 360"); addEvent(CRANK_MODE_MULTIPLIER * angle / FOUR_STROKE_CYCLE_DURATION, channelIndex, state); } -void TriggerWaveform::addEventAngle(angle_t angle, trigger_wheel_e const channelIndex, TriggerValue const state) { +void TriggerWaveform::addEventAngle(angle_t angle, TriggerWheel const channelIndex, TriggerValue const state) { addEvent(angle / getCycleDuration(), channelIndex, state); } -void TriggerWaveform::addEvent(angle_t angle, trigger_wheel_e const channelIndex, TriggerValue const state) { +void TriggerWaveform::addEvent(angle_t angle, TriggerWheel const channelIndex, TriggerValue const state) { efiAssertVoid(CUSTOM_OMODE_UNDEF, operationMode != OM_NONE, "operationMode not set"); - if (channelIndex == T_SECONDARY) { + if (channelIndex == TriggerWheel:: T_SECONDARY) { needSecondTriggerInput = true; } @@ -258,7 +258,7 @@ void TriggerWaveform::addEvent(angle_t angle, trigger_wheel_e const channelIndex // todo: see calculateExpectedEventCounts // related calculation should be done once trigger is initialized outside of trigger shape scope if (!useOnlyRisingEdgeForTriggerTemp || state == TriggerValue::RISE) { - expectedEventCount[channelIndex]++; + expectedEventCount[(int)channelIndex]++; } if (angle <= 0 || angle > 1) { @@ -286,7 +286,7 @@ void TriggerWaveform::addEvent(angle_t angle, trigger_wheel_e const channelIndex isRiseEvent[0] = TriggerValue::RISE == state; wave.setSwitchTime(0, angle); - wave.setChannelState(channelIndex, /* channelIndex */ 0, /* value */ state); + wave.setChannelState((int)channelIndex, /* channelIndex */ 0, /* value */ state); return; } @@ -324,7 +324,7 @@ void TriggerWaveform::addEvent(angle_t angle, trigger_wheel_e const channelIndex wave.setChannelState(i, index, value); } wave.setSwitchTime(index, angle); - wave.setChannelState(channelIndex, index, state); + wave.setChannelState((int)channelIndex, index, state); } angle_t TriggerWaveform::getSwitchAngle(int index) const { diff --git a/firmware/controllers/trigger/decoders/trigger_structure.h b/firmware/controllers/trigger/decoders/trigger_structure.h index 4970e0c01e..f49ec2e8a7 100644 --- a/firmware/controllers/trigger/decoders/trigger_structure.h +++ b/firmware/controllers/trigger/decoders/trigger_structure.h @@ -164,7 +164,7 @@ public: void calculateExpectedEventCounts(bool useOnlyRisingEdgeForTrigger); - size_t getExpectedEventCount(int channelIndex) const; + size_t getExpectedEventCount(TriggerWheel channelIndex) const; /** * This is used for signal validation @@ -175,7 +175,7 @@ public: /** * These signals are used for trigger export only */ - int triggerSignalIndeces[PWM_PHASE_MAX_COUNT]; + TriggerWheel triggerSignalIndeces[PWM_PHASE_MAX_COUNT]; TriggerValue triggerSignalStates[PWM_PHASE_MAX_COUNT]; // see also 'doesTriggerImplyOperationMode' bool knownOperationMode = true; @@ -199,16 +199,16 @@ public: bool useOnlyRisingEdgeForTriggerTemp; /* (0..1] angle range */ - void addEvent(angle_t angle, trigger_wheel_e const channelIndex, TriggerValue const state); + void addEvent(angle_t angle, TriggerWheel const channelIndex, TriggerValue const state); /* (0..720] angle range * Deprecated! many usages should be replaced by addEvent360 */ - void addEvent720(angle_t angle, trigger_wheel_e const channelIndex, TriggerValue const state); + void addEvent720(angle_t angle, TriggerWheel const channelIndex, TriggerValue const state); /** * this method helps us use real world 360 degrees shape for FOUR_STROKE_CAM_SENSOR and FOUR_STROKE_CRANK_SENSOR */ - void addEvent360(angle_t angle, trigger_wheel_e const channelIndex, TriggerValue const state); + void addEvent360(angle_t angle, TriggerWheel const channelIndex, TriggerValue const state); /** * This version of 'addEvent...' family considers the angle duration of operationMode in this trigger @@ -217,12 +217,12 @@ public: * TODO: one day kill all usages with FOUR_STROKE_CAM_SENSOR 720 cycle and add runtime prohibition * TODO: for FOUR_STROKE_CAM_SENSOR addEvent360 is the way to go */ - void addEventAngle(angle_t angle, trigger_wheel_e const channelIndex, TriggerValue const state); + void addEventAngle(angle_t angle, TriggerWheel const channelIndex, TriggerValue const state); /* (0..720] angle range * Deprecated? */ - void addEventClamped(angle_t angle, trigger_wheel_e const channelIndex, TriggerValue const stateParam, float filterLeft, float filterRight); + void addEventClamped(angle_t angle, TriggerWheel const channelIndex, TriggerValue const stateParam, float filterLeft, float filterRight); operation_mode_e getWheelOperationMode() const; void initialize(operation_mode_e operationMode); diff --git a/firmware/controllers/trigger/decoders/trigger_subaru.cpp b/firmware/controllers/trigger/decoders/trigger_subaru.cpp index 8935a829b6..b948361fb4 100644 --- a/firmware/controllers/trigger/decoders/trigger_subaru.cpp +++ b/firmware/controllers/trigger/decoders/trigger_subaru.cpp @@ -23,26 +23,26 @@ static void initialize_one_of_36_2_2_2(TriggerWaveform *s, int firstCount, int s float base = 0; for (int i = 0; i < firstCount; i++) { - s->addEvent720(base + narrow / 2, T_PRIMARY, TriggerValue::FALL); - s->addEvent720(base + narrow, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(base + narrow / 2, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent720(base + narrow, TriggerWheel::T_PRIMARY, TriggerValue::RISE); base += narrow; } - s->addEvent720(base + wide / 2, T_PRIMARY, TriggerValue::FALL); - s->addEvent720(base + wide, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(base + wide / 2, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent720(base + wide, TriggerWheel::T_PRIMARY, TriggerValue::RISE); base += wide; for (int i = 0; i < secondCount; i++) { - s->addEvent720(base + narrow / 2, T_PRIMARY, TriggerValue::FALL); - s->addEvent720(base + narrow, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(base + narrow / 2, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent720(base + narrow, TriggerWheel::T_PRIMARY, TriggerValue::RISE); base += narrow; } - s->addEvent720(720 - wide - wide / 2, T_PRIMARY, TriggerValue::FALL); - s->addEvent720(720 - wide, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(720 - wide - wide / 2, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent720(720 - wide, TriggerWheel::T_PRIMARY, TriggerValue::RISE); - s->addEvent720(720 - wide / 2, T_PRIMARY, TriggerValue::FALL); - s->addEvent720(720, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(720 - wide / 2, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEvent720(720, TriggerWheel::T_PRIMARY, TriggerValue::RISE); s->useOnlyPrimaryForSync = true; } @@ -86,22 +86,22 @@ static void initializeSubaru7_6(TriggerWaveform *s, bool withCrankWheel) { /* 97 degrees BTDC, but we have 20 degrees shift: * 180 - 97 - 20 = 63 */ #define SUBARU76_CRANK_PULSE0(cycle) \ - s->addEvent720((180 * (cycle)) + 63 - width, T_SECONDARY, TriggerValue::RISE); \ - s->addEvent720((180 * (cycle)) + 63, T_SECONDARY, TriggerValue::FALL) + s->addEvent720((180 * (cycle)) + 63 - width, TriggerWheel::T_SECONDARY, TriggerValue::RISE); \ + s->addEvent720((180 * (cycle)) + 63, TriggerWheel::T_SECONDARY, TriggerValue::FALL) /* 65 degrees BTDC, but we have 20 degrees shift: * 180 - 65 - 20 = 95 */ #define SUBARU76_CRANK_PULSE1(cycle) \ - s->addEvent720((180 * (cycle)) + 95 - width, T_SECONDARY, TriggerValue::RISE); \ - s->addEvent720((180 * (cycle)) + 95, T_SECONDARY, TriggerValue::FALL) + s->addEvent720((180 * (cycle)) + 95 - width, TriggerWheel::T_SECONDARY, TriggerValue::RISE); \ + s->addEvent720((180 * (cycle)) + 95, TriggerWheel::T_SECONDARY, TriggerValue::FALL) /* 10 degrees BTDC, but we have 20 degrees shift: * 180 - 10 - 20 = 150 */ #define SUBARU76_CRANK_PULSE2(cycle) \ - s->addEvent720((180 * (cycle)) + 150 - width, T_SECONDARY, TriggerValue::RISE); \ - s->addEvent720((180 * (cycle)) + 150, T_SECONDARY, TriggerValue::FALL) + s->addEvent720((180 * (cycle)) + 150 - width, TriggerWheel::T_SECONDARY, TriggerValue::RISE); \ + s->addEvent720((180 * (cycle)) + 150, TriggerWheel::T_SECONDARY, TriggerValue::FALL) #define SUBARU76_CAM_PULSE(cycle, offset) \ - s->addEvent720((180 * (cycle)) + (offset) - width, T_PRIMARY, TriggerValue::RISE); \ - s->addEvent720((180 * (cycle)) + (offset), T_PRIMARY, TriggerValue::FALL) + s->addEvent720((180 * (cycle)) + (offset) - width, TriggerWheel::T_PRIMARY, TriggerValue::RISE); \ + s->addEvent720((180 * (cycle)) + (offset), TriggerWheel::T_PRIMARY, TriggerValue::FALL) /* (TDC#2 + 20) + 15 */ SUBARU76_CAM_PULSE(0, +15); @@ -191,12 +191,12 @@ void initializeSubaru_SVX(TriggerWaveform *s) { /* T_CHANNEL_3 currently not supported, to keep trigger decode happy * set cam second as primary, so logic will be able to sync - * Crank angle sensor #1 = T_SECONDARY + * Crank angle sensor #1 = TriggerWheel:: T_SECONDARY * Crank andle sensor #2 = T_CHANNEL_3 - not supported yet * Cam angle sensor = T_PRIMARY */ -#define SVX_CRANK_1 T_SECONDARY +#define SVX_CRANK_1 TriggerWheel::T_SECONDARY //#define SVX_CRANK_2 T_CHANNEL_3 -#define SVX_CAM T_PRIMARY +#define SVX_CAM TriggerWheel::T_PRIMARY #define CRANK_1_FALL(n) (20.0 + offset + 30.0 * (n)) #define CRANK_1_RISE(n) (CRANK_1_FALL(n) - width) diff --git a/firmware/controllers/trigger/decoders/trigger_suzuki.cpp b/firmware/controllers/trigger/decoders/trigger_suzuki.cpp index 30cc136223..5557671b52 100644 --- a/firmware/controllers/trigger/decoders/trigger_suzuki.cpp +++ b/firmware/controllers/trigger/decoders/trigger_suzuki.cpp @@ -15,20 +15,20 @@ void initializeSuzukiG13B(TriggerWaveform *s) { float w = 5; float specialTooth = 20; - s->addEvent720(180 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(180, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(180 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(180, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent720(2 * specialTooth + 180 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(2 * specialTooth + 180, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(2 * specialTooth + 180 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(2 * specialTooth + 180, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent720(360 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(360, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(360 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(360, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent720(540 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(540, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(540 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(540, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent720(720 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(720, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(720 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(720, TriggerWheel::T_PRIMARY, TriggerValue::FALL); s->setTriggerSynchronizationGap(0.22); s->setSecondTriggerSynchronizationGap(1); diff --git a/firmware/controllers/trigger/decoders/trigger_toyota.cpp b/firmware/controllers/trigger/decoders/trigger_toyota.cpp index d23fcc10ed..68b06cf4b9 100644 --- a/firmware/controllers/trigger/decoders/trigger_toyota.cpp +++ b/firmware/controllers/trigger/decoders/trigger_toyota.cpp @@ -23,30 +23,30 @@ void initialize2jzGE1_12(TriggerWaveform *s) { float crankD = 360 / 12 / 2; // 15 float crankAngle = 10; - s->addEventClamped(crankAngle, T_SECONDARY, TriggerValue::FALL, -1, 721); // 120 + s->addEventClamped(crankAngle, TriggerWheel::T_SECONDARY, TriggerValue::FALL, -1, 721); // 120 for (int i = 0; i < 2; i++) { - s->addEventClamped(crankAngle + crankD, T_SECONDARY, TriggerValue::RISE, -1, 721); + s->addEventClamped(crankAngle + crankD, TriggerWheel::T_SECONDARY, TriggerValue::RISE, -1, 721); crankAngle += crankD; - s->addEventClamped(crankAngle + crankD, T_SECONDARY, TriggerValue::FALL, -1, 721); // 120 + s->addEventClamped(crankAngle + crankD, TriggerWheel::T_SECONDARY, TriggerValue::FALL, -1, 721); // 120 crankAngle += crankD; } - s->addEventClamped(75, T_PRIMARY, TriggerValue::FALL, -1, 721); + s->addEventClamped(75, TriggerWheel::T_PRIMARY, TriggerValue::FALL, -1, 721); for (int i = 0; i < 21; i++) { - s->addEventClamped(crankAngle + crankD, T_SECONDARY, TriggerValue::RISE, -1, 721); + s->addEventClamped(crankAngle + crankD, TriggerWheel::T_SECONDARY, TriggerValue::RISE, -1, 721); crankAngle += crankD; - s->addEventClamped(crankAngle + crankD, T_SECONDARY, TriggerValue::FALL, -1, 721); // 120 + s->addEventClamped(crankAngle + crankD, TriggerWheel::T_SECONDARY, TriggerValue::FALL, -1, 721); // 120 crankAngle += crankD; } - s->addEventClamped(crankAngle + crankD, T_SECONDARY, TriggerValue::RISE, -1, 721); + s->addEventClamped(crankAngle + crankD, TriggerWheel::T_SECONDARY, TriggerValue::RISE, -1, 721); crankAngle += crankD; - s->addEventClamped(720, T_PRIMARY, TriggerValue::RISE, -1, 721); + s->addEventClamped(720, TriggerWheel::T_PRIMARY, TriggerValue::RISE, -1, 721); s->isSynchronizationNeeded = false; } @@ -65,18 +65,18 @@ void initialize2jzGE3_34_simulation_shape(TriggerWaveform *s) { float crankAngle = 2 * crankDelta; // skipping two teeth for (int i = 0; i < 10; i++) { - s->addEvent720(crankAngle + 5, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(crankAngle + crankDelta, T_SECONDARY, TriggerValue::FALL); // 120 + s->addEvent720(crankAngle + 5, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(crankAngle + crankDelta, TriggerWheel::T_SECONDARY, TriggerValue::FALL); // 120 crankAngle += 10; } // 2 + 10 camAngle += camD; - s->addEvent720(camAngle, T_PRIMARY, TriggerValue::RISE); // 120 - s->addEvent720(camAngle + 3, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(camAngle, TriggerWheel::T_PRIMARY, TriggerValue::RISE); // 120 + s->addEvent720(camAngle + 3, TriggerWheel::T_PRIMARY, TriggerValue::FALL); for (int i = 0; i < 12; i++) { - s->addEvent720(crankAngle + 5, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(crankAngle + crankDelta, T_SECONDARY, TriggerValue::FALL); // 120 + s->addEvent720(crankAngle + 5, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(crankAngle + crankDelta, TriggerWheel::T_SECONDARY, TriggerValue::FALL); // 120 crankAngle += 10; } // 2 + 22 @@ -84,38 +84,38 @@ void initialize2jzGE3_34_simulation_shape(TriggerWaveform *s) { camAngle += camD; for (int i = 0; i < 12; i++) { - s->addEvent720(crankAngle + 5, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(crankAngle + crankDelta, T_SECONDARY, TriggerValue::FALL); // 120 + s->addEvent720(crankAngle + 5, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(crankAngle + crankDelta, TriggerWheel::T_SECONDARY, TriggerValue::FALL); // 120 crankAngle += crankDelta; } // 2 + 34 camAngle += camD; - s->addEvent720(camAngle, T_PRIMARY, TriggerValue::RISE); // 360 - s->addEvent720(camAngle + 3, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(camAngle, TriggerWheel::T_PRIMARY, TriggerValue::RISE); // 360 + s->addEvent720(camAngle + 3, TriggerWheel::T_PRIMARY, TriggerValue::FALL); crankAngle += 20; // skipping two teeth one more time for (int i = 0; i < 10; i++) { - s->addEvent720(crankAngle + 5, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(crankAngle + crankDelta, T_SECONDARY, TriggerValue::FALL); // 120 + s->addEvent720(crankAngle + 5, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(crankAngle + crankDelta, TriggerWheel::T_SECONDARY, TriggerValue::FALL); // 120 crankAngle += crankDelta; } // 2 + 10 camAngle += camD; for (int i = 0; i < 12; i++) { - s->addEvent720(crankAngle + 5, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(crankAngle + crankDelta, T_SECONDARY, TriggerValue::FALL); // 120 + s->addEvent720(crankAngle + 5, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(crankAngle + crankDelta, TriggerWheel::T_SECONDARY, TriggerValue::FALL); // 120 crankAngle += crankDelta; } // 2 + 22 camAngle += camD; - s->addEvent720(camAngle, T_PRIMARY, TriggerValue::RISE); // 600 - s->addEvent720(camAngle + 3, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(camAngle, TriggerWheel::T_PRIMARY, TriggerValue::RISE); // 600 + s->addEvent720(camAngle + 3, TriggerWheel::T_PRIMARY, TriggerValue::FALL); for (int i = 0; i < 12; i++) { - s->addEvent720(crankAngle + 5, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(crankAngle + crankDelta, T_SECONDARY, TriggerValue::FALL); // 120 + s->addEvent720(crankAngle + 5, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(crankAngle + crankDelta, TriggerWheel::T_SECONDARY, TriggerValue::FALL); // 120 crankAngle += 10; } // 2 + 32 camAngle += camD; @@ -130,12 +130,12 @@ void initializeToyota4_1(TriggerWaveform *s) { int w = 10; - s->addEvent360(180 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(180, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(180 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(180, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(270 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(270, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(270 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(270, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(360 - w, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(360, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(360 - w, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(360, TriggerWheel::T_PRIMARY, TriggerValue::FALL); } diff --git a/firmware/controllers/trigger/decoders/trigger_universal.cpp b/firmware/controllers/trigger/decoders/trigger_universal.cpp index 07d7ce7e77..c3a5981f67 100644 --- a/firmware/controllers/trigger/decoders/trigger_universal.cpp +++ b/firmware/controllers/trigger/decoders/trigger_universal.cpp @@ -16,7 +16,7 @@ angle_t getEngineCycle(operation_mode_e operationMode) { return operationMode == TWO_STROKE ? 360 : FOUR_STROKE_ENGINE_CYCLE; } -void addSkippedToothTriggerEvents(trigger_wheel_e wheel, TriggerWaveform *s, int totalTeethCount, int skippedCount, +void addSkippedToothTriggerEvents(TriggerWheel wheel, TriggerWaveform *s, int totalTeethCount, int skippedCount, float toothWidth, float offset, float engineCycle, float filterLeft, float filterRight) { efiAssertVoid(CUSTOM_ERR_6586, totalTeethCount > 0, "total count"); efiAssertVoid(CUSTOM_ERR_6587, skippedCount >= 0, "skipped count"); @@ -56,18 +56,18 @@ void initializeSkippedToothTriggerWaveformExt(TriggerWaveform *s, int totalTeeth s->isSynchronizationNeeded = (totalTeethCount > 2) && (skippedCount != 0); - addSkippedToothTriggerEvents(T_PRIMARY, s, totalTeethCount, skippedCount, 0.5, 0, getEngineCycle(operationMode), + addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, totalTeethCount, skippedCount, 0.5, 0, getEngineCycle(operationMode), NO_LEFT_FILTER, NO_RIGHT_FILTER); } void configureOnePlusOne(TriggerWaveform *s) { s->initialize(FOUR_STROKE_CAM_SENSOR); - s->addEvent360( 90, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(180, T_PRIMARY, TriggerValue::FALL); + s->addEvent360( 90, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(180, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(270, T_SECONDARY, TriggerValue::RISE); - s->addEvent360(360, T_SECONDARY, TriggerValue::FALL); + s->addEvent360(270, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent360(360, TriggerWheel::T_SECONDARY, TriggerValue::FALL); s->isSynchronizationNeeded = false; s->useOnlyPrimaryForSync = true; @@ -80,10 +80,10 @@ void configure3_1_cam(TriggerWaveform *s) { const float crankW = 360 / 3 / 2; - trigger_wheel_e crank = T_SECONDARY; + TriggerWheel crank = TriggerWheel:: T_SECONDARY; - s->addEvent720(10, T_PRIMARY, TriggerValue::RISE); - s->addEvent720(50, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(10, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent720(50, TriggerWheel::T_PRIMARY, TriggerValue::FALL); float a = 2 * crankW; @@ -120,11 +120,11 @@ void configureKawaKX450F(TriggerWaveform *s) { float toothWidth = 3 / 20.0; - addSkippedToothTriggerEvents(T_PRIMARY, s, 18, 0, toothWidth, 0, engineCycle, + addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, 18, 0, toothWidth, 0, engineCycle, NO_LEFT_FILTER, 720 - 39); - s->addEvent(0.97, T_PRIMARY, TriggerValue::RISE); - s->addEvent(1, T_PRIMARY, TriggerValue::FALL); + s->addEvent(0.97, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent(1, TriggerWheel::T_PRIMARY, TriggerValue::FALL); } void configureQuickStartSenderWheel(TriggerWaveform *s) { @@ -138,17 +138,17 @@ void configureQuickStartSenderWheel(TriggerWaveform *s) { s->setTriggerSynchronizationGap(0.645); s->setSecondTriggerSynchronizationGap(1.556); - s->addEvent360(offset + 0, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(offset + 70, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(offset + 0, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(offset + 70, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(offset + 90, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(offset + 110, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(offset + 90, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(offset + 110, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(offset + 180, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(offset + 200, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(offset + 180, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(offset + 200, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(offset + 270, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(offset + 340, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(offset + 270, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(offset + 340, TriggerWheel::T_PRIMARY, TriggerValue::FALL); } // Useful for: @@ -166,6 +166,6 @@ void configure12ToothCrank(TriggerWaveform* s) { } // Just a single tooth with 50% duty cycle - s->addEventAngle(15, T_PRIMARY, TriggerValue::FALL); - s->addEventAngle(30, T_PRIMARY, TriggerValue::RISE); + s->addEventAngle(15, TriggerWheel::T_PRIMARY, TriggerValue::FALL); + s->addEventAngle(30, TriggerWheel::T_PRIMARY, TriggerValue::RISE); } diff --git a/firmware/controllers/trigger/decoders/trigger_universal.h b/firmware/controllers/trigger/decoders/trigger_universal.h index 6d81ddd0ed..3b36eee06b 100644 --- a/firmware/controllers/trigger/decoders/trigger_universal.h +++ b/firmware/controllers/trigger/decoders/trigger_universal.h @@ -12,7 +12,7 @@ #define NO_LEFT_FILTER -1 #define NO_RIGHT_FILTER 1000 -void addSkippedToothTriggerEvents(trigger_wheel_e wheel, TriggerWaveform *s, +void addSkippedToothTriggerEvents(TriggerWheel wheel, TriggerWaveform *s, int totalTeethCount, int skippedCount, float toothWidth, float offset, float engineCycle, float filterLeft, float filterRight); diff --git a/firmware/controllers/trigger/decoders/trigger_vw.cpp b/firmware/controllers/trigger/decoders/trigger_vw.cpp index 93e4b55950..d87479e663 100644 --- a/firmware/controllers/trigger/decoders/trigger_vw.cpp +++ b/firmware/controllers/trigger/decoders/trigger_vw.cpp @@ -12,14 +12,14 @@ void setSkodaFavorit(TriggerWaveform *s) { s->initialize(FOUR_STROKE_CRANK_SENSOR); - s->addEvent360(46, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(177, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(46, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(177, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(180, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(183, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(180, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(183, TriggerWheel::T_PRIMARY, TriggerValue::FALL); - s->addEvent360(226, T_PRIMARY, TriggerValue::RISE); - s->addEvent360(360, T_PRIMARY, TriggerValue::FALL); + s->addEvent360(226, TriggerWheel::T_PRIMARY, TriggerValue::RISE); + s->addEvent360(360, TriggerWheel::T_PRIMARY, TriggerValue::FALL); s->tdcPosition = 180 - 46; s->setTriggerSynchronizationGap(3.91); @@ -34,12 +34,12 @@ void setVwConfiguration(TriggerWaveform *s) { float engineCycle = FOUR_STROKE_ENGINE_CYCLE; float toothWidth = 0.5; - addSkippedToothTriggerEvents(T_PRIMARY, s, 60, 2, toothWidth, 0, engineCycle, + addSkippedToothTriggerEvents(TriggerWheel::T_PRIMARY, s, 60, 2, toothWidth, 0, engineCycle, NO_LEFT_FILTER, 690); float angleDown = engineCycle / totalTeethCount * (totalTeethCount - skippedCount - 1 + (1 - toothWidth) ); - s->addEventClamped(0 + angleDown + 12, T_PRIMARY, TriggerValue::RISE, NO_LEFT_FILTER, NO_RIGHT_FILTER); - s->addEventClamped(0 + engineCycle, T_PRIMARY, TriggerValue::FALL, NO_LEFT_FILTER, NO_RIGHT_FILTER); + s->addEventClamped(0 + angleDown + 12, TriggerWheel::T_PRIMARY, TriggerValue::RISE, NO_LEFT_FILTER, NO_RIGHT_FILTER); + s->addEventClamped(0 + engineCycle, TriggerWheel::T_PRIMARY, TriggerValue::FALL, NO_LEFT_FILTER, NO_RIGHT_FILTER); s->setTriggerSynchronizationGap2(1.6, 4); s->setSecondTriggerSynchronizationGap(1); // this gap is not required to synch on perfect signal but is needed to handle to reject cranking transition noise diff --git a/firmware/controllers/trigger/trigger_central.cpp b/firmware/controllers/trigger/trigger_central.cpp index 3487e69c7c..b0a9681399 100644 --- a/firmware/controllers/trigger/trigger_central.cpp +++ b/firmware/controllers/trigger/trigger_central.cpp @@ -546,14 +546,14 @@ bool TriggerNoiseFilter::noiseFilter(efitick_t nowNt, trigger_event_e signal) { // todo: find a better place for these defs static const trigger_event_e opposite[4] = { SHAFT_PRIMARY_RISING, SHAFT_PRIMARY_FALLING, SHAFT_SECONDARY_RISING, SHAFT_SECONDARY_FALLING }; - static const trigger_wheel_e triggerIdx[4] = { T_PRIMARY, T_PRIMARY, T_SECONDARY, T_SECONDARY }; + static const TriggerWheel triggerIdx[4] = { TriggerWheel::T_PRIMARY, TriggerWheel::T_PRIMARY, TriggerWheel::T_SECONDARY, TriggerWheel:: T_SECONDARY }; // we process all trigger channels independently - trigger_wheel_e ti = triggerIdx[signal]; + TriggerWheel ti = triggerIdx[signal]; // falling is opposite to rising, and vise versa trigger_event_e os = opposite[signal]; // todo: currently only primary channel is filtered, because there are some weird trigger types on other channels - if (ti != T_PRIMARY) + if (ti != TriggerWheel::T_PRIMARY) return true; // update period accumulator: for rising signal, we update '0' accumulator, and for falling - '1' @@ -569,7 +569,7 @@ bool TriggerNoiseFilter::noiseFilter(efitick_t nowNt, // but first check if we're expecting a gap bool isGapExpected = TRIGGER_WAVEFORM(isSynchronizationNeeded) && triggerState->getShaftSynchronized() && - (triggerState->currentCycle.eventCount[ti] + 1) == TRIGGER_WAVEFORM(getExpectedEventCount(ti)); + (triggerState->currentCycle.eventCount[(int)ti] + 1) == TRIGGER_WAVEFORM(getExpectedEventCount(ti)); if (isGapExpected) { // usually we need to extend the period for gaps, based on the trigger info @@ -810,10 +810,9 @@ void triggerInfo(void) { efiPrintf("trigger#2 event counters up=%d/down=%d", engine->triggerCentral.getHwEventCounter(2), engine->triggerCentral.getHwEventCounter(3)); } - efiPrintf("expected cycle events %d/%d/%d", - TRIGGER_WAVEFORM(getExpectedEventCount(0)), - TRIGGER_WAVEFORM(getExpectedEventCount(1)), - TRIGGER_WAVEFORM(getExpectedEventCount(2))); + efiPrintf("expected cycle events %d/%d", + TRIGGER_WAVEFORM(getExpectedEventCount(TriggerWheel::T_PRIMARY)), + TRIGGER_WAVEFORM(getExpectedEventCount(TriggerWheel::T_SECONDARY))); efiPrintf("trigger type=%d/need2ndChannel=%s", engineConfiguration->trigger.type, boolToString(TRIGGER_WAVEFORM(needSecondTriggerInput))); diff --git a/firmware/controllers/trigger/trigger_decoder.cpp b/firmware/controllers/trigger/trigger_decoder.cpp index 05442b80fc..f10a747bfa 100644 --- a/firmware/controllers/trigger/trigger_decoder.cpp +++ b/firmware/controllers/trigger/trigger_decoder.cpp @@ -338,7 +338,7 @@ bool TriggerDecoderBase::isValidIndex(const TriggerWaveform& triggerShape) const return currentCycle.current_index < triggerShape.getSize(); } -static trigger_wheel_e eventIndex[4] = { T_PRIMARY, T_PRIMARY, T_SECONDARY, T_SECONDARY }; +static TriggerWheel eventIndex[4] = { TriggerWheel::T_PRIMARY, TriggerWheel::T_PRIMARY, TriggerWheel::T_SECONDARY, TriggerWheel:: T_SECONDARY }; static TriggerValue eventType[4] = { TriggerValue::FALL, TriggerValue::RISE, TriggerValue::FALL, TriggerValue::RISE }; #if EFI_UNIT_TEST @@ -414,16 +414,16 @@ void PrimaryTriggerDecoder::onTriggerError() { void PrimaryTriggerDecoder::onNotEnoughTeeth(int /*actual*/, int /*expected*/) { warning(CUSTOM_PRIMARY_NOT_ENOUGH_TEETH, "primary trigger error: not enough teeth between sync points: expected %d/%d got %d/%d", - TRIGGER_WAVEFORM(getExpectedEventCount(0)), - TRIGGER_WAVEFORM(getExpectedEventCount(1)), + TRIGGER_WAVEFORM(getExpectedEventCount(TriggerWheel::T_PRIMARY)), + TRIGGER_WAVEFORM(getExpectedEventCount(TriggerWheel::T_SECONDARY)), currentCycle.eventCount[0], currentCycle.eventCount[1]); } void PrimaryTriggerDecoder::onTooManyTeeth(int /*actual*/, int /*expected*/) { warning(CUSTOM_PRIMARY_TOO_MANY_TEETH, "primary trigger error: too many teeth between sync points: expected %d/%d got %d/%d", - TRIGGER_WAVEFORM(getExpectedEventCount(0)), - TRIGGER_WAVEFORM(getExpectedEventCount(1)), + TRIGGER_WAVEFORM(getExpectedEventCount(TriggerWheel::T_PRIMARY)), + TRIGGER_WAVEFORM(getExpectedEventCount(TriggerWheel::T_SECONDARY)), currentCycle.eventCount[0], currentCycle.eventCount[1]); } @@ -463,14 +463,14 @@ bool TriggerDecoderBase::validateEventCounters(const TriggerWaveform& triggerSha // We can check if things are fine by comparing the number of events in a cycle with the expected number of event. bool isDecodingError = false; for (int i = 0;i < PWM_PHASE_MAX_WAVE_PER_PWM;i++) { - isDecodingError |= (currentCycle.eventCount[i] != triggerShape.getExpectedEventCount(i)); + isDecodingError |= (currentCycle.eventCount[i] != triggerShape.getExpectedEventCount((TriggerWheel)i)); } #if EFI_UNIT_TEST printf("validateEventCounters: isDecodingError=%d\n", isDecodingError); if (isDecodingError) { for (int i = 0;i < PWM_PHASE_MAX_WAVE_PER_PWM;i++) { - printf("count: cur=%d exp=%d\n", currentCycle.eventCount[i], triggerShape.getExpectedEventCount(i)); + printf("count: cur=%d exp=%d\n", currentCycle.eventCount[i], triggerShape.getExpectedEventCount((TriggerWheel)i)); } } #endif /* EFI_UNIT_TEST */ @@ -535,7 +535,7 @@ expected TriggerDecoderBase::decodeTriggerEvent( efiAssert(CUSTOM_TRIGGER_UNEXPECTED, signal <= SHAFT_SECONDARY_RISING, "unexpected signal", unexpected); - trigger_wheel_e triggerWheel = eventIndex[signal]; + TriggerWheel triggerWheel = eventIndex[signal]; TriggerValue type = eventType[signal]; // Check that we didn't get the same edge twice in a row - that should be impossible @@ -545,7 +545,7 @@ expected TriggerDecoderBase::decodeTriggerEvent( prevSignal = signal; - currentCycle.eventCount[triggerWheel]++; + currentCycle.eventCount[(int)triggerWheel]++; if (toothed_previous_time > nowNt) { firmwareError(CUSTOM_OBD_93, "[%s] toothed_previous_time after nowNt prev=%d now=%d", msg, toothed_previous_time, nowNt); @@ -560,7 +560,7 @@ expected TriggerDecoderBase::decodeTriggerEvent( toothDurations[0] = currentDurationLong > 10 * NT_PER_SECOND ? 10 * NT_PER_SECOND : currentDurationLong; - bool isPrimary = triggerWheel == T_PRIMARY; + bool isPrimary = triggerWheel == TriggerWheel::T_PRIMARY; if (needToSkipFall(type) || needToSkipRise(type) || (!considerEventForGap())) { #if EFI_UNIT_TEST diff --git a/unit_tests/tests/ignition_injection/test_fuel_map.cpp b/unit_tests/tests/ignition_injection/test_fuel_map.cpp index b26f875ace..75cd4d3d16 100644 --- a/unit_tests/tests/ignition_injection/test_fuel_map.cpp +++ b/unit_tests/tests/ignition_injection/test_fuel_map.cpp @@ -88,17 +88,17 @@ static void configureFordAspireTriggerWaveform(TriggerWaveform * s) { s->initialize(FOUR_STROKE_CAM_SENSOR); s->useOnlyRisingEdgeForTriggerTemp = false; - s->addEvent720(53.747, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(121.90, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(232.76, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(300.54, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(360, T_PRIMARY, TriggerValue::RISE); + s->addEvent720(53.747, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(121.90, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(232.76, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(300.54, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(360, TriggerWheel::T_PRIMARY, TriggerValue::RISE); - s->addEvent720(409.8412, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(478.6505, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(588.045, T_SECONDARY, TriggerValue::RISE); - s->addEvent720(657.03, T_SECONDARY, TriggerValue::FALL); - s->addEvent720(720, T_PRIMARY, TriggerValue::FALL); + s->addEvent720(409.8412, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(478.6505, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(588.045, TriggerWheel::T_SECONDARY, TriggerValue::RISE); + s->addEvent720(657.03, TriggerWheel::T_SECONDARY, TriggerValue::FALL); + s->addEvent720(720, TriggerWheel::T_PRIMARY, TriggerValue::FALL); ASSERT_FLOAT_EQ(53.747 / 720, s->wave.getSwitchTime(0)); ASSERT_EQ( TriggerValue::RISE, s->wave.getChannelState(1, 0)) << "@0"; diff --git a/unit_tests/tests/trigger/test_real_cranking_miata_na6.cpp b/unit_tests/tests/trigger/test_real_cranking_miata_na6.cpp index 167caa77d6..b7b44f5fae 100644 --- a/unit_tests/tests/trigger/test_real_cranking_miata_na6.cpp +++ b/unit_tests/tests/trigger/test_real_cranking_miata_na6.cpp @@ -12,16 +12,16 @@ extern int timeNowUs; extern WarningCodeState unitTestWarningCodeState; -static void fireTriggerEvent(EngineTestHelper*eth, double timestampS, trigger_wheel_e channel, bool isFall) { +static void fireTriggerEvent(EngineTestHelper*eth, double timestampS, TriggerWheel channel, bool isFall) { trigger_event_e event; // in this trigger data file second channel is the primary // interesting how logic analyzer and trigger are flipped - logical '1' from logicdata file seems to be 'falling' // for trigger definition?! - if (channel == T_PRIMARY && isFall == false) { + if (channel == TriggerWheel::T_PRIMARY && isFall == false) { event = SHAFT_PRIMARY_RISING; - } else if (channel == T_PRIMARY && isFall == true) { + } else if (channel == TriggerWheel::T_PRIMARY && isFall == true) { event = SHAFT_PRIMARY_FALLING; - } else if (channel == T_SECONDARY && isFall == false) { + } else if (channel == TriggerWheel:: T_SECONDARY && isFall == false) { event = SHAFT_SECONDARY_RISING; } else { event = SHAFT_SECONDARY_FALLING; @@ -45,120 +45,120 @@ TEST(cranking, hardcodedRealCranking) { */ // looks like na_cranking4.logicdata file - /* 3 */ EVENT(/* timestamp*/0.597303, T_SECONDARY, /*value*/false); - /* 4 */ EVENT(/* timestamp*/0.69078225, T_SECONDARY, /*value*/true); - /* 5 */ EVENT(/* timestamp*/0.753783, T_PRIMARY, /*value*/true); - /* 6 */ EVENT(/* timestamp*/0.79334275, T_SECONDARY, /*value*/false); - /* 7 */ EVENT(/* timestamp*/0.85266675, T_SECONDARY, /*value*/true); - /* 8 */ EVENT(/* timestamp*/0.93424725, T_PRIMARY, /*value*/true); - /* 9 */ EVENT(/* timestamp*/0.9441, T_SECONDARY, /*value*/false); - /* 10 */ EVENT(/* timestamp*/0.98209725, T_PRIMARY, /*value*/false); - /* 11 */ EVENT(/* timestamp*/0.99523975, T_SECONDARY, /*value*/true); - /* 12 */ EVENT(/* timestamp*/1.076422, T_SECONDARY, /*value*/false); - /* 13 */ EVENT(/* timestamp*/1.125428, T_SECONDARY, /*value*/true); - /* 14 */ EVENT(/* timestamp*/1.194742, T_PRIMARY, /*value*/true); - /* 15 */ EVENT(/* timestamp*/1.20417975, T_SECONDARY, /*value*/false); - /* 16 */ EVENT(/* timestamp*/1.25380075, T_SECONDARY, /*value*/true); - /* 17 */ EVENT(/* timestamp*/1.30114225, T_PRIMARY, /*value*/true); - /* 18 */ EVENT(/* timestamp*/1.3341915, T_SECONDARY, /*value*/false); - /* 19 */ EVENT(/* timestamp*/1.383534, T_SECONDARY, /*value*/true); - /* 22 */ EVENT(/* timestamp*/1.45352675, T_PRIMARY, /*value*/true); - /* 23 */ EVENT(/* timestamp*/1.46291525, T_SECONDARY, /*value*/false); + /* 3 */ EVENT(/* timestamp*/0.597303, TriggerWheel::T_SECONDARY, /*value*/false); + /* 4 */ EVENT(/* timestamp*/0.69078225, TriggerWheel::T_SECONDARY, /*value*/true); + /* 5 */ EVENT(/* timestamp*/0.753783, TriggerWheel::T_PRIMARY, /*value*/true); + /* 6 */ EVENT(/* timestamp*/0.79334275, TriggerWheel::T_SECONDARY, /*value*/false); + /* 7 */ EVENT(/* timestamp*/0.85266675, TriggerWheel::T_SECONDARY, /*value*/true); + /* 8 */ EVENT(/* timestamp*/0.93424725, TriggerWheel::T_PRIMARY, /*value*/true); + /* 9 */ EVENT(/* timestamp*/0.9441, TriggerWheel::T_SECONDARY, /*value*/false); + /* 10 */ EVENT(/* timestamp*/0.98209725, TriggerWheel::T_PRIMARY, /*value*/false); + /* 11 */ EVENT(/* timestamp*/0.99523975, TriggerWheel::T_SECONDARY, /*value*/true); + /* 12 */ EVENT(/* timestamp*/1.076422, TriggerWheel::T_SECONDARY, /*value*/false); + /* 13 */ EVENT(/* timestamp*/1.125428, TriggerWheel::T_SECONDARY, /*value*/true); + /* 14 */ EVENT(/* timestamp*/1.194742, TriggerWheel::T_PRIMARY, /*value*/true); + /* 15 */ EVENT(/* timestamp*/1.20417975, TriggerWheel::T_SECONDARY, /*value*/false); + /* 16 */ EVENT(/* timestamp*/1.25380075, TriggerWheel::T_SECONDARY, /*value*/true); + /* 17 */ EVENT(/* timestamp*/1.30114225, TriggerWheel::T_PRIMARY, /*value*/true); + /* 18 */ EVENT(/* timestamp*/1.3341915, TriggerWheel::T_SECONDARY, /*value*/false); + /* 19 */ EVENT(/* timestamp*/1.383534, TriggerWheel::T_SECONDARY, /*value*/true); + /* 22 */ EVENT(/* timestamp*/1.45352675, TriggerWheel::T_PRIMARY, /*value*/true); + /* 23 */ EVENT(/* timestamp*/1.46291525, TriggerWheel::T_SECONDARY, /*value*/false); EXPECT_EQ(0, round(Sensor::getOrZero(SensorType::Rpm))); // ^^ All teeth above are pre-sync ^^ // THIS TOOTH IS SYNC POINT! // Should get instantRpm from here on - /* 25 */ EVENT(/* timestamp*/1.49939025, T_PRIMARY, /*value*/false); + /* 25 */ EVENT(/* timestamp*/1.49939025, TriggerWheel::T_PRIMARY, /*value*/false); EXPECT_EQ(239, round(Sensor::getOrZero(SensorType::Rpm))); - /* 27 */ EVENT(/* timestamp*/1.511785, T_SECONDARY, /*value*/true); + /* 27 */ EVENT(/* timestamp*/1.511785, TriggerWheel::T_SECONDARY, /*value*/true); EXPECT_EQ(234, round(Sensor::getOrZero(SensorType::Rpm))); - /* 28 */ EVENT(/* timestamp*/1.5908545, T_SECONDARY, /*value*/false); + /* 28 */ EVENT(/* timestamp*/1.5908545, TriggerWheel::T_SECONDARY, /*value*/false); EXPECT_EQ(231, round(Sensor::getOrZero(SensorType::Rpm))); - /* 31 */ EVENT(/* timestamp*/1.6399845, T_SECONDARY, /*value*/true); + /* 31 */ EVENT(/* timestamp*/1.6399845, TriggerWheel::T_SECONDARY, /*value*/true); EXPECT_EQ(234, round(Sensor::getOrZero(SensorType::Rpm))); - /* 32 */ EVENT(/* timestamp*/1.70975875, T_PRIMARY, /*value*/true); + /* 32 */ EVENT(/* timestamp*/1.70975875, TriggerWheel::T_PRIMARY, /*value*/true); EXPECT_EQ(225, round(Sensor::getOrZero(SensorType::Rpm))); - /* 33 */ EVENT(/* timestamp*/1.7194455, T_SECONDARY, /*value*/false); + /* 33 */ EVENT(/* timestamp*/1.7194455, TriggerWheel::T_SECONDARY, /*value*/false); EXPECT_EQ(231, round(Sensor::getOrZero(SensorType::Rpm))); - /* 36 */ EVENT(/* timestamp*/1.7697125, T_SECONDARY, /*value*/true); + /* 36 */ EVENT(/* timestamp*/1.7697125, TriggerWheel::T_SECONDARY, /*value*/true); EXPECT_EQ(231, round(Sensor::getOrZero(SensorType::Rpm))); - /* 37 */ EVENT(/* timestamp*/1.817179, T_PRIMARY, /*value*/true); + /* 37 */ EVENT(/* timestamp*/1.817179, TriggerWheel::T_PRIMARY, /*value*/true); EXPECT_EQ(217, round(Sensor::getOrZero(SensorType::Rpm))); - /* 38 */ EVENT(/* timestamp*/1.8511055, T_SECONDARY, /*value*/false); + /* 38 */ EVENT(/* timestamp*/1.8511055, TriggerWheel::T_SECONDARY, /*value*/false); EXPECT_EQ(225, round(Sensor::getOrZero(SensorType::Rpm))); - /* 41 */ EVENT(/* timestamp*/1.9011835, T_SECONDARY, /*value*/true); + /* 41 */ EVENT(/* timestamp*/1.9011835, TriggerWheel::T_SECONDARY, /*value*/true); EXPECT_EQ(243, round(Sensor::getOrZero(SensorType::Rpm))); - /* 42 */ EVENT(/* timestamp*/1.97691675, T_PRIMARY, /*value*/true); + /* 42 */ EVENT(/* timestamp*/1.97691675, TriggerWheel::T_PRIMARY, /*value*/true); EXPECT_EQ(207, round(Sensor::getOrZero(SensorType::Rpm))); - /* 43 */ EVENT(/* timestamp*/1.9822455, T_SECONDARY, /*value*/false); + /* 43 */ EVENT(/* timestamp*/1.9822455, TriggerWheel::T_SECONDARY, /*value*/false); EXPECT_EQ(226, round(Sensor::getOrZero(SensorType::Rpm))); // Second sync point - /* 44 */ EVENT(/* timestamp*/2.001249, T_PRIMARY, /*value*/false); + /* 44 */ EVENT(/* timestamp*/2.001249, TriggerWheel::T_PRIMARY, /*value*/false); EXPECT_EQ(277, round(Sensor::getOrZero(SensorType::Rpm))); - /* 45 */ EVENT(/* timestamp*/2.0070235, T_SECONDARY, /*value*/true); - /* 48 */ EVENT(/* timestamp*/2.04448175, T_SECONDARY, /*value*/false); - /* 49 */ EVENT(/* timestamp*/2.06135875, T_SECONDARY, /*value*/true); - /* 52 */ EVENT(/* timestamp*/2.08529325, T_PRIMARY, /*value*/true); - /* 53 */ EVENT(/* timestamp*/2.089132, T_SECONDARY, /*value*/false); - /* 54 */ EVENT(/* timestamp*/2.107152, T_SECONDARY, /*value*/true); - /* 56 */ EVENT(/* timestamp*/2.12253625, T_PRIMARY, /*value*/true); - /* 58 */ EVENT(/* timestamp*/2.136714, T_SECONDARY, /*value*/false); - /* 59 */ EVENT(/* timestamp*/2.1560195, T_SECONDARY, /*value*/true); - /* 60 */ EVENT(/* timestamp*/2.18365925, T_PRIMARY, /*value*/true); - /* 61 */ EVENT(/* timestamp*/2.188138, T_SECONDARY, /*value*/false); + /* 45 */ EVENT(/* timestamp*/2.0070235, TriggerWheel::T_SECONDARY, /*value*/true); + /* 48 */ EVENT(/* timestamp*/2.04448175, TriggerWheel::T_SECONDARY, /*value*/false); + /* 49 */ EVENT(/* timestamp*/2.06135875, TriggerWheel::T_SECONDARY, /*value*/true); + /* 52 */ EVENT(/* timestamp*/2.08529325, TriggerWheel::T_PRIMARY, /*value*/true); + /* 53 */ EVENT(/* timestamp*/2.089132, TriggerWheel::T_SECONDARY, /*value*/false); + /* 54 */ EVENT(/* timestamp*/2.107152, TriggerWheel::T_SECONDARY, /*value*/true); + /* 56 */ EVENT(/* timestamp*/2.12253625, TriggerWheel::T_PRIMARY, /*value*/true); + /* 58 */ EVENT(/* timestamp*/2.136714, TriggerWheel::T_SECONDARY, /*value*/false); + /* 59 */ EVENT(/* timestamp*/2.1560195, TriggerWheel::T_SECONDARY, /*value*/true); + /* 60 */ EVENT(/* timestamp*/2.18365925, TriggerWheel::T_PRIMARY, /*value*/true); + /* 61 */ EVENT(/* timestamp*/2.188138, TriggerWheel::T_SECONDARY, /*value*/false); EXPECT_EQ(571, round(Sensor::getOrZero(SensorType::Rpm))); // Third sync point - /* 62 */ EVENT(/* timestamp*/2.20460875, T_PRIMARY, /*value*/false); + /* 62 */ EVENT(/* timestamp*/2.20460875, TriggerWheel::T_PRIMARY, /*value*/false); EXPECT_EQ(570, round(Sensor::getOrZero(SensorType::Rpm))); - /* 63 */ EVENT(/* timestamp*/2.20940075, T_SECONDARY, /*value*/true); - /* 64 */ EVENT(/* timestamp*/2.2446445, T_SECONDARY, /*value*/false); - /* 65 */ EVENT(/* timestamp*/2.26826475, T_SECONDARY, /*value*/true); - /* 66 */ EVENT(/* timestamp*/2.30276125, T_PRIMARY, /*value*/true); - /* 67 */ EVENT(/* timestamp*/2.308357, T_SECONDARY, /*value*/false); - /* 68 */ EVENT(/* timestamp*/2.33551175, T_SECONDARY, /*value*/true); - /* 69 */ EVENT(/* timestamp*/2.3601205, T_PRIMARY, /*value*/true); - /* 70 */ EVENT(/* timestamp*/2.382952, T_SECONDARY, /*value*/false); - /* 71 */ EVENT(/* timestamp*/2.41535525, T_SECONDARY, /*value*/true); - /* 74 */ EVENT(/* timestamp*/2.45321725, T_PRIMARY, /*value*/true); - /* 75 */ EVENT(/* timestamp*/2.4577005, T_SECONDARY, /*value*/false); - /* 76 */ EVENT(/* timestamp*/2.47348125, T_PRIMARY, /*value*/false); - /* 77 */ EVENT(/* timestamp*/2.47796125, T_SECONDARY, /*value*/true); - /* 80 */ EVENT(/* timestamp*/2.51159275, T_SECONDARY, /*value*/false); - /* 81 */ EVENT(/* timestamp*/2.533664, T_SECONDARY, /*value*/true); - /* 84 */ EVENT(/* timestamp*/2.56564675, T_PRIMARY, /*value*/true); - /* 85 */ EVENT(/* timestamp*/2.57087425, T_SECONDARY, /*value*/false); - /* 86 */ EVENT(/* timestamp*/2.59612075, T_SECONDARY, /*value*/true); - /* 89 */ EVENT(/* timestamp*/2.61853375, T_PRIMARY, /*value*/true); - /* 90 */ EVENT(/* timestamp*/2.6365195, T_SECONDARY, /*value*/false); - /* 93 */ EVENT(/* timestamp*/2.6573605, T_SECONDARY, /*value*/true); - /* 94 */ EVENT(/* timestamp*/2.68447975, T_PRIMARY, /*value*/true); - /* 95 */ EVENT(/* timestamp*/2.68829075, T_SECONDARY, /*value*/false); - /* 96 */ EVENT(/* timestamp*/2.701797, T_PRIMARY, /*value*/false); - /* 98 */ EVENT(/* timestamp*/2.705553, T_SECONDARY, /*value*/true); - /* 100 */ EVENT(/* timestamp*/2.73171175, T_SECONDARY, /*value*/false); - /* 101 */ EVENT(/* timestamp*/2.7466575, T_SECONDARY, /*value*/true); - /* 104 */ EVENT(/* timestamp*/2.76736375, T_PRIMARY, /*value*/true); - /* 105 */ EVENT(/* timestamp*/2.770612, T_SECONDARY, /*value*/false); - /* 106 */ EVENT(/* timestamp*/2.7848735, T_SECONDARY, /*value*/true); - /* 109 */ EVENT(/* timestamp*/2.79669, T_PRIMARY, /*value*/true); - /* 110 */ EVENT(/* timestamp*/2.808129, T_SECONDARY, /*value*/false); - /* 113 */ EVENT(/* timestamp*/2.8232045, T_SECONDARY, /*value*/true); - /* 114 */ EVENT(/* timestamp*/2.84438125, T_PRIMARY, /*value*/true); - /* 115 */ EVENT(/* timestamp*/2.847948, T_SECONDARY, /*value*/false); - /* 117 */ EVENT(/* timestamp*/2.86067075, T_PRIMARY, /*value*/false); - /* 119 */ EVENT(/* timestamp*/2.8642345, T_SECONDARY, /*value*/true); - /* 120 */ EVENT(/* timestamp*/2.89112225, T_SECONDARY, /*value*/false); - /* 123 */ EVENT(/* timestamp*/2.9089625, T_SECONDARY, /*value*/true); - /* 124 */ EVENT(/* timestamp*/2.93429275, T_PRIMARY, /*value*/true); - /* 125 */ EVENT(/* timestamp*/2.93850475, T_SECONDARY, /*value*/false); - /* 128 */ EVENT(/* timestamp*/2.958108, T_SECONDARY, /*value*/true); - /* 129 */ EVENT(/* timestamp*/2.974461, T_PRIMARY, /*value*/true); - /* 130 */ EVENT(/* timestamp*/2.98846325, T_SECONDARY, /*value*/false); - /* 133 */ EVENT(/* timestamp*/3.00650825, T_SECONDARY, /*value*/true); - /* 134 */ EVENT(/* timestamp*/3.031735, T_PRIMARY, /*value*/true); + /* 63 */ EVENT(/* timestamp*/2.20940075, TriggerWheel::T_SECONDARY, /*value*/true); + /* 64 */ EVENT(/* timestamp*/2.2446445, TriggerWheel::T_SECONDARY, /*value*/false); + /* 65 */ EVENT(/* timestamp*/2.26826475, TriggerWheel::T_SECONDARY, /*value*/true); + /* 66 */ EVENT(/* timestamp*/2.30276125, TriggerWheel::T_PRIMARY, /*value*/true); + /* 67 */ EVENT(/* timestamp*/2.308357, TriggerWheel::T_SECONDARY, /*value*/false); + /* 68 */ EVENT(/* timestamp*/2.33551175, TriggerWheel::T_SECONDARY, /*value*/true); + /* 69 */ EVENT(/* timestamp*/2.3601205, TriggerWheel::T_PRIMARY, /*value*/true); + /* 70 */ EVENT(/* timestamp*/2.382952, TriggerWheel::T_SECONDARY, /*value*/false); + /* 71 */ EVENT(/* timestamp*/2.41535525, TriggerWheel::T_SECONDARY, /*value*/true); + /* 74 */ EVENT(/* timestamp*/2.45321725, TriggerWheel::T_PRIMARY, /*value*/true); + /* 75 */ EVENT(/* timestamp*/2.4577005, TriggerWheel::T_SECONDARY, /*value*/false); + /* 76 */ EVENT(/* timestamp*/2.47348125, TriggerWheel::T_PRIMARY, /*value*/false); + /* 77 */ EVENT(/* timestamp*/2.47796125, TriggerWheel::T_SECONDARY, /*value*/true); + /* 80 */ EVENT(/* timestamp*/2.51159275, TriggerWheel::T_SECONDARY, /*value*/false); + /* 81 */ EVENT(/* timestamp*/2.533664, TriggerWheel::T_SECONDARY, /*value*/true); + /* 84 */ EVENT(/* timestamp*/2.56564675, TriggerWheel::T_PRIMARY, /*value*/true); + /* 85 */ EVENT(/* timestamp*/2.57087425, TriggerWheel::T_SECONDARY, /*value*/false); + /* 86 */ EVENT(/* timestamp*/2.59612075, TriggerWheel::T_SECONDARY, /*value*/true); + /* 89 */ EVENT(/* timestamp*/2.61853375, TriggerWheel::T_PRIMARY, /*value*/true); + /* 90 */ EVENT(/* timestamp*/2.6365195, TriggerWheel::T_SECONDARY, /*value*/false); + /* 93 */ EVENT(/* timestamp*/2.6573605, TriggerWheel::T_SECONDARY, /*value*/true); + /* 94 */ EVENT(/* timestamp*/2.68447975, TriggerWheel::T_PRIMARY, /*value*/true); + /* 95 */ EVENT(/* timestamp*/2.68829075, TriggerWheel::T_SECONDARY, /*value*/false); + /* 96 */ EVENT(/* timestamp*/2.701797, TriggerWheel::T_PRIMARY, /*value*/false); + /* 98 */ EVENT(/* timestamp*/2.705553, TriggerWheel::T_SECONDARY, /*value*/true); + /* 100 */ EVENT(/* timestamp*/2.73171175, TriggerWheel::T_SECONDARY, /*value*/false); + /* 101 */ EVENT(/* timestamp*/2.7466575, TriggerWheel::T_SECONDARY, /*value*/true); + /* 104 */ EVENT(/* timestamp*/2.76736375, TriggerWheel::T_PRIMARY, /*value*/true); + /* 105 */ EVENT(/* timestamp*/2.770612, TriggerWheel::T_SECONDARY, /*value*/false); + /* 106 */ EVENT(/* timestamp*/2.7848735, TriggerWheel::T_SECONDARY, /*value*/true); + /* 109 */ EVENT(/* timestamp*/2.79669, TriggerWheel::T_PRIMARY, /*value*/true); + /* 110 */ EVENT(/* timestamp*/2.808129, TriggerWheel::T_SECONDARY, /*value*/false); + /* 113 */ EVENT(/* timestamp*/2.8232045, TriggerWheel::T_SECONDARY, /*value*/true); + /* 114 */ EVENT(/* timestamp*/2.84438125, TriggerWheel::T_PRIMARY, /*value*/true); + /* 115 */ EVENT(/* timestamp*/2.847948, TriggerWheel::T_SECONDARY, /*value*/false); + /* 117 */ EVENT(/* timestamp*/2.86067075, TriggerWheel::T_PRIMARY, /*value*/false); + /* 119 */ EVENT(/* timestamp*/2.8642345, TriggerWheel::T_SECONDARY, /*value*/true); + /* 120 */ EVENT(/* timestamp*/2.89112225, TriggerWheel::T_SECONDARY, /*value*/false); + /* 123 */ EVENT(/* timestamp*/2.9089625, TriggerWheel::T_SECONDARY, /*value*/true); + /* 124 */ EVENT(/* timestamp*/2.93429275, TriggerWheel::T_PRIMARY, /*value*/true); + /* 125 */ EVENT(/* timestamp*/2.93850475, TriggerWheel::T_SECONDARY, /*value*/false); + /* 128 */ EVENT(/* timestamp*/2.958108, TriggerWheel::T_SECONDARY, /*value*/true); + /* 129 */ EVENT(/* timestamp*/2.974461, TriggerWheel::T_PRIMARY, /*value*/true); + /* 130 */ EVENT(/* timestamp*/2.98846325, TriggerWheel::T_SECONDARY, /*value*/false); + /* 133 */ EVENT(/* timestamp*/3.00650825, TriggerWheel::T_SECONDARY, /*value*/true); + /* 134 */ EVENT(/* timestamp*/3.031735, TriggerWheel::T_PRIMARY, /*value*/true); EXPECT_EQ( 0, unitTestWarningCodeState.recentWarnings.getCount()) << "warningCounter#realCranking";