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