diff --git a/firmware/console/status_loop.cpp b/firmware/console/status_loop.cpp index 57afa400b8..d1af2c6559 100644 --- a/firmware/console/status_loop.cpp +++ b/firmware/console/status_loop.cpp @@ -209,7 +209,7 @@ static void printSensors(Logging *log, bool fileFormat) { } #endif /* EFI_ANALOG_SENSORS */ - if (hasAftSensor(PASS_ENGINE_PARAMETER_F)) { + if (hasAfrSensor(PASS_ENGINE_PARAMETER_F)) { reportSensorF(log, fileFormat, "afr", "AFR", getAfr(PASS_ENGINE_PARAMETER_F), 2); } diff --git a/firmware/controllers/algo/obd_error_codes.h b/firmware/controllers/algo/obd_error_codes.h index a930322074..aea97f62e7 100644 --- a/firmware/controllers/algo/obd_error_codes.h +++ b/firmware/controllers/algo/obd_error_codes.h @@ -144,7 +144,7 @@ typedef enum { //P0118 Engine Coolant Temperature Circuit High Input //P0119 Engine Coolant Temperature Circuit Intermittent OBD_Throttle_Position_Sensor_Circuit_Malfunction = 120, - //P0121 Throttle Position Sensor/Switch A Circuit Range/Performance Problem + OBD_Throttle_Position_Sensor_Range_Performance_Problem = 121, //P0122 Throttle Position Sensor/Switch A Circuit Low Input //P0123 Throttle Position Sensor/Switch A Circuit High Input //P0124 Throttle Position Sensor/Switch A Circuit Intermittent diff --git a/firmware/controllers/core/fsio_core.h b/firmware/controllers/core/fsio_core.h index 3cb1ec02b8..f27404a9ce 100644 --- a/firmware/controllers/core/fsio_core.h +++ b/firmware/controllers/core/fsio_core.h @@ -50,6 +50,8 @@ typedef enum { LE_METHOD_SELF = 114, LE_METHOD_MAP = 115, LE_METHOD_FSIO_ANALOG_INPUT = 116, + LE_METHOD_INTAKE_VVT = 117, + LE_METHOD_EXHAUST_VVT = 118, Force_4b_le_action = ENUM_32_BITS, diff --git a/firmware/controllers/core/fsio_impl.cpp b/firmware/controllers/core/fsio_impl.cpp index 785b9a37f2..deaf0d91de 100644 --- a/firmware/controllers/core/fsio_impl.cpp +++ b/firmware/controllers/core/fsio_impl.cpp @@ -41,6 +41,8 @@ static LENameOrdinalPair leFsioSetting(LE_METHOD_FSIO_SETTING, "fsio_setting"); static LENameOrdinalPair leFsioTable(LE_METHOD_FSIO_TABLE, "fsio_table"); static LENameOrdinalPair leFsioAnalogInput(LE_METHOD_FSIO_ANALOG_INPUT, "fsio_input"); static LENameOrdinalPair leKnock(LE_METHOD_KNOCK, "knock"); +static LENameOrdinalPair leIntakeVVT(LE_METHOD_INTAKE_VVT, "ivvt"); +static LENameOrdinalPair leExhaustVVT(LE_METHOD_EXHAUST_VVT, "evvt"); #define LE_EVAL_POOL_SIZE 32 @@ -89,6 +91,9 @@ float getLEValue(Engine *engine, calc_stack_t *s, le_action_e action) { return getMaf(PASS_ENGINE_PARAMETER_F); case LE_METHOD_MAP: return getMap(); + case LE_METHOD_INTAKE_VVT: + case LE_METHOD_EXHAUST_VVT: + return engine->triggerCentral.vvtPosition; case LE_METHOD_TIME_SINCE_BOOT: return getTimeNowSeconds(); case LE_METHOD_FAN_OFF_SETTING: diff --git a/firmware/controllers/sensors/ego.cpp b/firmware/controllers/sensors/ego.cpp index f85875eac9..fe2b0297fa 100644 --- a/firmware/controllers/sensors/ego.cpp +++ b/firmware/controllers/sensors/ego.cpp @@ -8,7 +8,7 @@ EXTERN_ENGINE; -bool hasAftSensor(DECLARE_ENGINE_PARAMETER_F) { +bool hasAfrSensor(DECLARE_ENGINE_PARAMETER_F) { return engineConfiguration->afr.hwChannel != EFI_ADC_NONE; } diff --git a/firmware/controllers/sensors/ego.h b/firmware/controllers/sensors/ego.h index 7bf586fb33..e22746a3c4 100644 --- a/firmware/controllers/sensors/ego.h +++ b/firmware/controllers/sensors/ego.h @@ -15,7 +15,7 @@ #include "engine_configuration.h" float getAfr(DECLARE_ENGINE_PARAMETER_F); -bool hasAftSensor(DECLARE_ENGINE_PARAMETER_F); +bool hasAfrSensor(DECLARE_ENGINE_PARAMETER_F); void setEgoSensor(ego_sensor_e type DECLARE_ENGINE_PARAMETER_S); #endif diff --git a/firmware/controllers/sensors/tps.cpp b/firmware/controllers/sensors/tps.cpp index c89760b749..3c7f813af0 100644 --- a/firmware/controllers/sensors/tps.cpp +++ b/firmware/controllers/sensors/tps.cpp @@ -63,6 +63,13 @@ percent_t getTpsValue(int adc DECLARE_ENGINE_PARAMETER_S) { return NAN; } float result = interpolate(TPS_TS_CONVERSION * engineConfiguration->tpsMax, 100, TPS_TS_CONVERSION * engineConfiguration->tpsMin, 0, adc); + if (result < engineConfiguration->tpsErrorDetectionTooLow) { + warning(OBD_Throttle_Position_Sensor_Circuit_Malfunction, "TPS too low: %f", result); + } + if (result > engineConfiguration->tpsErrorDetectionTooHigh) { + warning(OBD_Throttle_Position_Sensor_Range_Performance_Problem, "TPS too high: %f", result); + } + // this would put the value into the 0-100 range return maxF(0, minF(100, result)); } diff --git a/firmware/rusefi.cpp b/firmware/rusefi.cpp index 0bac4adc0a..fff793d49c 100644 --- a/firmware/rusefi.cpp +++ b/firmware/rusefi.cpp @@ -281,7 +281,7 @@ void firmwareError(obd_code_e code, const char *errorMsg, ...) { } } -static char UNUSED_RAM_SIZE[1200]; +static char UNUSED_RAM_SIZE[1100]; static char UNUSED_CCM_SIZE[26500] CCM_OPTIONAL;