From 86753ea93db7638994a4f5a1b77cf9ce51221f2a Mon Sep 17 00:00:00 2001 From: Adeeb Shihadeh Date: Tue, 21 Jul 2026 21:01:19 -0700 Subject: [PATCH] better alerts (#38403) * better alerts * just rm that * lil more --- openpilot/selfdrive/selfdrived/events.py | 6 +++--- openpilot/selfdrive/ui/mici/onroad/alert_renderer.py | 11 ++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/openpilot/selfdrive/selfdrived/events.py b/openpilot/selfdrive/selfdrived/events.py index 772b35f7cb..220efd9c18 100755 --- a/openpilot/selfdrive/selfdrived/events.py +++ b/openpilot/selfdrive/selfdrived/events.py @@ -622,7 +622,7 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = { # Thrown when the fan is driven at >50% but is not rotating EventName.fanMalfunction: { - ET.PERMANENT: NormalPermanentAlert("Fan Malfunction", "Likely Hardware Issue"), + ET.PERMANENT: NormalPermanentAlert("Fan Malfunction", "Contact comma.ai/support"), }, # Camera is not outputting frames @@ -773,7 +773,7 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = { EventName.sensorDataInvalid: { ET.PERMANENT: Alert( "Sensor Data Invalid", - "Possible Hardware Issue", + "Contact comma.ai/support", AlertStatus.normal, AlertSize.mid, Priority.LOWER, VisualAlert.none, AudibleAlert.none, .2, creation_delay=1.), ET.NO_ENTRY: NoEntryAlert("Sensor Data Invalid"), @@ -965,7 +965,7 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = { # and this alert is thrown. EventName.relayMalfunction: { ET.IMMEDIATE_DISABLE: ImmediateDisableAlert("Harness Relay Malfunction"), - ET.PERMANENT: NormalPermanentAlert("Harness Relay Malfunction", "Check Hardware"), + ET.PERMANENT: NormalPermanentAlert("Harness Relay Malfunction", "Contact comma.ai/support"), ET.NO_ENTRY: NoEntryAlert("Harness Relay Malfunction"), }, diff --git a/openpilot/selfdrive/ui/mici/onroad/alert_renderer.py b/openpilot/selfdrive/ui/mici/onroad/alert_renderer.py index e2e398a4e1..12b62924c4 100644 --- a/openpilot/selfdrive/ui/mici/onroad/alert_renderer.py +++ b/openpilot/selfdrive/ui/mici/onroad/alert_renderer.py @@ -296,13 +296,10 @@ class AlertRenderer(Widget): # TODO: hack alert_text1 = alert.text1.lower().replace('calibrating: ', 'calibrating:\n') - can_draw_second_line = False # TODO: there should be a common way to determine font size based on text length to maximize rect if len(alert_text1) <= 12: - can_draw_second_line = True font_size = 92 - 10 elif len(alert_text1) <= 16: - can_draw_second_line = True font_size = 70 else: font_size = 64 - 10 @@ -334,13 +331,13 @@ class AlertRenderer(Widget): self._text_gen_time = time.monotonic() alert_text2 = self._alert_text2_gen or alert_text2 - if can_draw_second_line and alert_text2: + if alert_text2: last_line_h = self._alert_text1_label.rect.y + self._alert_text1_label.get_content_height(int(alert_layout.text_rect.width)) last_line_h -= 4 - if len(alert_text2) > 18: - small_font_size = 36 - elif len(alert_text2) > 24: + if len(alert_text2) > 24: small_font_size = 32 + elif len(alert_text2) > 18: + small_font_size = 36 else: small_font_size = 40 text_rect2 = rl.Rectangle(