From b265ecf7d8bf48b881d5911d748635f4c7fe59d3 Mon Sep 17 00:00:00 2001 From: Martin Lillepuu Date: Tue, 29 Aug 2023 16:18:08 +0300 Subject: [PATCH] Add brake_status feedback msg --- board/safety/safety_subaru.h | 6 +++++- tests/safety/test_subaru.py | 3 ++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/board/safety/safety_subaru.h b/board/safety/safety_subaru.h index 9d31ff6ed4..2b5a67837a 100644 --- a/board/safety/safety_subaru.h +++ b/board/safety/safety_subaru.h @@ -53,6 +53,7 @@ const LongitudinalLimits SUBARU_LONG_LIMITS = { #define SUBARU_COMMON_LONG_TX_MSGS(alt_bus) \ {MSG_SUBARU_ES_Brake, SUBARU_MAIN_BUS, 8}, \ {MSG_SUBARU_ES_Status, SUBARU_MAIN_BUS, 8}, \ + {MSG_SUBARU_Brake_Status, SUBARU_CAM_BUS, 8}, \ #define SUBARU_COMMON_ADDR_CHECKS(alt_bus) \ {.msg = {{MSG_SUBARU_Throttle, SUBARU_MAIN_BUS, 8, .check_checksum = true, .max_counter = 15U, .expected_timestep = 10000U}, { 0 }, { 0 }}}, \ @@ -229,7 +230,10 @@ static int subaru_fwd_hook(int bus_num, int addr) { int bus_fwd = -1; if (bus_num == SUBARU_MAIN_BUS) { - bus_fwd = SUBARU_CAM_BUS; // to the eyesight camera + bool block_msg = subaru_longitudinal && (addr == MSG_SUBARU_Brake_Status); + if (!block_msg) { + bus_fwd = SUBARU_CAM_BUS; // to the eyesight camera + } } if (bus_num == SUBARU_CAM_BUS) { diff --git a/tests/safety/test_subaru.py b/tests/safety/test_subaru.py index 9131322c1a..1ded1b8bff 100755 --- a/tests/safety/test_subaru.py +++ b/tests/safety/test_subaru.py @@ -35,7 +35,8 @@ def lkas_tx_msgs(alt_bus, lkas_msg=MSG_SUBARU_ES_LKAS): def long_tx_msgs(): return [[MSG_SUBARU_ES_Brake, SUBARU_MAIN_BUS], - [MSG_SUBARU_ES_Status, SUBARU_MAIN_BUS]] + [MSG_SUBARU_ES_Status, SUBARU_MAIN_BUS], + [MSG_SUBARU_Brake_Status, SUBARU_CAM_BUS]] def fwd_blacklisted_addr(lkas_msg=MSG_SUBARU_ES_LKAS): return {SUBARU_CAM_BUS: [lkas_msg, MSG_SUBARU_ES_DashStatus, MSG_SUBARU_ES_LKAS_State, MSG_SUBARU_ES_Infotainment]}