system/ui: fix cruise disabled state displaying "?" instead of "–" (#35416)

fix curise disabled state showed '?'
pull/35418/head
Dean Lee 1 week ago committed by GitHub
parent 74541e677c
commit 79f3f30c63
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      system/ui/lib/application.py
  2. 3
      system/ui/onroad/hud_renderer.py

@ -192,10 +192,12 @@ class GuiApplication:
# Create a character set from our keyboard layouts
from openpilot.system.ui.widgets.keyboard import KEYBOARD_LAYOUTS
from openpilot.system.ui.onroad.hud_renderer import CRUISE_DISABLED_CHAR
all_chars = set()
for layout in KEYBOARD_LAYOUTS.values():
all_chars.update(key for row in layout for key in row)
all_chars = "".join(all_chars)
all_chars += CRUISE_DISABLED_CHAR
codepoint_count = rl.ffi.new("int *", 1)
codepoints = rl.load_codepoints(all_chars, codepoint_count)

@ -8,6 +8,7 @@ from enum import IntEnum
# Constants
SET_SPEED_NA = 255
KM_TO_MILE = 0.621371
CRUISE_DISABLED_CHAR = ''
@dataclass(frozen=True)
@ -153,7 +154,7 @@ class HudRenderer:
max_color,
)
set_speed_text = "" if not self.is_cruise_set else str(round(self.set_speed))
set_speed_text = CRUISE_DISABLED_CHAR if not self.is_cruise_set else str(round(self.set_speed))
speed_text_width = self._measure_text(set_speed_text, self._font_bold, FONT_SIZES.set_speed, 'bold').x
rl.draw_text_ex(
self._font_bold,

Loading…
Cancel
Save