feat: adds AEM 30-0300 X-Series UEGO wideband over CAN support (#1238)

* feat: adds AEM 30-0300 X-Series UEGO wideband over CAN support

Signed-off-by: wilmardo <info@wilmardenouden.nl>

* fix: add else around setting currentStatus.02

Signed-off-by: wilmardo <info@wilmardenouden.nl>

* refactor: only do the division once for AEM wideband data

Signed-off-by: wilmardo <info@wilmardenouden.nl>

---------

Signed-off-by: wilmardo <info@wilmardenouden.nl>
This commit is contained in:
Wilmar den Ouden 2024-08-22 22:57:29 +02:00 committed by GitHub
parent b99aa15a94
commit 50b91c7ae7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 3 deletions

View File

@ -477,7 +477,7 @@ page = 1
unused0_126 = bits, U08, 126, [0:2]
;These are reserved for future use, in case of more CAN broadcasting features are added
canWBO = bits, U08, 126, [2:3], "Off", "rusEFI WBO", "INVALID", "INVALID"
canWBO = bits, U08, 126, [2:3], "Off", "rusEFI WBO", "AEM", "INVALID"
vssAuxCh = bits, U08, 126, [4:7], "Aux0", "Aux1", "Aux2", "Aux3", "Aux4", "Aux5", "Aux6", "Aux7", "Aux8", "Aux9", "Aux10", "Aux11", "Aux12", "Aux13", "Aux14", "Aux15"
decelAmount = scalar, U08, 127, "%", 1.0, 0.0, 0.0, 150.0, 0

View File

@ -127,8 +127,7 @@ void sendCANBroadcast(uint8_t frequency)
void receiveCANwbo()
{
// Currently only RusEFI CAN Wideband supported: https://github.com/mck1117/wideband
if(configPage2.canWBO == CAN_WBO_RUSEFI)
if(configPage2.canWBO == CAN_WBO_RUSEFI) //RusEFI CAN Wideband supported: https://github.com/mck1117/wideband
{
outMsg.id = 0xEF50000;
outMsg.flags.extended = 1;
@ -162,6 +161,20 @@ void receiveCANwbo()
}
}
}
else if(configPage2.canWBO == CAN_WBO_AEM) //AEM 30-0300 X-Series UEGO Gauge
{
if(inMsg.id == 0x180) //AEM wideband default ID1 message id
{
uint32_t inLambda;
inLambda = (word(inMsg.buf[0], inMsg.buf[1])); //Combining 2 bytes of data into single variable factor is 0.0001 so lambda 1 comes in as 10K
if(BIT_CHECK(inMsg.buf[6], 7)) //Checking if lambda is valid
{
inLambda = (inLambda * configPage2.stoich) / 10000; //Multiplying lambda by stoich ratio to get AFR and dividing it by 10000 to get correct value
if (inLambda > 250) { currentStatus.O2 = 250; } //Check if we don't overflow the 8bit O2 variable
else { currentStatus.O2 = inLambda & 0xFF; }
}
}
}
}
// All supported definitions/protocols for CAN Dash broadcasts

View File

@ -30,6 +30,7 @@
#define CAN_WBO_RUSEFI 1
#define CAN_WBO_AEM 2
#define TS_CAN_OFFSET 0x100