diff --git a/opendbc_repo/opendbc/car/toyota/carcontroller.py b/opendbc_repo/opendbc/car/toyota/carcontroller.py index c5e7917316..cc22161a2a 100644 --- a/opendbc_repo/opendbc/car/toyota/carcontroller.py +++ b/opendbc_repo/opendbc/car/toyota/carcontroller.py @@ -338,6 +338,8 @@ class CarController(CarControllerBase): else: self.reset_auto_hold_state() if self.CP.openpilotLongitudinalControl: + legacy_advert_long = legacy_advert_filter.configured(self.CP) + legacy_rav4h_long = legacy_advert_long and self.CP.carFingerprint == CAR.TOYOTA_RAV4H # if user engages at a stop with foot on brake, PCM starts in a special cruise standstill mode. on resume press, # brakes can take a while to ramp up causing a lurch forward. prevent resume press until planner wants to move. # don't use CC.cruiseControl.resume since it is gated on CS.cruiseState.standstill which goes false for 3s after resume press @@ -356,12 +358,12 @@ class CarController(CarControllerBase): CS.pcm_acc_status, CC.cruiseControl.resume, long_active) self.last_standstill = CS.out.standstill elif self.sdsu_hybrid or (advert_long and bool(self.CP.flags & ToyotaFlags.HYBRID) and - not (legacy_advert_filter.enabled(self.CP) and self.CP.carFingerprint == CAR.TOYOTA_RAV4H)): + not legacy_rav4h_long): # Retain the existing hybrid resume behavior while active. The shared # owner guard below still holds neutral when LONG or its source is lost. self.standstill_req = not long_active and CS.out.standstill - elif rav4h_long or (legacy_advert_filter.enabled(self.CP) and self.CP.carFingerprint == CAR.TOYOTA_RAV4H) or not self.CP.flags & ToyotaFlags.HYBRID.value: - should_resume = long_active and actuators.accel > 0 if rav4h_long or legacy_advert_filter.enabled(self.CP) else actuators.accel > 0 + elif rav4h_long or legacy_rav4h_long or not self.CP.flags & ToyotaFlags.HYBRID.value: + should_resume = long_active and actuators.accel > 0 if rav4h_long or legacy_advert_long else actuators.accel > 0 if should_resume: self.standstill_req = False diff --git a/opendbc_repo/opendbc/car/toyota/legacy_advert_filter.py b/opendbc_repo/opendbc/car/toyota/legacy_advert_filter.py index 1123da7980..569b2037bc 100644 --- a/opendbc_repo/opendbc/car/toyota/legacy_advert_filter.py +++ b/opendbc_repo/opendbc/car/toyota/legacy_advert_filter.py @@ -47,12 +47,14 @@ def apply(cp): def configured(cp): + if cp is None or not cp.flags & int(ToyotaFlags.RADAR_CAN_FILTER): + return False from opendbc.car.toyota.pedal_composite import parent_cp cp = parent_cp(cp) - if cp is not None and cp.carFingerprint == CAR.TOYOTA_MATRIX_RETROFIT: + if cp.carFingerprint == CAR.TOYOTA_MATRIX_RETROFIT: from opendbc.car.toyota import matrix_filter return matrix_filter.configured(cp, length=4) - if (cp is None or cp.brand != 'toyota' or cp.carFingerprint not in PROFILES or cp.notCar or cp.passive or cp.dashcamOnly or + if (cp.brand != 'toyota' or cp.carFingerprint not in PROFILES or cp.notCar or cp.passive or cp.dashcamOnly or cp.secOcRequired or not cp.pcmCruise or len(cp.safetyConfigs) != 1 or cp.steerControlType != structs.CarParams.SteerControlType.torque): return False diff --git a/opendbc_repo/opendbc/car/toyota/prius_sdsu.py b/opendbc_repo/opendbc/car/toyota/prius_sdsu.py index ad7acadac6..882ae2a3be 100644 --- a/opendbc_repo/opendbc/car/toyota/prius_sdsu.py +++ b/opendbc_repo/opendbc/car/toyota/prius_sdsu.py @@ -40,9 +40,11 @@ def apply(cp): def configured(cp): + if cp is None or not cp.flags & int(ToyotaFlags.LONG_FILTER): + return False from opendbc.car.toyota.pedal_composite import parent_cp cp = parent_cp(cp) - if (cp is None or cp.brand != 'toyota' or cp.carFingerprint != CAR.TOYOTA_PRIUS or cp.notCar or cp.passive or + if (cp.brand != 'toyota' or cp.carFingerprint != CAR.TOYOTA_PRIUS or cp.notCar or cp.passive or cp.dashcamOnly or cp.secOcRequired or not cp.pcmCruise or len(cp.safetyConfigs) != 1 or cp.steerControlType != structs.CarParams.SteerControlType.torque): return False diff --git a/prebuilt.json b/prebuilt.json index b1f18fe82d..1035e25ce4 100644 --- a/prebuilt.json +++ b/prebuilt.json @@ -1 +1 @@ -{"protected_inventory_sha256": "a0208070cd2a8a6b029f92570e99c1c40ca1d0e9bb690652eee4e3423d778e42", "schema_version": 1} +{"protected_inventory_sha256": "8be800fd6a55086f842a6d4de7e386d5383abe1a56399213f4e0d561f0001a54", "schema_version": 1}