From d4e29ec945377b98266fe217983b05c2aa4b1ba0 Mon Sep 17 00:00:00 2001 From: Daniel Koepping Date: Fri, 31 Jul 2026 11:26:03 -0700 Subject: [PATCH] fade out eGPU icon (#38506) Fade GPU logo on engagement --- .../selfdrive/ui/mici/onroad/hud_renderer.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/openpilot/selfdrive/ui/mici/onroad/hud_renderer.py b/openpilot/selfdrive/ui/mici/onroad/hud_renderer.py index 02f3fa1d98..2ea3f0c087 100644 --- a/openpilot/selfdrive/ui/mici/onroad/hud_renderer.py +++ b/openpilot/selfdrive/ui/mici/onroad/hud_renderer.py @@ -108,6 +108,7 @@ class HudRenderer(Widget): self.v_ego_cluster_seen: bool = False self._engaged: bool = False self._small_model_engaged: bool = False + self._egpu_fade_time: float = 0 self._can_draw_top_icons = True self._show_wheel_critical = False @@ -127,11 +128,13 @@ class HudRenderer(Widget): self._txt_egpu_green: rl.Texture = gui_app.texture('icons_mici/egpu_green.png', 60, 44) self._txt_egpu_orange: rl.Texture = gui_app.texture('icons_mici/egpu_orange.png', 60, 44) self._txt_egpu_crossed: rl.Texture = gui_app.texture('icons_mici/egpu_crossed.png', 60, 52) + self._egpu_icon: rl.Texture | None = None self._wheel_alpha_filter = FirstOrderFilter(0, 0.05, 1 / gui_app.target_fps) self._wheel_y_filter = FirstOrderFilter(0, 0.1, 1 / gui_app.target_fps) self._set_speed_alpha_filter = FirstOrderFilter(0.0, 0.1, 1 / gui_app.target_fps) + self._egpu_alpha_filter = FirstOrderFilter(0.0, 0.1, 1 / gui_app.target_fps) def set_wheel_critical_icon(self, critical: bool): """Set the wheel icon to critical or normal state.""" @@ -165,6 +168,8 @@ class HudRenderer(Widget): if (engaged and not self._engaged and not ui_state.usbgpu_loading and ui_state.usbgpu_active is not True and ui_state.sm.recv_frame['modelV2'] > ui_state.started_frame): self._small_model_engaged = True + if engaged and not self._engaged: + self._egpu_fade_time = rl.get_time() if (set_speed != self.set_speed and engaged) or (engaged and not self._engaged): self._set_speed_changed_time = rl.get_time() self._engaged = engaged @@ -200,7 +205,8 @@ class HudRenderer(Widget): not ui_state.sm.alive['modelV2']) or (ui_state.usbgpu_active is None and ui_state.sm.recv_frame['modelV2'] > ui_state.started_frame)) self._small_model_engaged &= big_failed - if ui_state.usbgpu_loading or (ui_state.usbgpu_active is None and not big_failed): + loading = ui_state.usbgpu_loading or (ui_state.usbgpu_active is None and not big_failed) + if loading: pulse = 0.5 - 0.5 * math.cos(rl.get_time() * 6.0) icon = self._txt_egpu opacity = 0.35 + 0.65 * pulse @@ -214,9 +220,16 @@ class HudRenderer(Widget): icon = self._txt_egpu_green opacity = 1.0 + if icon is not self._egpu_icon: + self._egpu_fade_time = rl.get_time() + self._egpu_icon = icon + alpha = self._egpu_alpha_filter.update(loading or 0 < rl.get_time() - self._egpu_fade_time < SET_SPEED_PERSISTENCE) + if alpha < 1e-2: + return + pos = rl.Vector2(rect.x + rect.width - 10 - icon.width, - rect.y + rect.height - 14 - (self._txt_wheel.height + icon.height) / 2) - rl.draw_texture_ex(icon, pos, 0.0, 1.0, rl.Color(255, 255, 255, int(255 * opacity))) + rect.y + rect.height - 14 - (self._txt_wheel.height + icon.height) / 2 + (1 - alpha) * icon.height / 2) + rl.draw_texture_ex(icon, pos, 0.0, 1.0, rl.Color(255, 255, 255, int(255 * opacity * alpha))) def _draw_steering_wheel(self, rect: rl.Rectangle) -> None: wheel_txt = self._txt_wheel_critical if self._show_wheel_critical else self._txt_wheel