progress towards #961

This commit is contained in:
rusefi 2019-11-04 22:52:37 -05:00
parent bab1744d1d
commit 801b2eb70e
3 changed files with 8 additions and 6 deletions

View File

@ -859,10 +859,11 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_
tsOutputChannels->speedToRpmRatio = vehicleSpeed / rpm;
#endif /* EFI_VEHICLE_SPEED */
tsOutputChannels->isCltError = !isValidCoolantTemperature(getCoolantTemperature());
tsOutputChannels->isIatError = !isValidIntakeAirTemperature(getIntakeAirTemperature());
#endif /* EFI_PROD_CODE */
tsOutputChannels->isCltError = !hasCltSensor();
tsOutputChannels->isIatError = !hasIatSensor();
tsOutputChannels->fuelConsumptionPerHour = engine->engineState.fuelConsumption.perSecondConsumption;
tsOutputChannels->warningCounter = engine->engineState.warnings.warningCounter;

View File

@ -113,7 +113,7 @@ static angle_t getRunningAdvance(int rpm, float engineLoad DECLARE_ENGINE_PARAME
angle_t getAdvanceCorrections(int rpm DECLARE_ENGINE_PARAMETER_SUFFIX) {
float iatCorrection;
if (cisnan(engine->sensors.iat)) {
if (!hasIatSensor()) {
iatCorrection = 0;
} else {
iatCorrection = iatAdvanceCorrectionMap.getValue((float) rpm, getIntakeAirTemperature());

View File

@ -305,13 +305,13 @@ void initFuelMap(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
* @brief Engine warm-up fuel correction.
*/
float getCltFuelCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (cisnan(engine->sensors.clt))
if (!hasCltSensor())
return 1; // this error should be already reported somewhere else, let's just handle it
return interpolate2d("cltf", getCoolantTemperature(), config->cltFuelCorrBins, config->cltFuelCorr);
}
angle_t getCltTimingCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (cisnan(engine->sensors.clt))
if (!hasCltSensor())
return 0; // this error should be already reported somewhere else, let's just handle it
return interpolate2d("timc", getCoolantTemperature(), engineConfiguration->cltTimingBins, engineConfiguration->cltTimingExtra);
}
@ -339,7 +339,8 @@ float getFuelCutOffCorrection(efitick_t nowNt, int rpm DECLARE_ENGINE_PARAMETER_
// gather events
bool mapDeactivate = (map >= CONFIG(coastingFuelCutMap));
bool tpsDeactivate = (tpsPos >= CONFIG(coastingFuelCutTps));
bool cltDeactivate = cisnan(engine->sensors.clt) ? false : (engine->sensors.clt < (float)CONFIG(coastingFuelCutClt));
// If no CLT sensor (or broken), don't allow DFCO
bool cltDeactivate = hasCltSensor() ? (getCoolantTemperature() < (float)CONFIG(coastingFuelCutClt)) : true;
bool rpmDeactivate = (rpm < CONFIG(coastingFuelCutRpmLow));
bool rpmActivate = (rpm > CONFIG(coastingFuelCutRpmHigh));