From c31f2d44aa17a76f94bde9b69496c050e5fb827f Mon Sep 17 00:00:00 2001 From: lukasloetkolben <61192133+lukasloetkolben@users.noreply.github.com> Date: Fri, 20 Sep 2024 20:22:23 -0700 Subject: [PATCH] remove can 1 from safety --- board/safety/safety_tesla.h | 13 +------------ tests/safety/test_tesla.py | 27 +-------------------------- 2 files changed, 2 insertions(+), 38 deletions(-) diff --git a/board/safety/safety_tesla.h b/board/safety/safety_tesla.h index 96addac535..766be86772 100644 --- a/board/safety/safety_tesla.h +++ b/board/safety/safety_tesla.h @@ -21,7 +21,6 @@ const int TESLA_FLAG_LONGITUDINAL_CONTROL = 1; const CanMsg TESLA_M3_Y_TX_MSGS[] = { {0x488, 0, 4}, // DAS_steeringControl {0x2b9, 0, 8}, // DAS_control - {0x229, 1, 3}, // SCCM_rightStalk }; RxCheck tesla_model3_y_rx_checks[] = { @@ -31,8 +30,7 @@ RxCheck tesla_model3_y_rx_checks[] = { {.msg = {{0x118, 0, 8, .frequency = 100U}, { 0 }, { 0 }}}, // DI_systemStatus (gas pedal) {.msg = {{0x39d, 0, 5, .frequency = 25U}, { 0 }, { 0 }}}, // IBST_status (brakes) {.msg = {{0x286, 0, 8, .frequency = 10U}, { 0 }, { 0 }}}, // DI_state (acc state) - {.msg = {{0x311, 0, 7, .frequency = 10U}, { 0 }, { 0 }}}, // UI_warning (buckle switch & doors) - {.msg = {{0x3f5, 1, 8, .frequency = 10U}, { 0 }, { 0 }}}, // ID3F5VCFRONT_lighting (blinkers) + {.msg = {{0x311, 0, 7, .frequency = 10U}, { 0 }, { 0 }}}, // UI_warning (blinkers, buckle switch & doors) }; bool tesla_longitudinal = false; @@ -113,15 +111,6 @@ static bool tesla_tx_hook(const CANPacket_t *to_send) { } } - - if (addr == 0x229){ - // Only the "Half up" and "Neutral" positions are permitted for sending stalk signals. - int control_lever_status = ((GET_BYTE(to_send, 1) & 0x70U) >> 4); - if ((control_lever_status > 1)) { - violation = true; - } - } - if(addr == 0x2b9) { // DAS_control: longitudinal control message if (tesla_longitudinal) { diff --git a/tests/safety/test_tesla.py b/tests/safety/test_tesla.py index 87e684c84c..ff176b269e 100755 --- a/tests/safety/test_tesla.py +++ b/tests/safety/test_tesla.py @@ -7,19 +7,17 @@ MSG_DAS_steeringControl = 0x488 MSG_DAS_Control = 0x2b9 -MSG_SCCM_rightStalk = 0x229 class TestTeslaSafetyBase(common.PandaCarSafetyTest): RELAY_MALFUNCTION_ADDRS = {0: (MSG_DAS_steeringControl,)} FWD_BLACKLISTED_ADDRS = {2: [MSG_DAS_steeringControl]} - TX_MSGS = [[MSG_DAS_steeringControl, 0], [MSG_DAS_Control, 0], [MSG_SCCM_rightStalk, 1]] + TX_MSGS = [[MSG_DAS_steeringControl, 0], [MSG_DAS_Control, 0]] STANDSTILL_THRESHOLD = 1 GAS_PRESSED_THRESHOLD = 3 FWD_BUS_LOOKUP = {0: 2, 2: 0} packer: CANPackerPanda - packer_vehicle: CANPackerPanda @classmethod def setUpClass(cls): @@ -46,10 +44,6 @@ def _pcm_status_msg(self, enable): values = {"DI_cruiseState": 2 if enable else 0} return self.packer.make_can_msg_panda("DI_state", 0, values) - def _control_lever_cmd(self, command): - values = {"SCCM_rightStalkStatus": command} - return self.packer_vehicle.make_can_msg_panda("SCCM_rightStalk", 1, values) - def _long_control_msg(self, set_speed, acc_val=0, jerk_limits=(0, 0), accel_limits=(0, 0), aeb_event=0, bus=0): values = { "DAS_setSpeed": set_speed, @@ -72,7 +66,6 @@ class TestTeslaStockSafety(TestTeslaSafetyBase): def setUp(self): self.packer = CANPackerPanda("tesla_model3_party") - self.packer_vehicle = CANPackerPanda("tesla_model3_vehicle") self.safety = libpanda_py.libpanda self.safety.set_safety_hooks(Panda.SAFETY_TESLA, 0) self.safety.init_tests() @@ -85,23 +78,6 @@ def _angle_meas_msg(self, angle: float): values = {"EPAS3S_internalSAS": angle} return self.packer.make_can_msg_panda("EPAS3S_sysStatus", 0, values) - def test_acc_buttons(self): - """ - cancel & idle allowed. - """ - btns = [ - (0, True), # IDLE - (1, True), # HALF UP - (2, False), # FULL UP - (3, False), # HALF DOWN - (4, False), # FULL DOWN - ] - for btn, should_tx in btns: - for controls_allowed in (True, False): - self.safety.set_controls_allowed(controls_allowed) - tx = self._tx(self._control_lever_cmd(btn)) - self.assertEqual(tx, should_tx) - class TestTeslaLongitudinalSafetyBase(TestTeslaSafetyBase): RELAY_MALFUNCTION_ADDRS = {0: (MSG_DAS_steeringControl, MSG_DAS_Control)} FWD_BLACKLISTED_ADDRS = {2: [MSG_DAS_steeringControl, MSG_DAS_Control]} @@ -112,7 +88,6 @@ class TestTeslaLongitudinalSafetyBase(TestTeslaSafetyBase): def setUp(self): self.packer = CANPackerPanda("tesla_model3_party") - self.packer_vehicle = CANPackerPanda("tesla_model3_vehicle") self.safety = libpanda_py.libpanda self.safety.set_safety_hooks(Panda.SAFETY_TESLA, Panda.FLAG_TESLA_LONG_CONTROL) self.safety.init_tests()