From e1e4b04c45de80b5f9a014cdf41199790916aec5 Mon Sep 17 00:00:00 2001 From: infiniteCable <75014343+infiniteCable@users.noreply.github.com> Date: Sat, 26 Apr 2025 19:34:54 +0200 Subject: [PATCH] Update cruise.py --- selfdrive/car/cruise.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/selfdrive/car/cruise.py b/selfdrive/car/cruise.py index 660f7c3e4..be5312bbd 100644 --- a/selfdrive/car/cruise.py +++ b/selfdrive/car/cruise.py @@ -71,10 +71,11 @@ class VCruiseHelper: return speed_limit = CS.cruiseState.speedLimit * CV.MS_TO_KPH - if speed_limit != self.v_speed_limit_kph and speed_limit != 0: + if speed_limit != self.v_speed_limit_kph: + if speed_limit != 0 + self.v_cruise_kph = speed_limit + self.v_cruise_kph = np.clip(round(self.v_cruise_kph, 1), V_CRUISE_MIN, V_CRUISE_MAX) self.v_speed_limit_kph = speed_limit - self.v_cruise_kph = speed_limit - self.v_cruise_kph = np.clip(round(self.v_cruise_kph, 1), V_CRUISE_MIN, V_CRUISE_MAX) def _update_v_cruise_non_pcm(self, CS, enabled, is_metric): # handle button presses. TODO: this should be in state_control, but a decelCruise press