do not let "Use fixed baro corr from MAP" kill VE fix #960

This commit is contained in:
rusefi 2019-09-29 09:58:29 -04:00
parent 8e3912e6b1
commit c935903162
5 changed files with 19 additions and 10 deletions

View File

@ -381,7 +381,12 @@ floatms_t getBaseTableFuel(int rpm, float engineLoad) {
float getBaroCorrection(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
if (hasBaroSensor(PASS_ENGINE_PARAMETER_SIGNATURE)) {
return baroCorrMap.getValue(GET_RPM(), getBaroPressure(PASS_ENGINE_PARAMETER_SIGNATURE));
float correction = baroCorrMap.getValue(GET_RPM(), getBaroPressure(PASS_ENGINE_PARAMETER_SIGNATURE));
if (cisnan(correction) || correction < 0.01) {
warning(OBD_Barometric_Press_Circ_Range_Perf, "Invalid baro correction %f", correction);
return 1;
}
return correction;
} else {
return 1;
}

View File

@ -1155,8 +1155,8 @@ typedef enum {
//P2223 NOx Sensor Heater Sense Circ Low Bank2
//P2224 NOx Sensor Heater Sense Circ High Bank2
//P2225 NOx Sensor Heater Sense Circ Interm Bank2
//P2226 Barometric Press Circ
//P2227 Barometric Press Circ Range/Perf
OBD_Barometric_Press_Circ = 2226,
OBD_Barometric_Press_Circ_Range_Perf = 2227,
//P2228 Barometric Press Circ Low
//P2229 Barometric Press Circ High
//P2230 Barometric Press Circ Interm

View File

@ -832,6 +832,6 @@ int getRusEfiVersion(void) {
if (initBootloader() != 0)
return 123;
#endif /* EFI_BOOTLOADER_INCLUDE_CODE */
return 20190928;
return 20190929;
}
#endif /* EFI_UNIT_TEST */

View File

@ -166,9 +166,6 @@ floatms_t getSpeedDensityFuel(float map DECLARE_GLOBAL_SUFFIX) {
return sdMath(airMass, ENGINE(engineState.targetAFR) PASS_GLOBAL_SUFFIX) * 1000;
}
// Default baro table is all 1.0, we can't recommend a reasonable default here
static const baro_corr_table_t default_baro_corr = {1};
void setDefaultVETable(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
setRpmTableBin(config->veRpmBins, FUEL_RPM_COUNT);
veMap.setAll(80);
@ -182,7 +179,12 @@ void setDefaultVETable(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
setRpmTableBin(engineConfiguration->baroCorrRpmBins, BARO_CORR_SIZE);
setLinearCurve(engineConfiguration->baroCorrPressureBins, BARO_CORR_SIZE, 75, 105, 1);
memcpy(engineConfiguration->baroCorrTable, default_baro_corr, sizeof(default_baro_corr));
for (int i = 0; i < BARO_CORR_SIZE;i++) {
for (int j = 0; j < BARO_CORR_SIZE;j++) {
// Default baro table is all 1.0, we can't recommend a reasonable default here
engineConfiguration->baroCorrTable[i][j] = 1;
}
}
}
void initSpeedDensity(DECLARE_ENGINE_PARAMETER_SIGNATURE) {

View File

@ -116,11 +116,13 @@ float validateMap(float mapKPa DECLARE_ENGINE_PARAMETER_SUFFIX) {
* This function checks if Baro/MAP sensor value is inside of expected range
* @return unchanged mapKPa parameter or NaN
*/
float validateBaroMap(float mapKPa DECLARE_ENGINE_PARAMETER_SUFFIX) {
static float validateBaroMap(float mapKPa DECLARE_ENGINE_PARAMETER_SUFFIX) {
const float atmoPressure = 100.0f;
const float atmoPressureRange = 15.0f; // 85..115
if (cisnan(mapKPa) || absF(mapKPa - atmoPressure) > atmoPressureRange)
if (cisnan(mapKPa) || absF(mapKPa - atmoPressure) > atmoPressureRange) {
warning(OBD_Barometric_Press_Circ, "Invalid start-up baro pressure = %.2fkPa", mapKPa);
return NAN;
}
return mapKPa;
}