diff --git a/common/params_keys.h b/common/params_keys.h index 99e14029fb..c9b2d6ee85 100644 --- a/common/params_keys.h +++ b/common/params_keys.h @@ -474,6 +474,7 @@ inline static std::unordered_map keys = { {"ShowGPU", {PERSISTENT, BOOL, "0", "0", 3}}, {"ShowIP", {PERSISTENT, BOOL, "0", "0", 3}}, {"ShowMemoryUsage", {PERSISTENT, BOOL, "1", "0", 3}}, + {"ShowModeStatusBanner", {PERSISTENT, BOOL, "1", "0", 2}}, {"ShownToggleDescriptions", {PERSISTENT, JSON, "{}", "{}"}}, {"ShowSLCOffset", {PERSISTENT, BOOL, "1", "0", 0}}, {"ShowSpeedLimits", {PERSISTENT, BOOL, "1", "0", 1}}, diff --git a/selfdrive/ui/lib/starpilot_mode_banner.py b/selfdrive/ui/lib/starpilot_mode_banner.py index c74fffd63c..8c1facc1df 100644 --- a/selfdrive/ui/lib/starpilot_mode_banner.py +++ b/selfdrive/ui/lib/starpilot_mode_banner.py @@ -27,12 +27,18 @@ class ModeTransitionBanner: ) def update(self): + current_mode = get_mode_transition_banner_text(ui_state) if ui_state.started else None + if not ui_state.started: self._last_mode = None self._visible_until = 0.0 return - current_mode = get_mode_transition_banner_text(ui_state) + if not ui_state.params.get_bool("ShowModeStatusBanner", default=True): + self._last_mode = current_mode + self._visible_until = 0.0 + return + if self._last_mode is None: self._last_mode = current_mode return @@ -44,7 +50,9 @@ class ModeTransitionBanner: self._visible_until = time.monotonic() + self.SHOW_TIME_SECONDS def render(self, rect: rl.Rectangle): - if not ui_state.started or time.monotonic() > self._visible_until: + if (not ui_state.started or + not ui_state.params.get_bool("ShowModeStatusBanner", default=True) or + time.monotonic() > self._visible_until): return banner_width = min(rect.width - 120, self._width) diff --git a/starpilot/system/the_pond/assets/components/tools/device_settings_layout.json b/starpilot/system/the_pond/assets/components/tools/device_settings_layout.json index 58ed55774f..aafa00513c 100644 --- a/starpilot/system/the_pond/assets/components/tools/device_settings_layout.json +++ b/starpilot/system/the_pond/assets/components/tools/device_settings_layout.json @@ -1697,6 +1697,14 @@ "ui_type": "toggle", "parent_key": "CustomUI" }, + { + "key": "ShowModeStatusBanner", + "label": "Show Mode Status Banner", + "description": "Show a popup banner when the Python driving UIs switch into chill, experimental, switchback, or override mode.", + "data_type": "bool", + "ui_type": "toggle", + "parent_key": "CustomUI" + }, { "key": "AdjacentPath", "label": "Adjacent Lanes", diff --git a/tools/StarPilot/feasibleparams.txt b/tools/StarPilot/feasibleparams.txt index 1ef8f11d76..d1e8ab63f0 100644 --- a/tools/StarPilot/feasibleparams.txt +++ b/tools/StarPilot/feasibleparams.txt @@ -261,6 +261,7 @@ ShowCSCStatus ShowGPU ShowIP ShowMemoryUsage +ShowModeStatusBanner ShowSLCOffset ShowSpeedLimits ShowSteering