mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-09-15 00:03:45 +08:00
Merge branch 'exp-hold-fix' into master-dev-c3
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user