From 02e1b494378de2c72bb3527c1bf16226df250ab0 Mon Sep 17 00:00:00 2001 From: Jason Wen Date: Tue, 6 Jun 2023 13:47:55 -0400 Subject: [PATCH] Revert "Revert "Reset CAN ign when the specific message is not seen anymore (#1200)"" This reverts commit 0e480954359e6d4398e0a092370327c4cb2dceaf. --- board/drivers/can_common.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/board/drivers/can_common.h b/board/drivers/can_common.h index a3e195fd64..be6b5b2a5d 100644 --- a/board/drivers/can_common.h +++ b/board/drivers/can_common.h @@ -195,24 +195,25 @@ void ignition_can_hook(CANPacket_t *to_push) { int addr = GET_ADDR(to_push); int len = GET_LEN(to_push); - ignition_can_cnt = 0U; // reset counter - if (bus == 0) { // GM exception if ((addr == 0x160) && (len == 5)) { // this message isn't all zeros when ignition is on ignition_can = GET_BYTES(to_push, 0, 4) != 0U; + ignition_can_cnt = 0U; } // Tesla exception if ((addr == 0x348) && (len == 8)) { // GTW_status ignition_can = (GET_BYTE(to_push, 0) & 0x1U) != 0U; + ignition_can_cnt = 0U; } // Mazda exception if ((addr == 0x9E) && (len == 8)) { ignition_can = (GET_BYTE(to_push, 0) >> 5) == 0x6U; + ignition_can_cnt = 0U; } }