From 79f3f30c6367a06f0e3b83c042d49b3e98a550b8 Mon Sep 17 00:00:00 2001 From: Dean Lee Date: Mon, 2 Jun 2025 03:39:09 +0800 Subject: [PATCH] =?UTF-8?q?system/ui:=20fix=20cruise=20disabled=20state=20?= =?UTF-8?q?displaying=20"=3F"=20instead=20of=20"=E2=80=93"=20(#35416)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix curise disabled state showed '?' --- system/ui/lib/application.py | 2 ++ system/ui/onroad/hud_renderer.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/system/ui/lib/application.py b/system/ui/lib/application.py index 9bb56fec8d..a8b55b9e79 100644 --- a/system/ui/lib/application.py +++ b/system/ui/lib/application.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) diff --git a/system/ui/onroad/hud_renderer.py b/system/ui/onroad/hud_renderer.py index b63b50f26d..ee182daef8 100644 --- a/system/ui/onroad/hud_renderer.py +++ b/system/ui/onroad/hud_renderer.py @@ -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,