Daz Alot of Toggies

This commit is contained in:
firestar5683
2026-08-06 18:25:47 -05:00
parent 48d6adab46
commit bbbfc46601
16 changed files with 113 additions and 43 deletions
+25 -1
View File
@@ -33,6 +33,7 @@ LATERAL_METHOD_REBRAND_MIGRATION_MARKER = ".starpilot_lateral_method_rebrand_v1"
VISION_SPEED_LIMIT_DETECTION_MIGRATION_MARKER = ".starpilot_vision_speed_limit_detection_v1"
DEVELOPER_METRIC_DISPLAY_MIGRATION_MARKER = ".starpilot_developer_metric_display_off_v1"
LANE_CHANGE_SMOOTHING_MIGRATION_MARKER = ".starpilot_lane_change_smoothing_default_v1"
SPEED_LIMIT_VISIBILITY_MIGRATION_MARKER = ".starpilot_speed_limit_visibility_v1"
MARKER_DIRNAME = ".starpilot_param_migrations"
LATERAL_METHOD_PARAM_SUFFIXES = (
@@ -126,6 +127,10 @@ def _lane_change_smoothing_marker_path(params: ParamsLike) -> Path:
return _marker_dir_path(params) / LANE_CHANGE_SMOOTHING_MIGRATION_MARKER
def _speed_limit_visibility_marker_path(params: ParamsLike) -> Path:
return _marker_dir_path(params) / SPEED_LIMIT_VISIBILITY_MIGRATION_MARKER
def _marker_dir_path(params: ParamsLike) -> Path:
params_path = Path(params.get_param_path())
# Params.clear_all() removes unknown files inside the params directory, so
@@ -270,6 +275,21 @@ def _apply_lane_change_smoothing_default_migration(params: ParamsLike, marker: P
marker.touch()
def _apply_speed_limit_visibility_migration(params: ParamsLike, marker: Path) -> None:
if marker.exists():
return
marker.parent.mkdir(parents=True, exist_ok=True)
# Preserve users who explicitly enabled the legacy hide control while making
# ShowSpeedLimits the only visibility setting used by the raylib UIs.
if params.get_bool("HideSpeedLimit"):
params.put_bool("ShowSpeedLimits", False)
params.put_bool("HideSpeedLimit", False)
marker.touch()
def apply_launch_param_migrations(params: ParamsLike, marker_path: Path | None = None,
branch_defaults_marker_path: Path | None = None,
acceleration_profile_marker_path: Path | None = None,
@@ -277,7 +297,8 @@ def apply_launch_param_migrations(params: ParamsLike, marker_path: Path | None =
lateral_method_rebrand_marker_path: Path | None = None,
vision_speed_limit_detection_marker_path: Path | None = None,
developer_metric_display_marker_path: Path | None = None,
lane_change_smoothing_marker_path: Path | None = None) -> None:
lane_change_smoothing_marker_path: Path | None = None,
speed_limit_visibility_marker_path: Path | None = None) -> None:
_apply_legacy_launch_param_migrations(params, marker_path or _default_marker_path(params))
# Keep branch-default rollout on its own marker so older installs that already
# have the legacy marker still receive this one-time param reset.
@@ -298,6 +319,9 @@ def apply_launch_param_migrations(params: ParamsLike, marker_path: Path | None =
_apply_lane_change_smoothing_default_migration(
params, lane_change_smoothing_marker_path or _lane_change_smoothing_marker_path(params)
)
_apply_speed_limit_visibility_migration(
params, speed_limit_visibility_marker_path or _speed_limit_visibility_marker_path(params)
)
def main() -> int:
@@ -12,6 +12,7 @@ from openpilot.system.manager.launch_param_migrations import (
LATERAL_METHOD_REBRAND_MIGRATION_MARKER,
MARKER_DIRNAME,
STANDARD_ACCELERATION_PROFILE,
SPEED_LIMIT_VISIBILITY_MIGRATION_MARKER,
USE_OLD_UI_MIGRATION_MARKER,
VISION_SPEED_LIMIT_DETECTION_MIGRATION_MARKER,
apply_launch_param_migrations,
@@ -113,6 +114,35 @@ def test_apply_launch_param_migrations_does_not_reapply_after_marker(tmp_path):
assert params.get_float("SteerKPStock") == DEFAULT_STEER_KP
def test_apply_launch_param_migrations_converts_legacy_speed_limit_hide_once(tmp_path):
params = FileBackedFakeParams(tmp_path / "params")
params.put_bool("ShowSpeedLimits", True)
params.put_bool("HideSpeedLimit", True)
apply_launch_param_migrations(params)
assert not params.get_bool("ShowSpeedLimits")
assert not params.get_bool("HideSpeedLimit")
assert marker_path(tmp_path, SPEED_LIMIT_VISIBILITY_MIGRATION_MARKER).is_file()
def test_apply_launch_param_migrations_preserves_speed_limit_visibility_choice(tmp_path):
params = FileBackedFakeParams(tmp_path / "params")
params.put_bool("ShowSpeedLimits", False)
params.put_bool("HideSpeedLimit", False)
marker = marker_path(tmp_path, SPEED_LIMIT_VISIBILITY_MIGRATION_MARKER)
apply_launch_param_migrations(params)
assert not params.get_bool("ShowSpeedLimits")
assert not params.get_bool("HideSpeedLimit")
assert marker.is_file()
params.put_bool("ShowSpeedLimits", True)
apply_launch_param_migrations(params)
assert params.get_bool("ShowSpeedLimits")
def test_apply_launch_param_migrations_applies_branch_defaults_for_existing_installs(tmp_path):
params = FileBackedFakeParams(tmp_path / "params")