fix smooth retard functionality #5611
This commit is contained in:
parent
9011ed2e91
commit
6464d4dc7b
|
@ -104,15 +104,16 @@ angle_t getRunningAdvance(int rpm, float engineLoad) {
|
|||
#endif
|
||||
|
||||
#if EFI_LAUNCH_CONTROL
|
||||
if (engine->launchController.isLaunchCondition && engineConfiguration->enableLaunchRetard) {
|
||||
if (engine->launchController.isSmoothRetardCondition && engineConfiguration->enableLaunchRetard) {
|
||||
const float launchAngle = engineConfiguration->launchTimingRetard;
|
||||
if (engineConfiguration->launchSmoothRetard) {
|
||||
float launchAngle = engineConfiguration->launchTimingRetard;
|
||||
int launchRpm = engineConfiguration->launchRpm;
|
||||
int launchRpmWithTimingRange = launchRpm + engineConfiguration->launchRpmWindow;
|
||||
// interpolate timing from rpm at launch triggered to full retard at launch launchRpm + launchTimingRpmRange
|
||||
return interpolateClamped(launchRpm, advanceAngle, launchRpmWithTimingRange, launchAngle, rpm);
|
||||
const int launchRpm = engineConfiguration->launchRpm;
|
||||
const int smoothRetardStartRpm = (launchRpm - engineConfiguration->launchRpmWindow);
|
||||
const int smoothRetardEndRpm = (launchRpm - engineConfiguration->smoothRetardEndRpm);
|
||||
// https://github.com/rusefi/rusefi/issues/5611#issuecomment-2130431696
|
||||
return interpolateClamped(smoothRetardStartRpm, advanceAngle, smoothRetardEndRpm, launchAngle, rpm);
|
||||
} else {
|
||||
return engineConfiguration->launchTimingRetard;
|
||||
return launchAngle;
|
||||
}
|
||||
}
|
||||
#endif /* EFI_LAUNCH_CONTROL */
|
||||
|
|
|
@ -119,6 +119,7 @@ LaunchControlBase::LaunchControlBase() {
|
|||
launchActivatePinState = false;
|
||||
isLaunchPreCondition = false;
|
||||
isLaunchCondition = false;
|
||||
isSmoothRetardCondition = false;
|
||||
}
|
||||
|
||||
float LaunchControlBase::getFuelCoefficient() const {
|
||||
|
@ -130,7 +131,7 @@ void LaunchControlBase::update() {
|
|||
return;
|
||||
}
|
||||
|
||||
int rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
const int rpm = Sensor::getOrZero(SensorType::Rpm);
|
||||
combinedConditions = isLaunchConditionMet(rpm);
|
||||
|
||||
//and still recalculate in case user changed the values
|
||||
|
@ -150,6 +151,8 @@ void LaunchControlBase::update() {
|
|||
// If conditions are met...
|
||||
isLaunchCondition = m_launchTimer.hasElapsedSec(engineConfiguration->launchActivateDelay);
|
||||
}
|
||||
|
||||
isSmoothRetardCondition = isSmoothRetardRpmCondition(rpm);
|
||||
}
|
||||
|
||||
bool LaunchControlBase::isLaunchRpmRetardCondition() const {
|
||||
|
@ -160,6 +163,12 @@ bool LaunchControlBase::isLaunchSparkRpmRetardCondition() const {
|
|||
return isLaunchRpmRetardCondition() && engineConfiguration->launchSparkCutEnable;
|
||||
}
|
||||
|
||||
bool LaunchControlBase::isSmoothRetardRpmCondition(const int rpm) const {
|
||||
const int smoothRetardStartRpm = engineConfiguration->launchRpm - engineConfiguration->launchRpmWindow;
|
||||
const int smoothRetardEndRpm = engineConfiguration->launchRpm - engineConfiguration->smoothRetardEndRpm;
|
||||
return (smoothRetardStartRpm <= rpm) && (rpm <= smoothRetardEndRpm);
|
||||
}
|
||||
|
||||
bool LaunchControlBase::isLaunchFuelRpmRetardCondition() const {
|
||||
return isLaunchRpmRetardCondition() && engineConfiguration->launchFuelCutEnable;
|
||||
}
|
||||
|
|
|
@ -37,6 +37,7 @@ public:
|
|||
|
||||
private:
|
||||
bool isLaunchRpmRetardCondition() const;
|
||||
bool isSmoothRetardRpmCondition(int rpm) const;
|
||||
|
||||
Timer m_launchTimer;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue