Skip to content

Commit

Permalink
Hyundai safety: 593 also needs ot be modified
Browse files Browse the repository at this point in the history
  • Loading branch information
rbiasini committed Aug 18, 2018
1 parent 594863c commit c2a0853
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions board/safety/safety_hyundai.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ int hyundai_giraffe_switch_1 = 0; // is giraffe switch 1 high?
static void hyundai_rx_hook(CAN_FIFOMailBox_TypeDef *to_push) {

int bus = (to_push->RDTR >> 4) & 0xF;
// 832 is lkas cmd. If it is on bus 0, then giraffe switch 1 is high
// 832 is lkas cmd. If it is on bus 0, then giraffe switch 1 is high and we want stock
if ((to_push->RIR>>21) == 832 && (bus == 0)) {
hyundai_giraffe_switch_1 = 1;
}
Expand All @@ -17,10 +17,10 @@ static void hyundai_init(int16_t param) {

static int hyundai_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {

// forward cam to radar and viceversa if car is dsu-less, except lkas cmd and hud
// forward camera to car and viceversa, excpet for lkas11 and mdps12
if ((bus_num == 0 || bus_num == 2) && !hyundai_giraffe_switch_1) {
int addr = to_fwd->RIR>>21;
bool is_lkas_msg = (addr == 832 || addr == 1342) && bus_num == 2;
bool is_lkas_msg = (addr == 832 && bus_num == 2) || (addr == 593 && bus_num == 0);
return is_lkas_msg? -1 : (uint8_t)(~bus_num & 0x2);
}
return -1;
Expand Down

0 comments on commit c2a0853

Please sign in to comment.