Skip to content

Commit

Permalink
GM: using real ignition logic. Creedit to Jamezz
Browse files Browse the repository at this point in the history
  • Loading branch information
rbiasini committed Jun 3, 2018
1 parent 8fa507b commit 293fd1a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions board/safety/safety_gm.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 293fd1a

Please sign in to comment.