From 8a9999c87fbfeed0377d6c57413cef3d34d2a70f Mon Sep 17 00:00:00 2001 From: Andrey Date: Sat, 17 Jul 2021 00:56:50 -0400 Subject: [PATCH] refactoring --- .../trigger/decoders/trigger_gm.cpp | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/firmware/controllers/trigger/decoders/trigger_gm.cpp b/firmware/controllers/trigger/decoders/trigger_gm.cpp index 1142f8184f..d7688de08c 100644 --- a/firmware/controllers/trigger/decoders/trigger_gm.cpp +++ b/firmware/controllers/trigger/decoders/trigger_gm.cpp @@ -60,31 +60,28 @@ void configureGm60_2_2_2(TriggerWaveform *s) { void configureGmTriggerWaveform(TriggerWaveform *s) { s->initialize(FOUR_STROKE_CRANK_SENSOR); - // all angles are x2 here - so, 5 degree width is 10 - float w = 10; + float w = 5; - float m = CRANK_MODE_MULTIPLIER; + s->addEvent360(60 - w, T_PRIMARY, TV_RISE); + s->addEvent360(60, T_PRIMARY, TV_FALL); - s->addEvent720(m * 60 - w, T_PRIMARY, TV_RISE); - s->addEvent720(m * 60, T_PRIMARY, TV_FALL); + s->addEvent360(120 - w, T_PRIMARY, TV_RISE); + s->addEvent360(120.0, T_PRIMARY, TV_FALL); - s->addEvent720(m * 120 - w, T_PRIMARY, TV_RISE); - s->addEvent720(m * 120.0, T_PRIMARY, TV_FALL); + s->addEvent360(180 - w, T_PRIMARY, TV_RISE); + s->addEvent360(180, T_PRIMARY, TV_FALL); - s->addEvent720(m * 180 - w, T_PRIMARY, TV_RISE); - s->addEvent720(m * 180, T_PRIMARY, TV_FALL); + s->addEvent360(240 - w, T_PRIMARY, TV_RISE); + s->addEvent360(240.0, T_PRIMARY, TV_FALL); - s->addEvent720(m * 240 - w, T_PRIMARY, TV_RISE); - s->addEvent720(m * 240.0, T_PRIMARY, TV_FALL); + s->addEvent360(300 - w, T_PRIMARY, TV_RISE); + s->addEvent360(300.0, T_PRIMARY, TV_FALL); - s->addEvent720(m * 300 - w, T_PRIMARY, TV_RISE); - s->addEvent720(m * 300.0, T_PRIMARY, TV_FALL); + s->addEvent360(350 - w, T_PRIMARY, TV_RISE); + s->addEvent360(350.0, T_PRIMARY, TV_FALL); - s->addEvent720(m * 350 - w, T_PRIMARY, TV_RISE); - s->addEvent720(m * 350.0, T_PRIMARY, TV_FALL); - - s->addEvent720(m * 360 - w, T_PRIMARY, TV_RISE); - s->addEvent720(m * 360.0, T_PRIMARY, TV_FALL); + s->addEvent360(360 - w, T_PRIMARY, TV_RISE); + s->addEvent360(360.0, T_PRIMARY, TV_FALL); s->setTriggerSynchronizationGap(6); }