diff --git a/selfdrive/car/interfaces.py b/selfdrive/car/interfaces.py index 9cbd7cac11..9728639a1d 100644 --- a/selfdrive/car/interfaces.py +++ b/selfdrive/car/interfaces.py @@ -244,8 +244,6 @@ class CarInterfaceBase(ABC): self.cruise_cancelled_btn = True self.prev_acc_mads_combo = False self.mads_event_lock = True - self.gap_button_counter = 0 - self.experimental_mode_hold = False self.last_mads_init = 0. self.madsEnabledInit = False self.madsEnabledInitPrev = False diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 4b005ad825..47cbdf77b6 100755 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -733,16 +733,18 @@ class Controls: # toggle experimental mode once on distance button hold if self.CP.openpilotLongitudinalControl: - if self.v_cruise_helper.experimental_mode_update and self.v_cruise_helper.button_timers[ButtonType.gapAdjustCruise] == CRUISE_LONG_PRESS: + if self.v_cruise_helper.button_timers[ButtonType.gapAdjustCruise] == CRUISE_LONG_PRESS and \ + not self.v_cruise_helper.experimental_mode_update: self.experimental_mode = not self.experimental_mode self.params.put_bool_nonblocking("ExperimentalMode", self.experimental_mode) + self.v_cruise_helper.experimental_mode_update = True # decrement personality on distance button press if self.CP.openpilotLongitudinalControl: - if any(not be.pressed and be.type == ButtonType.gapAdjustCruise for be in CS.buttonEvents) and \ - not self.v_cruise_helper.experimental_mode_update: - self.personality = (self.personality - 1) % 3 - self.params.put_nonblocking('LongitudinalPersonality', str(self.personality)) + if any(not be.pressed and be.type == ButtonType.gapAdjustCruise for be in CS.buttonEvents): + if not self.v_cruise_helper.experimental_mode_update: + self.personality = (self.personality - 1) % 3 + self.params.put_nonblocking('LongitudinalPersonality', str(self.personality)) self.v_cruise_helper.experimental_mode_update = False return CC, lac_log diff --git a/selfdrive/controls/lib/drive_helpers.py b/selfdrive/controls/lib/drive_helpers.py index e0266404bc..4605633e3d 100644 --- a/selfdrive/controls/lib/drive_helpers.py +++ b/selfdrive/controls/lib/drive_helpers.py @@ -107,9 +107,6 @@ class VCruiseHelper: self._update_v_cruise_min(is_metric) if CS.cruiseState.available: - if self.CP.openpilotLongitudinalControl: - self._update_experimental_mode(CS) - if not self.CP.pcmCruise or not self.CP.pcmCruiseSpeed: # if stock cruise is completely disabled, then we can use our own set speed logic self._update_v_cruise_non_pcm(CS, enabled, is_metric, reverse_acc) @@ -274,16 +271,6 @@ class VCruiseHelper: self.v_cruise_min = GM_V_CRUISE_MIN[is_metric] self.is_metric_prev = is_metric - def _update_experimental_mode(self, CS): - for b in CS.buttonEvents: - if b.type == ButtonType.gapAdjustCruise and not b.pressed: - if self.button_timers[ButtonType.gapAdjustCruise] > CRUISE_LONG_PRESS: - return # end long press - break - else: - if self.button_timers[ButtonType.gapAdjustCruise] and self.button_timers[ButtonType.gapAdjustCruise] == CRUISE_LONG_PRESS: - self.experimental_mode_update = True - def clip_curvature(v_ego, prev_curvature, new_curvature): v_ego = max(MIN_SPEED, v_ego)