Hyundai safety: temporarily disabled button spam check to avoid camera faults
parent
53aef76cf1
commit
63b7926364
|
@ -129,9 +129,10 @@ static int hyundai_tx_hook(CAN_FIFOMailBox_TypeDef *to_send) {
|
|||
// FORCE CANCEL: safety check only relevant when spamming the cancel button.
|
||||
// ensuring that only the cancel button press is sent (VAL 4) when controls are off.
|
||||
// This avoids unintended engagements while still allowing resume spam
|
||||
if (((to_send->RIR>>21) == 1265) && !controls_allowed && ((to_send->RDTR >> 4) & 0xFF) == 0) {
|
||||
if ((to_send->RDLR & 0x7) != 4) return 0;
|
||||
}
|
||||
// TODO: fix bug preventing the button msg to be fwd'd on bus 2
|
||||
//if (((to_send->RIR>>21) == 1265) && !controls_allowed && ((to_send->RDTR >> 4) & 0xFF) == 0) {
|
||||
// if ((to_send->RDLR & 0x7) != 4) return 0;
|
||||
//}
|
||||
|
||||
// 1 allows the message through
|
||||
return true;
|
||||
|
|
|
@ -168,18 +168,18 @@ class TestHyundaiSafety(unittest.TestCase):
|
|||
self.assertTrue(self.safety.hyundai_tx_hook(self._torque_msg(sign * (MAX_RT_DELTA + 1))))
|
||||
|
||||
|
||||
def test_spam_cancel_safety_check(self):
|
||||
RESUME_BTN = 1
|
||||
SET_BTN = 2
|
||||
CANCEL_BTN = 4
|
||||
BUTTON_MSG = 1265
|
||||
self.safety.set_controls_allowed(0)
|
||||
self.assertTrue(self.safety.hyundai_tx_hook(self._button_msg(CANCEL_BTN)))
|
||||
self.assertFalse(self.safety.hyundai_tx_hook(self._button_msg(RESUME_BTN)))
|
||||
self.assertFalse(self.safety.hyundai_tx_hook(self._button_msg(SET_BTN)))
|
||||
# do not block resume if we are engaged already
|
||||
self.safety.set_controls_allowed(1)
|
||||
self.assertTrue(self.safety.hyundai_tx_hook(self._button_msg(RESUME_BTN)))
|
||||
#def test_spam_cancel_safety_check(self):
|
||||
# RESUME_BTN = 1
|
||||
# SET_BTN = 2
|
||||
# CANCEL_BTN = 4
|
||||
# BUTTON_MSG = 1265
|
||||
# self.safety.set_controls_allowed(0)
|
||||
# self.assertTrue(self.safety.hyundai_tx_hook(self._button_msg(CANCEL_BTN)))
|
||||
# self.assertFalse(self.safety.hyundai_tx_hook(self._button_msg(RESUME_BTN)))
|
||||
# self.assertFalse(self.safety.hyundai_tx_hook(self._button_msg(SET_BTN)))
|
||||
# # do not block resume if we are engaged already
|
||||
# self.safety.set_controls_allowed(1)
|
||||
# self.assertTrue(self.safety.hyundai_tx_hook(self._button_msg(RESUME_BTN)))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
|
Loading…
Reference in New Issue