Skip to content

Commit 712c613

Browse files
committed
Honda radarless: forward buttons when disengaged
1 parent a88fe8c commit 712c613

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

board/safety/safety_honda.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -429,7 +429,12 @@ static int honda_bosch_fwd_hook(int bus_num, int addr) {
429429
int bus_fwd = -1;
430430

431431
if (bus_num == 0) {
432-
bus_fwd = 2;
432+
// Radarless: Block buttons when engaged
433+
int is_button_msg = (addr == 0x296);
434+
bool block_msg = is_button_msg && controls_allowed && honda_bosch_radarless && !honda_bosch_long;
435+
if (!block_msg) {
436+
bus_fwd = 2;
437+
}
433438
}
434439
if (bus_num == 2) {
435440
int is_lkas_msg = (addr == 0xE4) || (addr == 0xE5) || (addr == 0x33D) || (addr == 0x33DA) || (addr == 0x33DB);

tests/safety/test_honda.py

+15
Original file line numberDiff line numberDiff line change
@@ -565,6 +565,21 @@ def setUp(self):
565565
self.safety.set_safety_hooks(Panda.SAFETY_HONDA_BOSCH, Panda.FLAG_HONDA_RADARLESS)
566566
self.safety.init_tests()
567567

568+
# Test forwarding buttons when disengaged
569+
def test_fwd_hook(self):
570+
for controls_allowed in [False, True]:
571+
self.safety.set_controls_allowed(controls_allowed)
572+
if controls_allowed:
573+
self.FWD_BLACKLISTED_ADDRS[0] = [0x296]
574+
super().test_fwd_hook()
575+
576+
# OP sends buttons when engaged, so allow all. Only allow cancel when disengaged.
577+
def test_buttons_radarless(self):
578+
for controls_allowed in [False, True]:
579+
self.safety.set_controls_allowed(controls_allowed)
580+
self.assertTrue(self._tx(self._button_msg(Btn.CANCEL, bus=self.BUTTONS_BUS)))
581+
for button in (Btn.MAIN, Btn.RESUME, Btn.SET, Btn.NONE):
582+
self.assertEqual(controls_allowed, self._tx(self._button_msg(button, bus=self.BUTTONS_BUS)))
568583

569584
class TestHondaBoschRadarlessAltBrakeSafety(HondaPcmEnableBase, TestHondaBoschRadarlessSafetyBase, TestHondaBoschAltBrakeSafetyBase):
570585
"""

0 commit comments

Comments
 (0)