mirror of https://github.com/rusefi/rusefi.git
deadly, deadly code!
This commit is contained in:
parent
f4f535d972
commit
346fe25267
|
@ -300,26 +300,6 @@ static void showMapStats(void) {
|
|||
efiPrintf("per revolution %d", measurementsPerRevolution);
|
||||
}
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
|
||||
/**
|
||||
* Because of MAP window averaging, MAP is only available while engine is spinning
|
||||
* @return Manifold Absolute Pressure, in kPa
|
||||
*/
|
||||
float getMap(void) {
|
||||
if (!isAdcChannelValid(engineConfiguration->map.sensor.hwChannel))
|
||||
return 0;
|
||||
|
||||
#if EFI_ANALOG_SENSORS
|
||||
if (!isValidRpm(GET_RPM()) || currentPressure == NO_VALUE_YET)
|
||||
return validateMap(getRawMap()); // maybe return NaN in case of stopped engine?
|
||||
return validateMap(currentPressure);
|
||||
#else
|
||||
return 100;
|
||||
#endif
|
||||
}
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
void initMapAveraging(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
#if !EFI_UNIT_TEST
|
||||
addConsoleAction("faststat", showMapStats);
|
||||
|
@ -328,17 +308,4 @@ void initMapAveraging(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
|||
applyMapMinBufferLength(PASS_ENGINE_PARAMETER_SIGNATURE);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#if EFI_PROD_CODE
|
||||
|
||||
float getMap(void) {
|
||||
#if EFI_ANALOG_SENSORS
|
||||
return getRawMap();
|
||||
#else
|
||||
return NAN;
|
||||
#endif /* EFI_ANALOG_SENSORS */
|
||||
}
|
||||
#endif /* EFI_PROD_CODE */
|
||||
|
||||
#endif /* EFI_MAP_AVERAGING */
|
||||
|
|
|
@ -108,18 +108,6 @@ float decodePressure(float voltage, air_pressure_sensor_config_s * mapConfig DEC
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function adds an error if MAP sensor value is outside of expected range
|
||||
* @return unchanged mapKPa parameter
|
||||
*/
|
||||
float validateMap(float mapKPa DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
||||
if (cisnan(mapKPa) || mapKPa < CONFIG(mapErrorDetectionTooLow) || mapKPa > CONFIG(mapErrorDetectionTooHigh)) {
|
||||
warning(OBD_Manifold_Absolute_Pressure_Circuit_Malfunction, "unexpected MAP value: %.2f", mapKPa);
|
||||
return 0;
|
||||
}
|
||||
return mapKPa;
|
||||
}
|
||||
|
||||
/**
|
||||
* This function checks if Baro/MAP sensor value is inside of expected range
|
||||
* @return unchanged mapKPa parameter or NaN
|
||||
|
@ -153,7 +141,7 @@ float getMapByVoltage(float voltage DECLARE_ENGINE_PARAMETER_SUFFIX) {
|
|||
/**
|
||||
* @return Manifold Absolute Pressure, in kPa
|
||||
*/
|
||||
float getRawMap(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
static float getRawMap(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
float voltage = getVoltageDivided("map", engineConfiguration->map.sensor.hwChannel PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
return getMapByVoltage(voltage PASS_ENGINE_PARAMETER_SUFFIX);
|
||||
}
|
||||
|
@ -223,9 +211,8 @@ static void printMAPInfo(void) {
|
|||
efiPrintf("instant value=%.2fkPa", getRawMap());
|
||||
|
||||
#if EFI_MAP_AVERAGING
|
||||
efiPrintf("map type=%d/%s MAP=%.2fkPa mapMinBufferLength=%d", engineConfiguration->map.sensor.type,
|
||||
efiPrintf("map type=%d/%s mapMinBufferLength=%d", engineConfiguration->map.sensor.type,
|
||||
getAir_pressure_sensor_type_e(engineConfiguration->map.sensor.type),
|
||||
getMap(),
|
||||
mapMinBufferLength);
|
||||
#endif // EFI_MAP_AVERAGING
|
||||
|
||||
|
|
|
@ -15,17 +15,11 @@ void initMapDecoder(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
|||
/**
|
||||
* @return Raw MAP sensor value right now
|
||||
*/
|
||||
float getRawMap(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
float getBaroPressure(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
bool hasMapSensor(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
|
||||
/**
|
||||
* @return MAP value averaged within a window of measurement
|
||||
*/
|
||||
float getMap(DECLARE_ENGINE_PARAMETER_SIGNATURE);
|
||||
float getMapByVoltage(float voltage DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
float decodePressure(float voltage, air_pressure_sensor_config_s * mapConfig DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
float validateMap(float mapKPa DECLARE_ENGINE_PARAMETER_SUFFIX);
|
||||
|
||||
#define KPA_PER_PSI 6.89475728f
|
||||
|
||||
|
|
|
@ -34,10 +34,6 @@ int getRemainingStack(thread_t *otp) {
|
|||
return 99999;
|
||||
}
|
||||
|
||||
float getMap(void) {
|
||||
return getRawMap();
|
||||
}
|
||||
|
||||
static void assertString(const char*actual, const char *expected) {
|
||||
if (strcmp(actual, expected) != 0) {
|
||||
firmwareError(OBD_PCM_Processor_Fault, "chprintf test: got %s while %s", actual, expected);
|
||||
|
|
|
@ -93,7 +93,3 @@ TEST(misc, testIgnitionMapGenerator) {
|
|||
assertEqualsM2("4400", 41.9, getInitialAdvance(4400, 40, 36), 0.1);
|
||||
assertEqualsM2("20@800", 14.2, getInitialAdvance(800, 20, 36), 0.2);
|
||||
}
|
||||
|
||||
float getMap(DECLARE_ENGINE_PARAMETER_SIGNATURE) {
|
||||
return engine->mockMapValue;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue