diff --git a/firmware/config/engines/dodge_neon.cpp b/firmware/config/engines/dodge_neon.cpp index 097d64a62e..28415c2f06 100644 --- a/firmware/config/engines/dodge_neon.cpp +++ b/firmware/config/engines/dodge_neon.cpp @@ -396,7 +396,7 @@ void setDodgeNeonNGCEngineConfiguration(DECLARE_ENGINE_PARAMETER_F) { boardConfiguration->clutchDownPin = GPIOC_12; boardConfiguration->clutchDownPinMode = PI_PULLUP; - boardConfiguration->clutchUpPin = GPIOA_14; +// boardConfiguration->clutchUpPin = GPIOA_14; // note SWCLK - conflict with SWD boardConfiguration->clutchUpPinMode = PI_PULLUP; // alt GPIOC_12 diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 07d957e085..bafda9437c 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -571,10 +571,9 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ tsOutputChannels->coolant_temperature = coolant; tsOutputChannels->intakeAirTemperature = intake; tsOutputChannels->throttlePositon = tps; - if (hasMafSensor()) { - tsOutputChannels->massAirFlowVoltage = getMaf(); - } - tsOutputChannels->massAirFlowValue = getRealMaf(); + tsOutputChannels->massAirFlowVoltage = hasMafSensor() ? getMaf() : 0; + tsOutputChannels->massAirFlowValue = hasMafSensor() ? getRealMaf() : 0; + tsOutputChannels->veValue = veMap.getValue(getMap(), rpm); tsOutputChannels->airFuelRatio = getAfr(); if (hasVBatt(PASS_ENGINE_PARAMETER_F)) { @@ -582,7 +581,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ } tsOutputChannels->tpsADC = getTPS10bitAdc(PASS_ENGINE_PARAMETER_F); #if EFI_ANALOG_SENSORS || defined(__DOXYGEN__) - tsOutputChannels->baroPressure = getBaroPressure(); + tsOutputChannels->baroPressure = hasBaroSensor() ? getBaroPressure() : 0; #endif /* EFI_ANALOG_SENSORS */ tsOutputChannels->manifold_air_pressure = getMap(); tsOutputChannels->engineLoad = engineLoad; @@ -592,7 +591,7 @@ void updateTunerStudioState(TunerStudioOutputChannels *tsOutputChannels DECLARE_ tsOutputChannels->deltaTps = engine->tpsAccelEnrichment.getDelta(); tsOutputChannels->triggerErrorsCounter = triggerCentral.triggerState.totalTriggerErrorCounter; tsOutputChannels->baroCorrection = engine->engineState.baroCorrection; - tsOutputChannels->pedalPosition = getPedalPosition(PASS_ENGINE_PARAMETER_F); + tsOutputChannels->pedalPosition = hasPedalPositionSensor(PASS_ENGINE_PARAMETER_F) ? getPedalPosition(PASS_ENGINE_PARAMETER_F) : 0; tsOutputChannels->knockCount = engine->knockCount; tsOutputChannels->knockLevel = engine->knockVolts; tsOutputChannels->injectorDutyCycle = getInjectorDutyCycle(rpm PASS_ENGINE_PARAMETER); diff --git a/firmware/controllers/map_averaging.cpp b/firmware/controllers/map_averaging.cpp index 73a5fb9362..cc909f217c 100644 --- a/firmware/controllers/map_averaging.cpp +++ b/firmware/controllers/map_averaging.cpp @@ -213,6 +213,18 @@ float getMapVoltage(void) { return v_averagedMapValue; } +/** + * This function adds an error if MAP sensor value is outside of expected range + * @return unchanged mapKPa paramenter + */ +float validateMap(float mapKPa DECLARE_ENGINE_PARAMETER_S) { + if (cisnan(mapKPa) || mapKPa < CONFIG(mapErrorLowValue) || mapKPa > CONFIG(mapErrorHighValue)) { + warning(OBD_PCM_Processor_Fault, "invalid MAP value: %f", mapKPa); + return 0; + } + return mapKPa; +} + #if EFI_PROD_CODE || defined(__DOXYGEN__) /** @@ -226,8 +238,8 @@ float getMap(void) { #if EFI_ANALOG_SENSORS || defined(__DOXYGEN__) if (!isValidRpm(engine->rpmCalculator.rpmValue)) - return getRawMap(); // maybe return NaN in case of stopped engine? - return getMapByVoltage(v_averagedMapValue); + return validateMap(getRawMap()); // maybe return NaN in case of stopped engine? + return validateMap(getMapByVoltage(v_averagedMapValue)); #else return 100; #endif diff --git a/firmware/controllers/math/speed_density.cpp b/firmware/controllers/math/speed_density.cpp index 425ad6f399..dc3fef7d50 100644 --- a/firmware/controllers/math/speed_density.cpp +++ b/firmware/controllers/math/speed_density.cpp @@ -52,10 +52,6 @@ float getTCharge(int rpm, float tps, float coolantTemp, float airTemp) { * @return per cylinder injection time, in seconds */ float sdMath(engine_configuration_s *engineConfiguration, float VE, float MAP, float AFR, float tempK) { - if (MAP < 0.001 || cisnan(MAP)) { - warning(OBD_PCM_Processor_Fault, "invalid MAP value"); - return 0; - } /** * todo: pre-calculate gramm/second injector flow to save one multiplication diff --git a/firmware/controllers/sensors/map.cpp b/firmware/controllers/sensors/map.cpp index 1e15a3a684..5f973ec879 100644 --- a/firmware/controllers/sensors/map.cpp +++ b/firmware/controllers/sensors/map.cpp @@ -165,10 +165,12 @@ static void printMAPInfo(void) { } } - scheduleMsg(logger, "baro type=%d value=%f", engineConfiguration->baroSensor.type, getBaroPressure()); - if (engineConfiguration->baroSensor.type == MT_CUSTOM) { - scheduleMsg(logger, "min=%f max=%f", engineConfiguration->baroSensor.valueAt0, - engineConfiguration->baroSensor.valueAt5); + if (hasBaroSensor(PASS_ENGINE_PARAMETER_F)) { + scheduleMsg(logger, "baro type=%d value=%f", engineConfiguration->baroSensor.type, getBaroPressure()); + if (engineConfiguration->baroSensor.type == MT_CUSTOM) { + scheduleMsg(logger, "min=%f max=%f", engineConfiguration->baroSensor.valueAt0, + engineConfiguration->baroSensor.valueAt5); + } } #endif /* EFI_ANALOG_SENSORS */ }