Skip to content

Commit

Permalink
GM: passive on LKA-only cars (#135)
Browse files Browse the repository at this point in the history
If LKA camera is still connected to powertrain.
  • Loading branch information
vntarasov authored and rbiasini committed Sep 6, 2018
1 parent 01b5235 commit 53aef76
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions board/safety/safety_gm.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const int GM_MAX_BRAKE = 350;
int gm_brake_prev = 0;
int gm_gas_prev = 0;
int gm_speed = 0;
// silence everything if stock ECUs are still online
// silence everything if stock car control ECUs are still online
int gm_ascm_detected = 0;
int gm_ignition_started = 0;
int gm_rt_torque_last = 0;
Expand Down Expand Up @@ -63,8 +63,11 @@ static void gm_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {
gm_speed = to_push->RDLR & 0xFFFF;
}

// check if stock ASCM ECU is still online
if (bus_number == 0 && addr == 715) {
// Check if ASCM or LKA camera are online
// on powertrain bus.
// 384 = ASCMLKASteeringCmd
// 715 = ASCMGasRegenCmd
if (bus_number == 0 && (addr == 384 || addr == 715)) {
gm_ascm_detected = 1;
controls_allowed = 0;
}
Expand Down

0 comments on commit 53aef76

Please sign in to comment.