mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-08-22 02:33:47 +08:00
@@ -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"),
|
||||
},
|
||||
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user