poor usability when AEM reports error [was AEM Wideband alive on CAN, but nothing on TS.] #7011

This commit is contained in:
rusefillc 2024-11-03 11:46:45 -05:00
parent c1ac837efb
commit bb4564df82
3 changed files with 18 additions and 10 deletions

View File

@ -11,6 +11,9 @@ static constexpr uint32_t rusefi_base = WB_DATA_BASE_ADDR;
#define HACK_SILENT_VALUE 1
// todo: suggest values 1 and 2 into the official WB source fault enum?
#define HACK_CRANKING_VALUE 2
// todo: static_cast<uint8_t>(Fault::LegacyProtocol);
#define HACK_VALID_AEM 7
#define HACK_INVALID_AEM 8
AemXSeriesWideband::AemXSeriesWideband(uint8_t sensorIndex, SensorType type)
: CanSensorBase(
@ -57,8 +60,8 @@ void AemXSeriesWideband::decodeFrame(const CANRxFrame& frame, efitick_t nowNt) {
// accept frame has already guaranteed that this message belongs to us
// We just have to check if it's AEM or rusEFI
if (id < rusefi_base) {
decodeAemXSeries(frame, nowNt);
faultCode = 7;//static_cast<uint8_t>(Fault::LegacyProtocol);
bool isValidAemX = decodeAemXSeries(frame, nowNt);
faultCode = isValidAemX ? HACK_VALID_AEM : HACK_INVALID_AEM;
} else {
// rusEFI custom format
if ((id & 0x1) != 0) {
@ -71,7 +74,10 @@ void AemXSeriesWideband::decodeFrame(const CANRxFrame& frame, efitick_t nowNt) {
}
}
void AemXSeriesWideband::decodeAemXSeries(const CANRxFrame& frame, efitick_t nowNt) {
/**
* @return true if valid, false if invalid
*/
bool AemXSeriesWideband::decodeAemXSeries(const CANRxFrame& frame, efitick_t nowNt) {
// reports in 0.0001 lambda per LSB
uint16_t lambdaInt = SWAP_UINT16(frame.data16[0]);
float lambdaFloat = 0.0001f * lambdaInt;
@ -80,17 +86,18 @@ void AemXSeriesWideband::decodeAemXSeries(const CANRxFrame& frame, efitick_t now
bool sensorFault = frame.data8[7] & 0x40;
if (sensorFault) {
invalidate();
return;
return false;
}
// bit 7 indicates valid
bool valid = frame.data8[6] & 0x80;
if (!valid) {
invalidate();
return;
return false;
}
setValidValue(lambdaFloat, nowNt);
return true;
}
void AemXSeriesWideband::decodeRusefiStandard(const CANRxFrame& frame, efitick_t nowNt) {

View File

@ -17,7 +17,7 @@ protected:
void decodeFrame(const CANRxFrame& frame, efitick_t nowNt) override;
// Decode an actual AEM controller, or a rusEFI controller sending AEM format
void decodeAemXSeries(const CANRxFrame& frame, efitick_t nowNt);
bool decodeAemXSeries(const CANRxFrame& frame, efitick_t nowNt);
// Decode rusEFI custom format
void decodeRusefiStandard(const CANRxFrame& frame, efitick_t nowNt);

View File

@ -3574,13 +3574,14 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_
dialog = egoSettings_IO2, "O2 Sensor 2 I/O"
field = "Input channel", afr_hwChannel2
indicatorPanel = uegoCan0Indicators, 1, { enableAemXSeries == 1 }
indicatorPanel = uegoCan0Indicators, 1, { enableAemXSeries == 1 && (faultCode0 == 7 || faultCode0 == 8) }
indicator = { faultCode0 == 7 }, "RusEFI WBO", "AEM Gauge", green, black, yellow, black
indicator = { faultCode0 == 8 }, "AEM OK", "AEM ERROR", green, black, yellow, black
indicatorPanel = uegoCan1Indicators, 1, { enableAemXSeries == 1 }
indicatorPanel = uegoCan1Indicators, 1, { enableAemXSeries == 1 && (faultCode0 == 7 || faultCode0 == 8) }
indicator = { faultCode1 == 7 }, "RusEFI WBO", "AEM Gauge", green, black, yellow, black
indicatorPanel = uegoCan0IndicatorsExt, 1, { enableAemXSeries == 1 && faultCode0 != 7 }
indicatorPanel = uegoCan0IndicatorsExt, 1, { enableAemXSeries == 1 && faultCode0 != 7 && faultCode0 != 8 }
indicator = { faultCode0 == 0 || faultCode0 == 7 }, "Failed", "Ready/Ok", red, black, green, black
indicator = { faultCode0 == 2 }, "Heating allowed", "Heating prohibited", green, black, yellow, black
indicator = { faultCode0 == 1 }, "Communication ok", "Timeout reading", green, black, red, black
@ -3589,7 +3590,7 @@ cmd_set_engine_type_default = "@@TS_IO_TEST_COMMAND_char@@@@ts_command_e_TS_
indicator = { faultCode0 == 5 }, "No underheat", "Underheat", green, black, red, black
indicator = { faultCode0 == 6 }, "Heater supply ok", "No heater supply", green, black, yellow, black
indicatorPanel = uegoCan1IndicatorsExt, 1, { enableAemXSeries == 1 && faultCode1 != 7 }
indicatorPanel = uegoCan1IndicatorsExt, 1, { enableAemXSeries == 1 && faultCode1 != 7 && faultCode0 != 8 }
indicator = { faultCode1 == 0 || faultCode1 == 7 }, "Failed", "Ready/Ok", red, black, green, black
indicator = { faultCode1 == 2 }, "Heating allowed", "Heating prohibited", green, black, yellow, black
indicator = { faultCode1 == 1 }, "Communication ok", "Timeout reading", green, black, red, black