light refactoring

This commit is contained in:
kifir 2024-06-11 21:49:20 +03:00 committed by rusefillc
parent ede66011e5
commit 9308443f24
1 changed files with 11 additions and 13 deletions

View File

@ -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;
}
}
}