This commit is contained in:
firestarsdog
2026-08-05 11:06:29 -04:00
committed by firestar5683
parent 98a913693d
commit f7634ec761
16 changed files with 124 additions and 35 deletions
@@ -46,6 +46,7 @@ from openpilot.selfdrive.ui.lib.fingerprint_catalog import (
shorten_model_label,
)
from openpilot.starpilot.common.starpilot_variables import migrate_cancel_button_controls
from openpilot.selfdrive.ui.layouts.settings.common import restart_needed_callback
ACTION_OPTIONS = [
@@ -420,6 +421,13 @@ class VehicleSettingsManagerView(PanelManagerView):
"get_state": lambda: self._controller._params.get_bool("NostalgiaMode"),
"set_state": lambda s: self._controller._on_toggle("NostalgiaMode"),
})
if cs.redneckCruiseAvailable:
toggles.append({
"title": tr("Redneck Cruise"),
"subtitle": tr("Use RES/SET button presses to match the stock cruise set speed to StarPilot's target."),
"get_state": lambda: self._controller._params.get_bool("RedneckCruise"),
"set_state": lambda s: self._controller._on_toggle("RedneckCruise"),
})
return toggles
@@ -679,6 +687,11 @@ class StarPilotVehicleSettingsLayout(_SettingsPage):
migrate_cancel_button_controls(self._params)
starpilot_state.update(force=True)
return
if param_key == "RedneckCruise":
self._params.put_bool("RedneckCruise", not self._params.get_bool("RedneckCruise"))
starpilot_state.update(force=True)
restart_needed_callback(None)
return
current = self._params.get_bool(param_key) if self._params.get(param_key) is not None else False
self._params.put_bool(param_key, not current)
starpilot_state.update(force=True)
+3
View File
@@ -38,6 +38,7 @@ class StarPilotCarState:
hasZSS: bool = False
canUsePedal: bool = False
canUseSDSU: bool = False
redneckCruiseAvailable: bool = False
# ========== Device/Car State ==========
isFrogsGoMoo: bool = False
@@ -206,12 +207,14 @@ class StarPilotState:
# 2. Parse StarPilotCarParamsPersistent
fpcp_bytes = self.params.get("StarPilotCarParamsPersistent")
self.car_state.redneckCruiseAvailable = False
if fpcp_bytes is not None:
try:
FPCP = messaging.log_from_bytes(fpcp_bytes, custom.StarPilotCarParams)
self.car_state.canUsePedal = FPCP.canUsePedal
self.car_state.canUseSDSU = FPCP.canUseSDSU
self.car_state.openpilotLongitudinalControlDisabled = FPCP.openpilotLongitudinalControlDisabled
self.car_state.redneckCruiseAvailable = bool(FPCP.redneckCruiseAvailable)
except Exception:
pass
@@ -9,6 +9,7 @@ from openpilot.selfdrive.ui.lib.fingerprint_catalog import (
shorten_model_label,
)
from openpilot.selfdrive.ui.layouts.settings.common import restart_needed_callback
from openpilot.selfdrive.ui.lib.starpilot_state import starpilot_state
from openpilot.selfdrive.ui.ui_state import ui_state
from openpilot.system.ui.lib.application import gui_app, FontWeight
from openpilot.system.ui.lib.multilang import tr
@@ -195,10 +196,10 @@ class VehicleLayoutMici(NavScroller):
fingerprint_btn = BigButton("fingerprint", "",gui_app.texture("icons_mici/settings/vehicle/fingerprint.png", 58, 64))
fingerprint_btn.set_click_callback(lambda: gui_app.push_widget(fingerprint_panel))
# TODO: make it reloadable without restarting ui
match ui_state.params.get("CarModel"):
case _:
vehicle_specific_widgets = tuple()
starpilot_state.update(force=True)
vehicle_specific_widgets = (
BigParamControl("redneck cruise", "RedneckCruise", toggle_callback=restart_needed_callback),
) if starpilot_state.car_state.redneckCruiseAvailable else tuple()
self._scroller.add_widgets([
fingerprint_btn,
@@ -206,4 +207,3 @@ class VehicleLayoutMici(NavScroller):
])
self._font_medium = gui_app.font(FontWeight.MEDIUM)