mirror of https://github.com/rusefi/rusefi-1.git
refactoring
This commit is contained in:
parent
6e67697284
commit
296f83ea4d
|
@ -34,13 +34,17 @@ AirmassResult SpeedDensityAirmass::getAirmass(int rpm) {
|
||||||
}
|
}
|
||||||
|
|
||||||
float SpeedDensityAirmass::getMap(int rpm) const {
|
float SpeedDensityAirmass::getMap(int rpm) const {
|
||||||
float fallbackMap;
|
SensorResult map = Sensor::get(SensorType::Map);
|
||||||
if (CONFIG(enableMapEstimationTableFallback)) {
|
if (map) {
|
||||||
// if the map estimation table is enabled, estimate map based on the TPS and RPM
|
return map.Value;
|
||||||
fallbackMap = m_mapEstimationTable->getValue(rpm, TPS_2_BYTE_PACKING_MULT * Sensor::getOrZero(SensorType::Tps1));
|
|
||||||
} else {
|
} else {
|
||||||
fallbackMap = CONFIG(failedMapFallback);
|
float fallbackMap;
|
||||||
}
|
if (CONFIG(enableMapEstimationTableFallback)) {
|
||||||
|
// if the map estimation table is enabled, estimate map based on the TPS and RPM
|
||||||
|
fallbackMap = m_mapEstimationTable->getValue(rpm, TPS_2_BYTE_PACKING_MULT * Sensor::getOrZero(SensorType::Tps1));
|
||||||
|
} else {
|
||||||
|
fallbackMap = CONFIG(failedMapFallback);
|
||||||
|
}
|
||||||
|
|
||||||
#if EFI_TUNER_STUDIO
|
#if EFI_TUNER_STUDIO
|
||||||
if (CONFIG(debugMode) == DBG_MAP) {
|
if (CONFIG(debugMode) == DBG_MAP) {
|
||||||
|
@ -48,5 +52,6 @@ float SpeedDensityAirmass::getMap(int rpm) const {
|
||||||
}
|
}
|
||||||
#endif // EFI_TUNER_STUDIO
|
#endif // EFI_TUNER_STUDIO
|
||||||
|
|
||||||
return Sensor::get(SensorType::Map).value_or(fallbackMap);
|
return fallbackMap;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue