From 005e131049f5fe5fb778fb8738ebdd32878107fc Mon Sep 17 00:00:00 2001 From: Riccardo Date: Sun, 5 May 2019 20:29:56 -0700 Subject: [PATCH] Toyota Safety: cleaned up logic for TSSP2.0 cars --- board/safety/safety_toyota.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/board/safety/safety_toyota.h b/board/safety/safety_toyota.h index 27293e7ebc7f96..cbc83860875fde 100644 --- a/board/safety/safety_toyota.h +++ b/board/safety/safety_toyota.h @@ -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; }