ui: fix Immediate ALERT_STARTUP_PENDING after going onroad (#35509)

fix timeout alerts could appear immediately after going onroad
revert-fan
Dean Lee 1 week ago committed by GitHub
parent 08aeeabc9b
commit fc27423ac2
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 12
      selfdrive/ui/onroad/alert_renderer.py

@ -72,13 +72,15 @@ class AlertRenderer(Widget):
# Check if selfdriveState messages have stopped arriving
if not sm.updated['selfdriveState']:
recv_frame = sm.recv_frame['selfdriveState']
if (sm.frame - recv_frame) > 5 * DEFAULT_FPS:
# Check if waiting to start
if recv_frame < ui_state.started_frame:
time_since_onroad = (sm.frame - ui_state.started_frame) / DEFAULT_FPS
# 1. Never received selfdriveState since going onroad
waiting_for_startup = recv_frame < ui_state.started_frame
if waiting_for_startup and time_since_onroad > 5:
return ALERT_STARTUP_PENDING
# Handle selfdrive timeout
if TICI:
# 2. Lost communication with selfdriveState after receiving it
if TICI and not waiting_for_startup:
ss_missing = time.monotonic() - sm.recv_time['selfdriveState']
if ss_missing > SELFDRIVE_STATE_TIMEOUT:
if ss.enabled and (ss_missing - SELFDRIVE_STATE_TIMEOUT) < SELFDRIVE_UNRESPONSIVE_TIMEOUT:

Loading…
Cancel
Save