mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-20 07:43:48 +08:00
Keep Redneck Cruise in Galaxy developer settings
This commit is contained in:
@@ -55,7 +55,7 @@ from openpilot.tools.lib.logreader import LogReader, ReadMode
|
||||
# Constants
|
||||
# ============================================================================
|
||||
|
||||
OVERPASS_API_URL = "https://maps.mail.ru/osm/tools/overpass/api/interpreter"
|
||||
OVERPASS_API_URL = "https://overpass-api.de/api/interpreter"
|
||||
OVERPASS_UA = "starpilot-diagnose-slc/1.0 (https://github.com/FrogAi/StarPilot)"
|
||||
|
||||
JWT_HELP_URL = "https://jwt.comma.ai/"
|
||||
@@ -672,8 +672,7 @@ class OverpassClient:
|
||||
if not gps:
|
||||
return {}
|
||||
|
||||
cache_input = {"endpoint": OVERPASS_API_URL, "gps": gps}
|
||||
key = hashlib.sha256(json.dumps(cache_input, sort_keys=True).encode()).hexdigest()[:16]
|
||||
key = hashlib.sha256(json.dumps(gps, sort_keys=True).encode()).hexdigest()[:16]
|
||||
cached = self._load_cache(key)
|
||||
if cached is not None:
|
||||
return cached
|
||||
|
||||
@@ -46,7 +46,6 @@ 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 = [
|
||||
@@ -421,13 +420,6 @@ 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
|
||||
|
||||
@@ -687,11 +679,6 @@ 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)
|
||||
|
||||
@@ -38,7 +38,6 @@ class StarPilotCarState:
|
||||
hasZSS: bool = False
|
||||
canUsePedal: bool = False
|
||||
canUseSDSU: bool = False
|
||||
redneckCruiseAvailable: bool = False
|
||||
|
||||
# ========== Device/Car State ==========
|
||||
isFrogsGoMoo: bool = False
|
||||
@@ -207,14 +206,12 @@ 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,7 +9,6 @@ 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
|
||||
@@ -196,10 +195,7 @@ 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))
|
||||
|
||||
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()
|
||||
vehicle_specific_widgets = tuple()
|
||||
|
||||
self._scroller.add_widgets([
|
||||
fingerprint_btn,
|
||||
|
||||
@@ -4066,6 +4066,15 @@
|
||||
"ui_type": "toggle",
|
||||
"settings_tier": "simple"
|
||||
},
|
||||
{
|
||||
"key": "RedneckCruise",
|
||||
"label": "Redneck Cruise",
|
||||
"description": "On supported Hyundai stock-cruise cars, use RES/SET button presses to match the cluster set speed to StarPilot's target.",
|
||||
"data_type": "bool",
|
||||
"ui_type": "toggle",
|
||||
"parent_key": "GalaxyDeveloperMode",
|
||||
"settings_tier": "advanced"
|
||||
},
|
||||
{
|
||||
"key": "UseOldUI",
|
||||
"label": "Use Old UI",
|
||||
|
||||
@@ -51,6 +51,7 @@ def test_galaxy_layout_contains_basic_mode_controls():
|
||||
"QOLLongitudinal",
|
||||
} <= sections["Longitudinal (Speed & Following)"].keys()
|
||||
assert "RedneckCruise" not in sections["Longitudinal (Speed & Following)"].keys()
|
||||
assert sections["Developer"]["RedneckCruise"]["parent_key"] == "GalaxyDeveloperMode"
|
||||
assert {"GalaxyDeveloperMode", "UseOldUI"} <= sections["Developer"].keys()
|
||||
|
||||
|
||||
@@ -121,6 +122,7 @@ def test_requested_simple_and_advanced_settings_tiers():
|
||||
assert developer["GalaxyDeveloperMode"]["settings_tier"] == "simple"
|
||||
assert developer["UseOldUI"]["settings_tier"] == "simple"
|
||||
assert developer["DeveloperUI"]["settings_tier"] == "advanced"
|
||||
assert developer["RedneckCruise"]["settings_tier"] == "advanced"
|
||||
|
||||
|
||||
def test_hidden_feature_defaults_remain_enabled():
|
||||
|
||||
Reference in New Issue
Block a user