Skip to content

Commit

Permalink
fix volt ign detect
Browse files Browse the repository at this point in the history
  • Loading branch information
geohot committed Apr 13, 2018
1 parent 3b299d7 commit 2253dd3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion board/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions board/safety/safety_gm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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."
Expand All @@ -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;
Expand Down

0 comments on commit 2253dd3

Please sign in to comment.