diff --git a/firmware/controllers/engine_cycle/spark_logic.cpp b/firmware/controllers/engine_cycle/spark_logic.cpp index 18c35b72c7..94aed6005f 100644 --- a/firmware/controllers/engine_cycle/spark_logic.cpp +++ b/firmware/controllers/engine_cycle/spark_logic.cpp @@ -90,7 +90,7 @@ static void prepareCylinderIgnitionSchedule(angle_t dwellAngleDuration, floatms_ // Negate because timing *before* TDC, and we schedule *after* TDC - finalIgnitionTiming // Offset by this cylinder's position in the cycle - + getCylinderAngle(event->cylinderIndex, event->cylinderNumber); + + getCylinderAngle(event->cylinderIndex, realCylinderNumber); efiAssertVoid(ObdCode::CUSTOM_SPARK_ANGLE_1, !std::isnan(sparkAngle), "sparkAngle#1"); wrapAngle(sparkAngle, "findAngle#2", ObdCode::CUSTOM_ERR_6550); diff --git a/unit_tests/tests/ignition_injection/test_odd_firing_engine.cpp b/unit_tests/tests/ignition_injection/test_odd_firing_engine.cpp index 5fd1fc03ca..13d4cc11a0 100644 --- a/unit_tests/tests/ignition_injection/test_odd_firing_engine.cpp +++ b/unit_tests/tests/ignition_injection/test_odd_firing_engine.cpp @@ -34,10 +34,8 @@ TEST(OddFireRunningMode, hd) { // send fake crank signal events so that ignition events are updated eth.fireTriggerEvents2(2 /* count */ , 60 /* ms */); - // TODO: these numbers are wrong, they're both using the offset for cyl 1! (+19 deg) + // Cyl 1 fires 19 degrees late EXPECT_EQ(engine->ignitionEvents.elements[0].sparkAngle, 18); - EXPECT_EQ(engine->ignitionEvents.elements[1].sparkAngle, 378); - - // should be - // EXPECT_EQ(engine->ignitionEvents.elements[1].sparkAngle, 346); + // Cyl 2 fires 13 degrees early + EXPECT_EQ(engine->ignitionEvents.elements[1].sparkAngle, 346); }