4#if EFI_CAN_SUPPORT || EFI_UNIT_TEST
6#include "wideband_firmware/for_rusefi/wideband_can.h"
20 , m_sensorIndex(sensorIndex)
57 if (
type == DISABLED) {
62 if ((!CAN_ISX(frame)) && (
type == RUSEFI)) {
65 return ((CAN_SID(frame) == rusefiBaseId) || (CAN_SID(frame) == rusefiBaseId + 1));
69 if ((CAN_ISX(frame)) && (
type == AEM)) {
72 return (CAN_EID(frame) == aemXSeriesId);
100 }
else if (
type == AEM) {
113 static_cast<uint8_t
>(wbo::Status::RunningClosedLoop) :
114 static_cast<uint8_t
>(wbo::Status::Warmup);
130 stateCode =
static_cast<uint8_t
>(wbo::Status::CanSilent);
134 bool accepted =
false;
138 uint32_t
id = CAN_ID(frame);
141 if ((
id & 0x1) != 0) {
170 float lambdaFloat = 0.0001f * lambdaInt;
188 auto data =
reinterpret_cast<const wbo::StandardData*
>(&frame.
data8[0]);
190 if (data->Version > RUSEFI_WIDEBAND_VERSION) {
197 if (data->Version < RUSEFI_WIDEBAND_VERSION_MIN) {
206 fwOutdated = (data->Version != RUSEFI_WIDEBAND_VERSION);
209 tempC = data->TemperatureC;
210 float lambda = 0.0001f * data->Lambda;
245 auto data =
reinterpret_cast<const wbo::DiagData*
>(&frame.
data8[0]);
265 if ((isStatusError(
static_cast<wbo::Status
>(data->status))) &&
isHeaterAllowed()) {
static constexpr uint32_t aem_base
static constexpr uint32_t rusefi_base
static constexpr efidur_t sensor_timeout
void decodeRusefiDiag(const CANRxFrame &frame)
bool acceptFrame(const size_t busIndex, const CANRxFrame &frame) const override final
void refreshSmoothedLambda(float lambda)
bool decodeRusefiStandard(const CANRxFrame &frame, efitick_t nowNt)
can_wbo_type_e sensorType() const
uint32_t getAemCanId() const
AemXSeriesWideband(uint8_t sensorIndex, SensorType type)
uint32_t getReCanId() const
bool decodeAemXSeries(const CANRxFrame &frame, efitick_t nowNt)
const uint8_t m_sensorIndex
void decodeFrame(const CANRxFrame &frame, efitick_t nowNt) override
void setSmoothingFactor(float p_smoothingFactor)
float initOrAverage(float value)
void setValidValue(float value, efitick_t timestamp)
uint16_t SWAP_UINT16(uint16_t x)
StoredValueSensor smoothedLambda2Sensor(SensorType::SmoothedLambda2, MS2NT(500))
ExpAverage expAverageLambda2
StoredValueSensor smoothedLambda1Sensor(SensorType::SmoothedLambda1, MS2NT(500))
ExpAverage expAverageLambda1
static EngineAccessor engine
static constexpr engine_configuration_s * engineConfiguration
bool warning(ObdCode code, const char *fmt,...)
void firmwareError(ObdCode code, const char *fmt,...)
uint8_t data8[8]
Frame data.
uint16_t data16[4]
Frame data.
wbo_s canWbo[CAN_WBO_COUNT]
bool heaterControlEnabled
scaled_channel< uint16_t, 1000, 1 > nernstVoltage