mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-10 18:23:44 +08:00
free the clusters
This commit is contained in:
@@ -130,9 +130,6 @@ class VehicleSettingsManagerView(PanelManagerView):
|
||||
float(self._controller._params.get_int("LockDoorsTimer")),
|
||||
f"{self._controller._params.get_int('LockDoorsTimer')}s"),
|
||||
on_click=lambda: self._controller._on_select("LockDoorsTimer")))
|
||||
rows.append(SettingRow("ClusterOffset", "value", tr_noop("Dashboard Speed Offset"),
|
||||
get_value=lambda: f"{self._controller._params.get_float('ClusterOffset'):.3f}x",
|
||||
on_click=lambda: self._controller._on_select("ClusterOffset")))
|
||||
return rows
|
||||
|
||||
def _combo_value(self, keys: tuple[str, ...]) -> str:
|
||||
@@ -720,8 +717,6 @@ class StarPilotVehicleSettingsLayout(_SettingsPage):
|
||||
self._on_select_model()
|
||||
elif key == "LockDoorsTimer":
|
||||
self._show_lock_timer_selector()
|
||||
elif key == "ClusterOffset":
|
||||
self._show_offset_selector()
|
||||
else:
|
||||
self._show_action_picker(key)
|
||||
|
||||
@@ -843,15 +838,6 @@ class StarPilotVehicleSettingsLayout(_SettingsPage):
|
||||
self._params.get_int("LockDoorsTimer"), on_close,
|
||||
labels=_lock_doors_timer_labels(), color=PANEL_STYLE.accent))
|
||||
|
||||
def _show_offset_selector(self):
|
||||
def on_close(res, val):
|
||||
if res == DialogResult.CONFIRM:
|
||||
self._params.put_float("ClusterOffset", float(val))
|
||||
|
||||
gui_app.push_widget(AetherSliderDialog(tr("Dashboard Speed Offset"), 1.000, 1.050, 0.001,
|
||||
self._params.get_float("ClusterOffset"), on_close,
|
||||
unit="x", color=PANEL_STYLE.accent))
|
||||
|
||||
def _get_display_make(self) -> str:
|
||||
make = self._params.get("CarMake") or ""
|
||||
if make:
|
||||
|
||||
@@ -3653,17 +3653,6 @@
|
||||
"galaxy_only": true,
|
||||
"settings_tier": "simple"
|
||||
},
|
||||
{
|
||||
"key": "ClusterOffset",
|
||||
"label": "Dashboard Speed Offset",
|
||||
"description": "The speed offset openpilot uses to match the speed on the dashboard display.",
|
||||
"data_type": "float",
|
||||
"ui_type": "numeric",
|
||||
"min": 1.0,
|
||||
"max": 1.05,
|
||||
"step": 0.001,
|
||||
"settings_tier": "simple"
|
||||
},
|
||||
{
|
||||
"key": "SNGHack",
|
||||
"label": "Stop-and-Go Hack",
|
||||
@@ -4881,6 +4870,19 @@
|
||||
"is_parent_toggle": true,
|
||||
"settings_tier": "simple"
|
||||
},
|
||||
{
|
||||
"key": "ClusterOffset",
|
||||
"label": "Dashboard Speed Offset",
|
||||
"description": "Multiplier for dashboard speed. 1x = no offset; 1.05x = 5% faster.",
|
||||
"data_type": "float",
|
||||
"ui_type": "numeric",
|
||||
"unit": "x",
|
||||
"min": 1.0,
|
||||
"max": 1.05,
|
||||
"step": 0.001,
|
||||
"parent_key": "GalaxyDeveloperMode",
|
||||
"settings_tier": "advanced"
|
||||
},
|
||||
{
|
||||
"key": "GalaxyMobileDefault",
|
||||
"label": "Use Galaxy (new) by Default",
|
||||
|
||||
@@ -880,7 +880,7 @@ class StarPilotVariables:
|
||||
toggle.car_model = car_model
|
||||
|
||||
self.migrate_prius_cluster_offset(str(toggle.car_model))
|
||||
toggle.cluster_offset = self.get_value("ClusterOffset", cast=float, condition=toggle.car_make == "toyota")
|
||||
toggle.cluster_offset = self.get_value("ClusterOffset", cast=float)
|
||||
|
||||
toggle.longitudinal_mode_values = mode_values
|
||||
toggle.experimental_mode = toggle.experimental_mode_available and not toggle.safe_mode and mode_values["ExperimentalMode"]
|
||||
|
||||
@@ -83,7 +83,6 @@ const VEHICLE_SETTING_MAKES = {
|
||||
SubaruSNGManualParkingBrake: ["Subaru"],
|
||||
SubaruStopStartOff: ["Subaru"],
|
||||
SubaruRedneckCruise: ["Subaru"],
|
||||
ClusterOffset: ["Lexus", "Toyota"],
|
||||
SNGHack: ["Lexus", "Toyota"],
|
||||
ToyotaAutoHold: ["Lexus", "Toyota"],
|
||||
}
|
||||
|
||||
@@ -70,7 +70,6 @@ const VEHICLE_SETTING_MAKES = {
|
||||
SubaruSNGManualParkingBrake: ["Subaru"],
|
||||
SubaruStopStartOff: ["Subaru"],
|
||||
SubaruRedneckCruise: ["Subaru"],
|
||||
ClusterOffset: ["Lexus", "Toyota"],
|
||||
SNGHack: ["Lexus", "Toyota"],
|
||||
ToyotaAutoHold: ["Lexus", "Toyota"],
|
||||
}
|
||||
|
||||
@@ -345,6 +345,31 @@ def test_toyota_auto_hold_is_galaxy_only():
|
||||
assert setting["data_type"] == "bool"
|
||||
|
||||
|
||||
def test_cluster_offset_is_in_galaxy_developer_section_only():
|
||||
sections = _params_by_section(_layout())
|
||||
assert "ClusterOffset" not in sections["Vehicle"]
|
||||
setting = sections["Developer"]["ClusterOffset"]
|
||||
|
||||
assert setting["parent_key"] == "GalaxyDeveloperMode"
|
||||
assert setting["settings_tier"] == "advanced"
|
||||
assert setting["data_type"] == "float"
|
||||
assert "1x = no offset" in setting["description"]
|
||||
assert setting["unit"] == "x"
|
||||
assert setting["min"] == 1.0
|
||||
assert setting["max"] == 1.05
|
||||
assert setting["step"] == 0.001
|
||||
|
||||
native_vehicle_settings = REPO_ROOT / "selfdrive/ui/layouts/settings/starpilot/vehicle.py"
|
||||
native_source = native_vehicle_settings.read_text(encoding="utf-8")
|
||||
assert 'SettingRow("ClusterOffset"' not in native_source
|
||||
assert "def _show_offset_selector" not in native_source
|
||||
|
||||
for galaxy_source in (
|
||||
REPO_ROOT / "starpilot/system/the_galaxy/assets/components/tools/device_settings.js",
|
||||
REPO_ROOT / "starpilot/system/the_galaxy/assets/mobile/js/params.js",
|
||||
):
|
||||
assert "ClusterOffset:" not in galaxy_source.read_text(encoding="utf-8")
|
||||
|
||||
def test_human_acceleration_param_is_removed():
|
||||
params_source = PARAM_KEYS_PATH.read_text(encoding="utf-8")
|
||||
assert '{"HumanAcceleration",' not in params_source
|
||||
|
||||
@@ -690,6 +690,11 @@ assert(P.isSettingVisible(sec, sec.params[1], {}) === false, "advanced hidden (o
|
||||
assert(P.isSettingVisible(sec, sec.params[1], { GalaxyDeveloperMode: true }) === true, "advanced visible (on)")
|
||||
assert(P.countAdvancedHiddenByDeveloperMode([sec], {}) === 1, "count hidden (off)")
|
||||
assert(P.countAdvancedHiddenByDeveloperMode([sec], { GalaxyDeveloperMode: true }) === 0, "count hidden (on)")
|
||||
const developer = { name: "Developer", params: [] }
|
||||
const clusterOffset = { key: "ClusterOffset", parent_key: "GalaxyDeveloperMode", settings_tier: "advanced", data_type: "float" }
|
||||
assert(P.isVehicleSettingVisible(developer, clusterOffset, { CarMake: "gm" }) === true, "cluster offset has no vehicle filter")
|
||||
assert(P.isSettingVisible(developer, clusterOffset, { CarMake: "gm" }) === false, "cluster offset hidden without developer mode")
|
||||
assert(P.isSettingVisible(developer, clusterOffset, { CarMake: "gm", GalaxyDeveloperMode: true }) === true, "cluster offset visible in developer mode")
|
||||
const slider = { key: "DeviceShutdown", data_type: "int", min: 1, max: 30, step: 1 }
|
||||
assert(P.snapNumericToBoundsAndStep(17.9, P.numericBounds(slider, {}), 0) === 18, "snap")
|
||||
assert(P.formatSliderValue(6, "1", 0, "DeviceShutdown") === "6 hours", "format")
|
||||
|
||||
Reference in New Issue
Block a user