offroad alert key

This commit is contained in:
firestar5683
2026-07-23 09:15:19 -05:00
parent fcc5cc359e
commit d4a3bc0f5c
@@ -14,6 +14,7 @@ from openpilot.system.ui.lib.application import gui_app, FontWeight
from openpilot.system.ui.lib.multilang import tr
REFRESH_INTERVAL = 5.0 # seconds
EXCESSIVE_ACTUATION_ALERT_KEY = "Offroad_ExcessiveActuation"
class AlertSize(IntEnum):
@@ -212,6 +213,10 @@ class MiciOffroadAlerts(Scroller):
def scrolling(self):
return self._scroller.scroll_panel.is_touch_valid()
def _acknowledge_excessive_actuation(self):
self.params.remove(EXCESSIVE_ACTUATION_ALERT_KEY)
self.refresh()
def _build_alerts(self):
"""Build sorted list of alerts from OFFROAD_ALERTS."""
self.sorted_alerts = []
@@ -232,6 +237,8 @@ class MiciOffroadAlerts(Scroller):
# Create alert item widget
alert_item = AlertItem(alert_data)
if key == EXCESSIVE_ACTUATION_ALERT_KEY:
alert_item.set_click_callback(self._acknowledge_excessive_actuation)
self.alert_items.append(alert_item)
self._scroller.add_widget(alert_item)
@@ -274,6 +281,8 @@ class MiciOffroadAlerts(Scroller):
if alert_json:
text = alert_json.get("text", "").replace("%1", alert_json.get("extra", ""))
if alert_data.key == EXCESSIVE_ACTUATION_ALERT_KEY:
text = f"{text} {tr('Tap to acknowledge.')}"
alert_data.text = text
alert_data.visible = bool(text)