diff --git a/selfdrive/ui/layouts/settings/starpilot/panel.py b/selfdrive/ui/layouts/settings/starpilot/panel.py index ecfbdf970..4804b4b6e 100644 --- a/selfdrive/ui/layouts/settings/starpilot/panel.py +++ b/selfdrive/ui/layouts/settings/starpilot/panel.py @@ -17,14 +17,9 @@ import time class SettingsParamsWrapper: - """ - Proxy for ui_state.params. Relies on CachedParams for global TTL caching. - Intercepts UI writes (put/remove) to trigger system migrations automatically. - """ def __init__(self): self._params = ui_state.params - # --- Read Operations (Forwarded directly to global TTL cache) --- def get(self, key, **kwargs): return self._params.get(key, **kwargs) @@ -38,10 +33,8 @@ class SettingsParamsWrapper: return self._params.get_float(key, **kwargs) def _notify_changed(self): - # Triggers backend state sync when UI settings are modified update_starpilot_toggles() - # --- Write Operations (Triggers side-effects) --- def put(self, key, val, **kwargs): self._params.put(key, val, **kwargs) self._notify_changed() @@ -62,7 +55,6 @@ class SettingsParamsWrapper: self._params.remove(key) self._notify_changed() - # Safety net for any newly added parameter methods def __getattr__(self, name): return getattr(self._params, name) diff --git a/selfdrive/ui/ui_state.py b/selfdrive/ui/ui_state.py index 08d45b9c9..e7098c67c 100644 --- a/selfdrive/ui/ui_state.py +++ b/selfdrive/ui/ui_state.py @@ -17,10 +17,6 @@ from openpilot.system.hardware import HARDWARE, PC BACKLIGHT_OFFROAD = 65 if HARDWARE.get_device_type() == "mici" else 50 USBGPU_POLL_INTERVAL = 1.0 class CachedParams: - """ - Global TTL-based cache for Params() to prevent excessive disk/IPC reads. - Dynamically wraps read methods (get*) to cache values and write methods (put*) to invalidate stale cache. - """ def __init__(self, ttl: float = 1.0): self._params = Params() self._cache = {} @@ -28,7 +24,6 @@ class CachedParams: self._ttl = ttl def _invalidate(self, key=None): - # Clears specific key or entire cache to guarantee fresh reads after writes if key is None: self._cache.clear() else: @@ -44,7 +39,6 @@ class CachedParams: return attr if name.startswith("get"): - # Intercept reads to serve from RAM if TTL is valid def get_wrapper(key, *args, **kwargs): now = time.monotonic() k_str = key.decode("utf-8") if isinstance(key, bytes) else str(key) @@ -59,7 +53,6 @@ class CachedParams: return get_wrapper if name.startswith("put") or name.startswith("remove") or name.startswith("clear"): - # Intercept writes to immediately invalidate stale data def put_wrapper(key=None, *args, **kwargs): res = attr(key, *args, **kwargs) if key is not None else attr(*args, **kwargs) self._invalidate(key)