From 4fbc9d7b0648dc46bafd55ca4919e4418ad139c2 Mon Sep 17 00:00:00 2001 From: rusefi Date: Fri, 21 Jul 2023 23:48:58 -0400 Subject: [PATCH] ignition timing clamping settings only:atomic change around timing range --- firmware/controllers/engine_cycle/spark_logic.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/firmware/controllers/engine_cycle/spark_logic.cpp b/firmware/controllers/engine_cycle/spark_logic.cpp index 8804127485..c94d68e2fd 100644 --- a/firmware/controllers/engine_cycle/spark_logic.cpp +++ b/firmware/controllers/engine_cycle/spark_logic.cpp @@ -87,6 +87,11 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngleDuration, floatms_ angle_t finalIgnitionTiming = getEngineState()->timingAdvance[event->cylinderNumber]; + // 10 ATDC ends up as 710, convert it to -10 so we can log and clamp correctly + if (finalIgnitionTiming > 360) { + finalIgnitionTiming -= 720; + } + engine->outputChannels.ignitionAdvanceCyl[event->cylinderIndex] = finalIgnitionTiming; angle_t sparkAngle =