rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
AemXSeriesLambda.h
Go to the documentation of this file.
1// file AemXSeriesLambda.h
2
3#pragma once
4
5#include "can_sensor.h"
6
8
9// Following codes "extend" wbo::Fault codes
10#define HACK_INVALID_AEM 8
11
12// todo: static_cast<uint8_t>(Fault::LegacyProtocol);
13
14#define RUSEFI_WIDEBAND_VERSION_MIN 0xA0
15
17public:
18 AemXSeriesWideband(uint8_t sensorIndex, SensorType type);
19
20 bool acceptFrame(const size_t busIndex, const CANRxFrame& frame) const override final;
21
22 void refreshState(void);
23
24 void refreshSmoothedLambda(float lambda);
25
26 bool hasSeenRx = false;
27
28protected:
29 // Dispatches to one of the three decoders below
30 void decodeFrame(const CANRxFrame& frame, efitick_t nowNt) override;
31
32 // Decode an actual AEM controller, or a rusEFI controller sending AEM format
33 bool decodeAemXSeries(const CANRxFrame& frame, efitick_t nowNt);
34
35 // Decode rusEFI custom format
36 bool decodeRusefiStandard(const CANRxFrame& frame, efitick_t nowNt);
37 void decodeRusefiDiag(const CANRxFrame& frame);
38
39private:
41 uint32_t getReCanId() const;
42 uint32_t getAemCanId() const;
43 bool isHeaterAllowed();
44
45 const uint8_t m_sensorIndex;
46 // raw fault code from sensor
47 uint8_t m_stateCode;
48 // Used by both AEM and rusEFI WBO
50 // Used for AEM sensor only
52 // Last valid packed received, for wbo::Fault::CanSilent state
53 efitick_t m_lastUpdate = 0;
54};
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
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
SensorType type() const
Definition sensor.h:166
can_wbo_type_e
SensorType
Definition sensor_type.h:18