From 2253dd3c48e21abb82fe161d6f58237490111206 Mon Sep 17 00:00:00 2001 From: George Hotz Date: Fri, 13 Apr 2018 20:11:01 +0000 Subject: [PATCH] fix volt ign detect --- board/main.c | 2 +- board/safety/safety_gm.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/board/main.c b/board/main.c index 671641afe47a8e..a15861a17e5c82 100644 --- a/board/main.c +++ b/board/main.c @@ -110,7 +110,7 @@ int get_health_pkt(void *dat) { health->started = (GPIOA->IDR & (1 << 1)) == 0; } else { //Current safety hooks want to determine ignition (ex: GM) - health-> started = safety_ignition; + health->started = safety_ignition; } #else health->current = 0; diff --git a/board/safety/safety_gm.h b/board/safety/safety_gm.h index 40fc14d54c8536..03c36d6255dcbf 100644 --- a/board/safety/safety_gm.h +++ b/board/safety/safety_gm.h @@ -19,6 +19,7 @@ int gm_ascm_detected = 0; int gm_ignition_started = 0; static void gm_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { + int bus_number = (to_push->RDTR >> 4) & 0xFF; uint32_t addr; if (to_push->RIR & 4) { // Extended @@ -30,7 +31,7 @@ static void gm_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { addr = to_push->RIR >> 21; } - if (addr == 0x135) { + 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." @@ -43,7 +44,6 @@ static void gm_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) { } // check if stock ASCM ECU is still online - int bus_number = (to_push->RDTR >> 4) & 0xFF; if (bus_number == 0 && addr == 715) { gm_ascm_detected = 1; controls_allowed = 0;