Skip to content

Commit

Permalink
Toyota Safety: cleaned up logic for TSSP2.0 cars
Browse files Browse the repository at this point in the history
  • Loading branch information
rbiasini committed May 6, 2019
1 parent b53fb27 commit 005e131
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions board/safety/safety_toyota.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,10 @@ static int toyota_fwd_hook(int bus_num, CAN_FIFOMailBox_TypeDef *to_fwd) {
// don't forward when switch 1 is high
if ((bus_num == 0 || bus_num == 2) && toyota_camera_forwarded && !toyota_giraffe_switch_1) {
int addr = to_fwd->RIR>>21;
bool is_lkas_msg = (addr == 0x2E4 || addr == 0x412 || addr == 0x343) && bus_num == 2;
return is_lkas_msg? -1 : (uint8_t)(~bus_num & 0x2);
bool is_lkas_msg = (addr == 0x2E4 || addr == 0x412) && bus_num == 2;
// in TSSP 2.0 the camera does ACC as well, so filter 0x343
bool is_acc_msg = (addr == 0x343 && bus_num == 2);
return (is_lkas_msg || is_acc_msg)? -1 : (uint8_t)(~bus_num & 0x2);
}
return -1;
}
Expand Down

0 comments on commit 005e131

Please sign in to comment.