mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-29 02:43:47 +08:00
make banner optional
This commit is contained in:
@@ -474,6 +474,7 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> 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}},
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -261,6 +261,7 @@ ShowCSCStatus
|
||||
ShowGPU
|
||||
ShowIP
|
||||
ShowMemoryUsage
|
||||
ShowModeStatusBanner
|
||||
ShowSLCOffset
|
||||
ShowSpeedLimits
|
||||
ShowSteering
|
||||
|
||||
Reference in New Issue
Block a user