Skip to content

Commit

Permalink
Revert "Hyundai: steering fault bit safety (commaai#1095)"
Browse files Browse the repository at this point in the history
This reverts commit 2334a41.
  • Loading branch information
sshane authored and mlocoteta committed Apr 29, 2023
1 parent ca8e592 commit f935084
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
4 changes: 0 additions & 4 deletions board/safety/safety_hyundai.h
Original file line number Diff line number Diff line change
Expand Up @@ -324,10 +324,6 @@ static int hyundai_tx_hook(CANPacket_t *to_send, bool longitudinal_allowed) {
if (addr == 832) {
int desired_torque = ((GET_BYTES_04(to_send) >> 16) & 0x7ffU) - 1024U;
bool steer_req = GET_BIT(to_send, 27U) != 0U;
bool toi_flt = GET_BIT(to_send, 28U) != 0U;
if (toi_flt && !controls_allowed) {
tx = 0;
}

if (steer_torque_cmd_checks(desired_torque, steer_req, HYUNDAI_STEERING_LIMITS)) {
tx = 0;
Expand Down
12 changes: 2 additions & 10 deletions tests/safety/test_hyundai.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ def _torque_driver_msg(self, torque):
values = {"CR_Mdps_StrColTq": torque}
return self.packer.make_can_msg_panda("MDPS12", 0, values)

def _torque_cmd_msg(self, torque, steer_req=1, toi_flt=0):
values = {"CR_Lkas_StrToqReq": torque, "CF_Lkas_ActToi": steer_req, "CF_Lkas_ToiFlt": toi_flt}
def _torque_cmd_msg(self, torque, steer_req=1):
values = {"CR_Lkas_StrToqReq": torque, "CF_Lkas_ActToi": steer_req}
return self.packer.make_can_msg_panda("LKAS11", 0, values)

def test_steer_req_bit(self):
Expand All @@ -194,14 +194,6 @@ def test_steer_req_bit(self):
for _ in range(100):
self.assertTrue(self._tx(self._torque_cmd_msg(self.MAX_TORQUE, steer_req=1)))

def test_toi_flt_bit(self):
# No actuation of fault bit while controls are not allowed
for controls_allowed in [True, False]:
for toi_flt in [0, 1]:
self.safety.set_controls_allowed(controls_allowed)
should_tx = toi_flt == 0 or controls_allowed
self.assertEqual(should_tx, self._tx(self._torque_cmd_msg(0, toi_flt=toi_flt)))


class TestHyundaiSafetyCameraSCC(TestHyundaiSafety):
BUTTONS_BUS = 2 # tx on 2, rx on 0
Expand Down

0 comments on commit f935084

Please sign in to comment.