progress towards #961
This commit is contained in:
parent
79fd7fc8ce
commit
bab1744d1d
|
@ -293,7 +293,7 @@ static percent_t automaticIdleController(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
int idlePidLowerRpm = targetRpm + CONFIG(idlePidRpmDeadZone);
|
int idlePidLowerRpm = targetRpm + CONFIG(idlePidRpmDeadZone);
|
||||||
if (CONFIG(idlePidRpmUpperLimit) > 0) {
|
if (CONFIG(idlePidRpmUpperLimit) > 0) {
|
||||||
engine->engineState.idle.idleState = PID_UPPER;
|
engine->engineState.idle.idleState = PID_UPPER;
|
||||||
if (CONFIGB(useIacTableForCoasting) && !cisnan(engine->sensors.clt)) {
|
if (CONFIGB(useIacTableForCoasting) && hasCltSensor()) {
|
||||||
percent_t iacPosForCoasting = interpolate2d("iacCoasting", getCoolantTemperature(), CONFIG(iacCoastingBins), CONFIG(iacCoasting));
|
percent_t iacPosForCoasting = interpolate2d("iacCoasting", getCoolantTemperature(), CONFIG(iacCoastingBins), CONFIG(iacCoasting));
|
||||||
newValue = interpolateClamped(idlePidLowerRpm, newValue, idlePidLowerRpm + CONFIG(idlePidRpmUpperLimit), iacPosForCoasting, rpm);
|
newValue = interpolateClamped(idlePidLowerRpm, newValue, idlePidLowerRpm + CONFIG(idlePidRpmUpperLimit), iacPosForCoasting, rpm);
|
||||||
} else {
|
} else {
|
||||||
|
@ -371,7 +371,7 @@ static percent_t automaticIdleController(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
#endif /* EFI_SHAFT_POSITION_INPUT */
|
#endif /* EFI_SHAFT_POSITION_INPUT */
|
||||||
// cltCorrection is used only for cranking or running in manual mode
|
// cltCorrection is used only for cranking or running in manual mode
|
||||||
float cltCorrection;
|
float cltCorrection;
|
||||||
if (cisnan(clt))
|
if (!hasCltSensor())
|
||||||
cltCorrection = 1.0f;
|
cltCorrection = 1.0f;
|
||||||
// Use separate CLT correction table for cranking
|
// Use separate CLT correction table for cranking
|
||||||
else if (engineConfiguration->overrideCrankingIacSetting && !isRunning) {
|
else if (engineConfiguration->overrideCrankingIacSetting && !isRunning) {
|
||||||
|
|
|
@ -548,7 +548,7 @@ void setTargetRpmCurve(int rpm DECLARE_CONFIG_PARAMETER_SUFFIX) {
|
||||||
int getTargetRpmForIdleCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
int getTargetRpmForIdleCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
float clt = getCoolantTemperature();
|
float clt = getCoolantTemperature();
|
||||||
int targetRpm;
|
int targetRpm;
|
||||||
if (cisnan(clt)) {
|
if (!hasCltSensor()) {
|
||||||
// error is already reported, let's take first value from the table should be good enough error handing solution
|
// error is already reported, let's take first value from the table should be good enough error handing solution
|
||||||
targetRpm = CONFIG(cltIdleRpm)[0];
|
targetRpm = CONFIG(cltIdleRpm)[0];
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -129,15 +129,14 @@ bool hasCltSensorM(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
if (!haveSensorChannel) {
|
if (!haveSensorChannel) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// return !cisnan(engine->sensors.clt); todo why would unit tests fail?!
|
return !cisnan(engine->sensors.clt);
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return coolant temperature, in Celsius
|
* @return coolant temperature, in Celsius
|
||||||
*/
|
*/
|
||||||
temperature_t getCoolantTemperatureM(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
temperature_t getCoolantTemperatureM(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
if (!hasCltSensor()) {
|
if (engineConfiguration->clt.adcChannel == EFI_ADC_NONE) {
|
||||||
engine->isCltBroken = false;
|
engine->isCltBroken = false;
|
||||||
return NO_CLT_SENSOR_TEMPERATURE;
|
return NO_CLT_SENSOR_TEMPERATURE;
|
||||||
}
|
}
|
||||||
|
@ -212,14 +211,18 @@ void ThermistorMath::prepareThermistorCurve(thermistor_conf_s *tc) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasIatSensorM(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
bool hasIatSensorM(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
return engineConfiguration->iat.adcChannel != EFI_ADC_NONE;
|
bool haveSensorChannel = engineConfiguration->iat.adcChannel != EFI_ADC_NONE;
|
||||||
|
if (!haveSensorChannel) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return !cisnan(engine->sensors.iat);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Celsius value
|
* @return Celsius value
|
||||||
*/
|
*/
|
||||||
temperature_t getIntakeAirTemperatureM(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
temperature_t getIntakeAirTemperatureM(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||||
if (!hasIatSensor()) {
|
if (engineConfiguration->iat.adcChannel == EFI_ADC_NONE) {
|
||||||
return NO_IAT_SENSOR_TEMPERATURE;
|
return NO_IAT_SENSOR_TEMPERATURE;
|
||||||
}
|
}
|
||||||
float temperature = getTemperatureC(&engineConfiguration->iat, &engine->engineState.iatCurve,
|
float temperature = getTemperatureC(&engineConfiguration->iat, &engine->engineState.iatCurve,
|
||||||
|
|
Loading…
Reference in New Issue