mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-02-18 21:03:52 +08:00
Fix possible CAN ignition overlap due to incorrect counter tracking
https://github.com/commaai/openpilot/pull/35019
This commit is contained in:
@@ -166,9 +166,6 @@ void ignition_can_hook(CANPacket_t *to_push) {
|
||||
int addr = GET_ADDR(to_push);
|
||||
int len = GET_LEN(to_push);
|
||||
|
||||
// Check counter position on cars with overlap
|
||||
static int prev_counter = -1;
|
||||
|
||||
// GM exception
|
||||
if ((addr == 0x1F1) && (len == 8)) {
|
||||
// SystemPowerMode (2=Run, 3=Crank Request)
|
||||
@@ -181,6 +178,7 @@ void ignition_can_hook(CANPacket_t *to_push) {
|
||||
// 0x152 overlaps with Subaru pre-global which has this bit as the high beam
|
||||
int counter = GET_BYTE(to_push, 1) & 0xFU; // max is only 14
|
||||
|
||||
static int prev_counter = -1;
|
||||
if ((counter == ((prev_counter + 1) % 15)) && (prev_counter != -1)) {
|
||||
// VDM_OutputSignals->VDM_EpasPowerMode
|
||||
ignition_can = ((GET_BYTE(to_push, 7) >> 4U) & 0x3U) == 1U; // VDM_EpasPowerMode_Drive_On=1
|
||||
@@ -194,6 +192,7 @@ void ignition_can_hook(CANPacket_t *to_push) {
|
||||
// 0x221 overlaps with Rivian which has random data on byte 0
|
||||
int counter = GET_BYTE(to_push, 6) >> 4;
|
||||
|
||||
static int prev_counter = -1;
|
||||
if ((counter == ((prev_counter + 1) % 16)) && (prev_counter != -1)) {
|
||||
// VCFRONT_LVPowerState->VCFRONT_vehiclePowerState
|
||||
int power_state = (GET_BYTE(to_push, 0) >> 5U) & 0x3U;
|
||||
|
||||
Reference in New Issue
Block a user