RAV4 radar: keep the ACC target receiver under alpha long's radar disable

Alpha long without a CAN filter disables the radar with UDS
CommunicationControl (28 01 01 to 0x750/0x0F). That stops the radar's
car-bus (bus 0) output only; the radar bus (bus 1) keeps running at full
rate, ACC target 0x235/0x237/0x239 included (RAV4s on 8821F0R03100, one
a 26 min drive; a C-HR Hybrid 8821FF410500 on opendbc's 22 min
"openpilot longitudinal, radar disabled" route).

configure_radar() used to clear the receiver and mark the radar
unavailable in that case, so alpha long without a CAN filter ran
vision-only. Keep the receiver on instead. The radar-torque AOL check
allows ARS510_RADAR on the RAV4 2022 with or without openpilot
longitudinal, as the filter, angle, pedal and EPS8 checks already do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ds-sebastian
2026-11-19 23:29:37 -05:00
parent 3b73537247
commit a147e084dc
5 changed files with 17 additions and 15 deletions
@@ -20,9 +20,8 @@ def configure_radar(cp):
if not supported(cp):
return False
cp.flags &= ~int(ToyotaFlags.ARS510_RADAR | ToyotaFlags.ARS510_FUSED)
if cp.flags & ToyotaFlags.DISABLE_RADAR:
cp.radarUnavailable = True
return False
# Alpha long's UDS disable (DISABLE_RADAR) only stops the radar's car-bus (bus 0) output;
# the ACC target on the radar bus (bus 1) keeps running at full rate, so it stays the lead source.
cp.flags |= int(ToyotaFlags.ARS510_RADAR)
cp.radarUnavailable = False
return True
@@ -19,14 +19,13 @@ def test_factory_selects_only_live_supported_continental_radar(candidate, alpha_
if can_filter:
fingerprint[0][0x2AA] = 8
cp = CarInterface.get_params(candidate, fingerprint, [], alpha_long, False, False)
if candidate in ARS510_RADAR_CAR and not cp.flags & ToyotaFlags.DISABLE_RADAR:
if candidate in ARS510_RADAR_CAR:
# with or without alpha long's radar disable: the disable leaves the radar bus running
assert cp.flags & ToyotaFlags.ARS510_RADAR, 'AUTOMATIC_CONTINENTAL_RADAR'
assert not cp.flags & ToyotaFlags.ARS510_FUSED and not cp.radarUnavailable
assert isinstance(RadarInterface(cp).ars510, AccRadarInterface)
else:
assert not cp.flags & (ToyotaFlags.ARS510_RADAR | ToyotaFlags.ARS510_FUSED)
if candidate in ARS510_RADAR_CAR:
assert cp.radarUnavailable and RadarInterface(cp).ars510 is None
def set_bits(data, start, length, value):
+1 -1
View File
@@ -140,7 +140,7 @@ class TestHighlanderAol(unittest.TestCase):
with self.subTest(car=car, alpha=alpha):
cp = CarInterface.get_params(car, gen_empty_fingerprint(), [], alpha, False, False)
cp.flags |= int(ToyotaFlags.ARS510_RADAR)
expected = car == CAR.TOYOTA_RAV4_TSS2_2022 and not alpha
expected = car == CAR.TOYOTA_RAV4_TSS2_2022 # the ACC target receiver also runs under the radar disable
self.assertEqual(qualified(cp), expected)
cp.alternativeExperience = 32
self.assertEqual(qualified(cp, marked_only=True), expected)
+2 -1
View File
@@ -177,7 +177,8 @@ def qualified(cp, *, marked_only=False):
if hold:
return False
allowed_flags = required_flags | ToyotaFlags.HYBRID | ToyotaFlags.HAS_BSM
if cp.carFingerprint == CAR.TOYOTA_RAV4_TSS2_2022 and not cp.openpilotLongitudinalControl:
if cp.carFingerprint == CAR.TOYOTA_RAV4_TSS2_2022:
# the ACC target receiver also runs under alpha long's radar disable (DISABLE_RADAR)
allowed_flags |= ToyotaFlags.ARS510_RADAR
if cp.flags & required_flags != required_flags or int(cp.flags) & ~int(allowed_flags | ToyotaFlags.AUTO_BRAKE_HOLD):
return False
@@ -93,14 +93,17 @@ def test_automatic_factory_card_and_radard_parse_live_target(candidate):
@pytest.mark.parametrize('candidate', [CAR.TOYOTA_RAV4_TSS2_2022, CAR.TOYOTA_RAV4_TSS2_2023])
def test_disabled_radar_withdraws_a_previous_receiver_without_changing_authority(candidate):
def test_disabled_radar_keeps_acc_target_receiver_without_changing_authority(candidate):
# alpha long's UDS disable stops the radar's car-bus output only; the radar bus keeps sending the ACC target
from opendbc.car.toyota.ars510_preferences import configure_radar
cp = CarInterface.get_params(candidate, gen_empty_fingerprint(), [], False, False, False)
cp.flags |= int(ToyotaFlags.DISABLE_RADAR | ToyotaFlags.ARS510_FUSED)
cp = CarInterface.get_params(candidate, gen_empty_fingerprint(), [], True, False, False)
assert cp.flags & ToyotaFlags.DISABLE_RADAR
cp.flags |= int(ToyotaFlags.ARS510_FUSED)
before = cp.to_dict()
assert not configure_radar(cp)
assert configure_radar(cp)
expected = before.copy()
expected['flags'] &= ~int(ToyotaFlags.ARS510_RADAR | ToyotaFlags.ARS510_FUSED)
expected['radarUnavailable'] = True
expected['flags'] = (expected['flags'] & ~int(ToyotaFlags.ARS510_FUSED)) | int(ToyotaFlags.ARS510_RADAR)
expected['radarUnavailable'] = False
assert cp.to_dict() == expected
assert RadarInterface(cp).ars510 is None
assert cp.flags & ToyotaFlags.DISABLE_RADAR and cp.openpilotLongitudinalControl
assert RadarInterface(cp).ars510 is not None