From b58dac390c88112329597a3a572439b8d8d48e00 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Thu, 7 Mar 2024 15:12:03 -0800 Subject: [PATCH] clean up --- selfdrive/car/toyota/carcontroller.py | 5 ++--- selfdrive/car/toyota/carstate.py | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/selfdrive/car/toyota/carcontroller.py b/selfdrive/car/toyota/carcontroller.py index 5b9878b7dc..cb943b7a5f 100644 --- a/selfdrive/car/toyota/carcontroller.py +++ b/selfdrive/car/toyota/carcontroller.py @@ -140,11 +140,10 @@ class CarController(CarControllerBase): if (self.frame % 3 == 0 and self.CP.openpilotLongitudinalControl) or pcm_cancel_cmd: lead = hud_control.leadVisible or CS.out.vEgo < 12. # at low speed we always assume the lead is present so ACC can be engaged - # Press distance button until we are at the correct bar length. The distance cannot be changed without cruise available + # Press distance button until we are at the correct bar length. Only change while enabled to avoid skipping startup popup if self.frame % 6 == 0: - desired_distance = 4 - hud_control.distanceBars # this is flipped - if CS.pcm_follow_distance != desired_distance and CS.out.cruiseState.enabled: + if CS.pcm_follow_distance != desired_distance and CS.out.cruiseState.enabled and self.CP.carFingerprint not in UNSUPPORTED_DSU_CAR: self.distance_button = not self.distance_button else: self.distance_button = 0 diff --git a/selfdrive/car/toyota/carstate.py b/selfdrive/car/toyota/carstate.py index 8e4aef334e..65fced80f4 100644 --- a/selfdrive/car/toyota/carstate.py +++ b/selfdrive/car/toyota/carstate.py @@ -169,10 +169,10 @@ class CarState(CarStateBase): if self.CP.carFingerprint != CAR.PRIUS_V: self.lkas_hud = copy.copy(cp_cam.vl["LKAS_HUD"]) - if self.CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR) or (self.CP.flags & ToyotaFlags.SMART_DSU and not self.CP.flags & ToyotaFlags.RADAR_CAN_FILTER): - if self.CP.carFingerprint not in UNSUPPORTED_DSU_CAR: - self.pcm_follow_distance = cp.vl["PCM_CRUISE_2"]["PCM_FOLLOW_DISTANCE"] + if self.CP.carFingerprint not in UNSUPPORTED_DSU_CAR: + self.pcm_follow_distance = cp.vl["PCM_CRUISE_2"]["PCM_FOLLOW_DISTANCE"] + if self.CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR) or (self.CP.flags & ToyotaFlags.SMART_DSU and not self.CP.flags & ToyotaFlags.RADAR_CAN_FILTER): # distance button is wired to the ACC module (camera or radar) self.prev_distance_button = self.distance_button if self.CP.carFingerprint in (TSS2_CAR - RADAR_ACC_CAR):