Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
jnewb1 committed Jul 20, 2023
1 parent 80d986d commit ddbc87d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
8 changes: 4 additions & 4 deletions board/safety/safety_subaru.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ const SteeringLimits SUBARU_ANGLE_STEERING_LIMITS = {
#define SUBARU_ALT_BUS 1
#define SUBARU_CAM_BUS 2

#define SUBARU_COMMON_TX_MSGS(alt_bus) \
{MSG_SUBARU_ES_LKAS, SUBARU_MAIN_BUS, 8}, \
#define SUBARU_COMMON_TX_MSGS(alt_bus, lkas_msg) \
{lkas_msg, SUBARU_MAIN_BUS, 8}, \
{MSG_SUBARU_ES_Distance, alt_bus, 8}, \
{MSG_SUBARU_ES_DashStatus, SUBARU_MAIN_BUS, 8}, \
{MSG_SUBARU_ES_LKAS_State, SUBARU_MAIN_BUS, 8}, \
Expand All @@ -66,12 +66,12 @@ const SteeringLimits SUBARU_ANGLE_STEERING_LIMITS = {
{.msg = {{MSG_SUBARU_CruiseControl, alt_bus, 8, .check_checksum = true, .max_counter = 15U, .expected_timestep = 50000U}, { 0 }, { 0 }}}, \

const CanMsg SUBARU_TX_MSGS[] = {
SUBARU_COMMON_TX_MSGS(SUBARU_MAIN_BUS)
SUBARU_COMMON_TX_MSGS(SUBARU_MAIN_BUS, MSG_SUBARU_ES_LKAS)
};
#define SUBARU_TX_MSGS_LEN (sizeof(SUBARU_TX_MSGS) / sizeof(SUBARU_TX_MSGS[0]))

const CanMsg SUBARU_GEN2_TX_MSGS[] = {
SUBARU_COMMON_TX_MSGS(SUBARU_ALT_BUS)
SUBARU_COMMON_TX_MSGS(SUBARU_ALT_BUS, MSG_SUBARU_ES_LKAS)
};
#define SUBARU_GEN2_TX_MSGS_LEN (sizeof(SUBARU_GEN2_TX_MSGS) / sizeof(SUBARU_GEN2_TX_MSGS[0]))

Expand Down
9 changes: 4 additions & 5 deletions tests/safety/test_subaru.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,16 +25,16 @@
SUBARU_CAM_BUS = 2


def lkas_tx_msgs(alt_bus):
return [[MSG_SUBARU_ES_LKAS, SUBARU_MAIN_BUS],
def lkas_tx_msgs(alt_bus, lkas_msg=MSG_SUBARU_ES_LKAS):
return [[lkas_msg, SUBARU_MAIN_BUS],
[MSG_SUBARU_ES_Distance, alt_bus],
[MSG_SUBARU_ES_DashStatus, SUBARU_MAIN_BUS],
[MSG_SUBARU_ES_LKAS_State, SUBARU_MAIN_BUS],
[MSG_SUBARU_ES_Infotainment, SUBARU_MAIN_BUS]]


def fwd_blacklisted_addr(*additional_messages):
return {SUBARU_CAM_BUS: [MSG_SUBARU_ES_LKAS, MSG_SUBARU_ES_DashStatus, MSG_SUBARU_ES_LKAS_State, MSG_SUBARU_ES_Infotainment, *additional_messages]}
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]}

class TestSubaruSafetyBase(common.PandaSafetyTest):
FLAGS = 0
Expand Down Expand Up @@ -141,7 +141,6 @@ def _pcm_status_msg(self, enable):
values = {"Cruise_Activated": enable}
return self.packer.make_can_msg_panda("ES_Status", 2, values)


def test_alt_lkas_msg(self):
self.assertTrue(self._tx(self._angle_cmd_msg(0, 0)))
self.assertFalse(self._tx(self._angle_cmd_msg(0, 1)))
Expand Down

0 comments on commit ddbc87d

Please sign in to comment.