Skip to content

Commit

Permalink
Add brake_status feedback msg
Browse files Browse the repository at this point in the history
  • Loading branch information
martinl committed Aug 29, 2023
1 parent ca9d867 commit b265ecf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
6 changes: 5 additions & 1 deletion board/safety/safety_subaru.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}}, \
Expand Down Expand Up @@ -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) {
Expand Down
3 changes: 2 additions & 1 deletion tests/safety/test_subaru.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]}
Expand Down

0 comments on commit b265ecf

Please sign in to comment.