From 9308443f24f1c9052a91bdc66e24d7a103a263c4 Mon Sep 17 00:00:00 2001 From: kifir Date: Tue, 11 Jun 2024 21:49:20 +0300 Subject: [PATCH] light refactoring --- firmware/controllers/algo/advance_map.cpp | 24 +++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/firmware/controllers/algo/advance_map.cpp b/firmware/controllers/algo/advance_map.cpp index f616c612e6..2f65e9e1ba 100644 --- a/firmware/controllers/algo/advance_map.cpp +++ b/firmware/controllers/algo/advance_map.cpp @@ -104,19 +104,17 @@ angle_t getRunningAdvance(int rpm, float engineLoad) { #endif #if EFI_LAUNCH_CONTROL - if (engineConfiguration->launchControlEnabled) { - if (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 (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; } } }