From 293fd1ac70250a09b511cc8af99aa7f260d586ef Mon Sep 17 00:00:00 2001 From: Riccardo Date: Sat, 2 Jun 2018 19:08:10 -0700 Subject: [PATCH] GM: using real ignition logic. Creedit to Jamezz --- board/safety/safety_gm.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/board/safety/safety_gm.h b/board/safety/safety_gm.h index 12c7027a30f4b9..4d213ce67e0d73 100644 --- a/board/safety/safety_gm.h +++ b/board/safety/safety_gm.h @@ -31,10 +31,11 @@ static void gm_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { addr = to_push->RIR >> 21; } - if (addr == 0x135 && bus_number == 0) { - //Gear selector (used for determining ignition) - int gear = to_push->RDLR & 0x7; - gm_ignition_started = gear > 0; //Park = 0. If out of park, we're "on." + if (addr == 0x1f1 && bus_number == 0) { + //Bit 5 should be ignition "on" + //Backup plan is Bit 2 (accessory power) + uint32_t ign = (to_push->RDLR) & 0x20; + gm_ignition_started = ign > 0; } // sample speed, really only care if car is moving or not