mi mi zu zu pri pri

This commit is contained in:
firestar5683
2026-07-19 13:42:37 -05:00
parent ce44830b22
commit 03cf613e4c
2 changed files with 25 additions and 5 deletions
+5 -5
View File
@@ -62,12 +62,12 @@ class CarInterface(CarInterfaceBase):
# A DSU bypass adapter reroutes the stock DSU messages to the camera bus.
# These messages are normally absent there on pre-TSS2 platforms.
# Require the native-bus message to be absent so startup relay mirroring is not mistaken for an adapter.
pt_fingerprint = fingerprint.get(0, {})
radar_fingerprint = fingerprint.get(1, {})
camera_fingerprint = fingerprint.get(2, {})
has_dsu_bypass = ((0x343 in camera_fingerprint and 0x343 not in radar_fingerprint) or
(0x4CB in camera_fingerprint and 0x4CB not in pt_fingerprint))
has_dsu_bypass = 0x343 in camera_fingerprint or 0x4CB in camera_fingerprint
if candidate == CAR.LEXUS_IS:
# The IS mirrors its native buses onto camera bus during startup without a bypass adapter.
has_dsu_bypass = ((0x343 in camera_fingerprint and 0x343 not in fingerprint.get(1, {})) or
(0x4CB in camera_fingerprint and 0x4CB not in fingerprint.get(0, {})))
if not use_sdsu and candidate not in TSS2_CAR and has_dsu_bypass:
ret.flags |= ToyotaFlags.DSU_BYPASS.value
@@ -133,6 +133,26 @@ class TestToyotaInterfaces:
assert not car_params.openpilotLongitudinalControl
assert car_params.safetyConfigs[0].safetyParam & ToyotaSafetyFlags.STOCK_LONGITUDINAL.value
@pytest.mark.parametrize(("native_bus", "message"), [(1, 0x343), (0, 0x4CB)])
def test_prius_dsu_bypass_allows_native_bus_message(self, native_bus, message):
fingerprint = {bus: {} for bus in range(8)}
fingerprint[native_bus][message] = 8
fingerprint[2][message] = 8
car_params = CarInterface.get_params(
CAR.TOYOTA_PRIUS,
fingerprint,
[],
alpha_long=False,
is_release=False,
docs=False,
starpilot_toggles=SimpleNamespace(),
)
assert car_params.flags & ToyotaFlags.DSU_BYPASS.value
assert car_params.openpilotLongitudinalControl
assert not car_params.safetyConfigs[0].safetyParam & ToyotaSafetyFlags.STOCK_LONGITUDINAL.value
def test_dsu_bypass_does_not_change_tss2_or_smart_dsu(self):
fingerprint = {bus: {} for bus in range(8)}
fingerprint[0][0x2FF] = 8