diff --git a/firmware/controllers/algo/advance_map.cpp b/firmware/controllers/algo/advance_map.cpp index 2f65e9e1ba..572fe7488a 100644 --- a/firmware/controllers/algo/advance_map.cpp +++ b/firmware/controllers/algo/advance_map.cpp @@ -106,16 +106,20 @@ angle_t getRunningAdvance(int rpm, float engineLoad) { #if EFI_LAUNCH_CONTROL if (engineConfiguration->launchControlEnabled && engineConfiguration->enableLaunchRetard) { const float launchAngle = engineConfiguration->launchTimingRetard; - const int launchRpm = engineConfiguration->launchRpm; - const int smoothRetardStartRpm = (launchRpm - engineConfiguration->launchRpmWindow); - const int smoothRetardEndRpm = (launchRpm - engineConfiguration->launchCorrectionsEndRpm); - if (smoothRetardStartRpm <= rpm) { - if (engineConfiguration->launchSmoothRetard && (rpm <= smoothRetardEndRpm)) { - // https://github.com/rusefi/rusefi/issues/5611#issuecomment-2130431696 - return interpolateClamped(smoothRetardStartRpm, advanceAngle, smoothRetardEndRpm, launchAngle, rpm); - } else { - return launchAngle; + if (engine->launchController.isPreLaunchCondition) { + const int launchRpm = engineConfiguration->launchRpm; + const int smoothRetardStartRpm = (launchRpm - engineConfiguration->launchRpmWindow); + const int smoothRetardEndRpm = (launchRpm - engineConfiguration->launchCorrectionsEndRpm); + if (smoothRetardStartRpm <= rpm) { + if (engineConfiguration->launchSmoothRetard && (rpm <= smoothRetardEndRpm)) { + // https://github.com/rusefi/rusefi/issues/5611#issuecomment-2130431696 + return interpolateClamped(smoothRetardStartRpm, advanceAngle, smoothRetardEndRpm, launchAngle, rpm); + } else { + return launchAngle; + } } + } else if (engine->launchController.isLaunchCondition) { + return launchAngle; } } #endif /* EFI_LAUNCH_CONTROL */ diff --git a/unit_tests/tests/launch/test_ignition_angle_advance.cpp b/unit_tests/tests/launch/test_ignition_angle_advance.cpp index f85895c070..133d2cdb65 100644 --- a/unit_tests/tests/launch/test_ignition_angle_advance.cpp +++ b/unit_tests/tests/launch/test_ignition_angle_advance.cpp @@ -77,6 +77,10 @@ static void setUpTestParameters( } else { ASSERT_FALSE(engineConfiguration->launchSmoothRetard); // check default value } + + engineConfiguration->launchActivationMode = ALWAYS_ACTIVE_LAUNCH; // to satisfy activateSwitchCondition + engineConfiguration->launchSpeedThreshold = 0; // to satisfy speedCondition + Sensor::setMockValue(SensorType::DriverThrottleIntent, 1.7); // to satisfy tpsCondition } static void setUpTestParametersWithEnabledLaunchControl(