Skip to content

Commit

Permalink
GM ignition: remove signal with noise and false positives (#845)
Browse files Browse the repository at this point in the history
  • Loading branch information
sshane authored Feb 3, 2022
1 parent c89c8db commit 2d96ef0
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions board/drivers/can_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ extern int can_silent;

// Ignition detected from CAN meessages
bool ignition_can = false;
bool ignition_cadillac = false;
uint32_t ignition_can_cnt = 0U;

#define ALL_CAN_SILENT 0xFF
Expand Down Expand Up @@ -197,16 +196,9 @@ void ignition_can_hook(CANPacket_t *to_push) {

if (bus == 0) {
// GM exception
// TODO: verify on all supported GM models that we can reliably detect ignition using only this signal,
// since the 0x1F1 signal can briefly go low immediately after ignition
if ((addr == 0x160) && (len == 5)) {
// this message isn't all zeros when ignition is on
ignition_cadillac = GET_BYTES_04(to_push) != 0U;
}
if ((addr == 0x1F1) && (len == 8)) {
// Bit 5 is ignition "on"
bool ignition_gm = ((GET_BYTE(to_push, 0) & 0x20U) != 0U);
ignition_can = ignition_gm || ignition_cadillac;
ignition_can = GET_BYTES_04(to_push) != 0U;
}

// Tesla exception
Expand Down

0 comments on commit 2d96ef0

Please sign in to comment.