From 00772a6aeb286491a0e92d5e01034acccab761a1 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Mon, 17 Aug 2026 21:35:09 -0500 Subject: [PATCH] BB GORL --- opendbc_repo/opendbc/car/toyota/carstate.py | 2 +- .../opendbc/car/toyota/tests/test_toyota.py | 22 +++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/opendbc_repo/opendbc/car/toyota/carstate.py b/opendbc_repo/opendbc/car/toyota/carstate.py index 2e48655a0..9b10cdf03 100644 --- a/opendbc_repo/opendbc/car/toyota/carstate.py +++ b/opendbc_repo/opendbc/car/toyota/carstate.py @@ -299,7 +299,7 @@ class CarState(CarStateBase): pt_messages.append(("GAS_SENSOR", 50)) if CP.carFingerprint in DISTANCE_BUTTON_CAR: - pt_messages.append(("PCM_CRUISE_4", 50)) + pt_messages.append(("PCM_CRUISE_4", 1)) return { Bus.pt: CANParser(DBC[CP.carFingerprint][Bus.pt], pt_messages, 0), diff --git a/opendbc_repo/opendbc/car/toyota/tests/test_toyota.py b/opendbc_repo/opendbc/car/toyota/tests/test_toyota.py index 3ef83d3a3..2ab6f54b2 100644 --- a/opendbc_repo/opendbc/car/toyota/tests/test_toyota.py +++ b/opendbc_repo/opendbc/car/toyota/tests/test_toyota.py @@ -115,6 +115,28 @@ class TestToyotaInterfaces: ) assert "PCM_CRUISE_4" not in CarState.get_can_parsers(other_params)[Bus.pt].vl + def test_sienna_distance_button_rate_does_not_invalidate_can(self): + params = CarInterface.get_params( + CAR.TOYOTA_SIENNA_4TH_GEN, + {bus: {} for bus in range(8)}, + [], + alpha_long=False, + is_release=False, + docs=False, + starpilot_toggles=SimpleNamespace(force_torque_controller=False, nnff=False, nnff_lite=False), + ) + parser = CarState.get_can_parsers(params)[Bus.pt] + packer = CANPacker(DBC[CAR.TOYOTA_SIENNA_4TH_GEN][Bus.pt]) + + for frame in range(1, 4): + msg = packer.make_can_msg("PCM_CRUISE_4", 0, {"COUNTER": frame, "DISTANCE": frame % 2}) + parser.update([(frame * 1_000_000_000, [msg])]) + assert parser.can_valid + + # The 1 Hz message must not make the whole car state invalid between frames. + parser.update([(frame * 1_000_000_000 + 500_000_000, [])]) + assert parser.can_valid + def test_tss2_dbc(self): # We make some assumptions about TSS2 platforms, # like looking up certain signals only in this DBC