Sensor Processing
Multi-stage sensor validation: range, rate, stuck-at, and plausibility.
Header: core/ecu_sensor.h
-
SENSOR_FAULT_NONE
No fault detected.
-
SENSOR_FAULT_RANGE
Value outside valid range.
-
SENSOR_FAULT_RATE
Rate-of-change limit exceeded.
-
SENSOR_FAULT_STUCK
Value stuck (unchanging).
-
SENSOR_FAULT_PLAUSIBLE
Cross-check plausibility failure.
-
void ecu_sensor_init(ecu_sensor_state_t *state)
Initialise sensor state.
- Parameters:
state – [out] Sensor state to initialise.
-
ecu_sensor_reading_t ecu_sensor_validate(float raw, const ecu_sensor_config_t *cfg, ecu_sensor_state_t *state)
Validate a raw sensor reading.
Applies range, rate-of-change, and stuck-at checks.
- Parameters:
raw – [in] Raw sensor value.
cfg – [in] Validation configuration.
state – [inout] Sensor state (updated in place).
- Returns:
Processed reading with validity and fault flags.
-
bool ecu_sensor_egt_plausible(float egt, float rpm, float rpm_idle)
Cross-check EGT plausibility against RPM.
- Parameters:
egt – [in] Exhaust gas temperature (deg C).
rpm – [in] Current shaft RPM.
rpm_idle – [in] Idle RPM threshold.
- Returns:
trueif the EGT is plausible for the given RPM.
-
struct ecu_sensor_reading_t
- #include <ecu_sensor.h>
Processed sensor reading with validation result.
-
struct ecu_sensor_config_t
- #include <ecu_sensor.h>
Per-sensor validation configuration.
-
struct ecu_sensor_state_t
- #include <ecu_sensor.h>
Per-sensor runtime state (history for stuck detection).