mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-24 01:23:45 +08:00
Been workin all day just to keep my family fed
This commit is contained in:
@@ -161,9 +161,10 @@ class VCruiseHelper:
|
||||
return
|
||||
|
||||
engage_floor_kph = max(V_CRUISE_MIN, 7.0 * CV.MPH_TO_KPH)
|
||||
resume_pressed = any(b.type in (ButtonType.accelCruise, ButtonType.resumeCruise) for b in CS.buttonEvents)
|
||||
remembered_resume = resume_prev_button and (self.gm_cc_only or self.redneck_non_pcm)
|
||||
|
||||
if (any(b.type in (ButtonType.accelCruise, ButtonType.resumeCruise) for b in CS.buttonEvents)
|
||||
and self.v_cruise_initialized or (self.gm_cc_only and resume_prev_button)):
|
||||
if self.v_cruise_initialized and (resume_pressed or remembered_resume):
|
||||
self.v_cruise_kph = self.v_cruise_kph_last
|
||||
elif desired_speed_limit > 0 and getattr(starpilot_toggles, "set_speed_limit", False):
|
||||
# Respect the exact SLC limit+offset on engage instead of snapping upward to
|
||||
|
||||
@@ -347,6 +347,30 @@ class TestVCruiseHelperRedneck:
|
||||
assert self.v_cruise_helper.v_cruise_kph == pytest.approx(62 * CV.MPH_TO_KPH)
|
||||
assert self.v_cruise_helper.v_cruise_cluster_kph == pytest.approx(62 * CV.MPH_TO_KPH)
|
||||
|
||||
def test_resume_keeps_previous_internal_max_speed(self):
|
||||
engage_cs = car.CarState(
|
||||
vEgo=75 * CV.MPH_TO_MS,
|
||||
cruiseState={"speedCluster": 75 * CV.MPH_TO_MS},
|
||||
)
|
||||
self.v_cruise_helper.initialize_v_cruise(engage_cs, experimental_mode=False, resume_prev_button=False,
|
||||
starpilot_toggles=self.starpilot_toggles)
|
||||
|
||||
disabled_cs = car.CarState(
|
||||
cruiseState={"available": True, "speedCluster": 38 * CV.MPH_TO_MS},
|
||||
)
|
||||
self.v_cruise_helper.update_v_cruise(disabled_cs, enabled=False, is_metric=False,
|
||||
speed_limit_changed=False, starpilot_toggles=self.starpilot_toggles)
|
||||
|
||||
resume_cs = car.CarState(
|
||||
vEgo=38 * CV.MPH_TO_MS,
|
||||
cruiseState={"speedCluster": 38 * CV.MPH_TO_MS},
|
||||
)
|
||||
self.v_cruise_helper.initialize_v_cruise(resume_cs, experimental_mode=False, resume_prev_button=True,
|
||||
starpilot_toggles=self.starpilot_toggles)
|
||||
|
||||
assert self.v_cruise_helper.v_cruise_kph == pytest.approx(75 * CV.MPH_TO_KPH)
|
||||
assert self.v_cruise_helper.v_cruise_cluster_kph == pytest.approx(75 * CV.MPH_TO_KPH)
|
||||
|
||||
def test_reverse_cruise_increase_swaps_short_and_long_press_intervals(self):
|
||||
self.enable(55 * CV.MPH_TO_MS, experimental_mode=False)
|
||||
initial_v_cruise_kph = self.v_cruise_helper.v_cruise_kph
|
||||
|
||||
Reference in New Issue
Block a user