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);
86 faultCode =
static_cast<uint8_t
>(wbo::Fault::CanSilent);
94 faultCode =
static_cast<uint8_t
>(wbo::Fault::NotAllowed);
101 if (
m_faultCode !=
static_cast<uint8_t
>(wbo::Fault::None)) {
107 }
else if (
type == AEM) {
131 faultCode =
static_cast<uint8_t
>(wbo::Fault::None);
135 bool accepted =
false;
139 uint32_t
id = CAN_ID(frame);
142 if ((
id & 0x1) != 0) {
171 float lambdaFloat = 0.0001f * lambdaInt;
189 auto data =
reinterpret_cast<const wbo::StandardData*
>(&frame.
data8[0]);
191 if (data->Version > RUSEFI_WIDEBAND_VERSION) {
198 if (data->Version < RUSEFI_WIDEBAND_VERSION_MIN) {
207 fwOutdated = (data->Version != RUSEFI_WIDEBAND_VERSION);
210 tempC = data->TemperatureC;
211 float lambda = 0.0001f * data->Lambda;
246 auto data =
reinterpret_cast<const wbo::DiagData*
>(&frame.
data8[0]);
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