mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-08-31 08:43:42 +08:00
ui: use full big model failure detection for sidebar and home eGPU icons (#1969)
This commit is contained in:
@@ -94,7 +94,7 @@ class SidebarSP:
|
||||
return default_img, default_pos, 1.0
|
||||
|
||||
big_model_selected = ui_state.usbgpu_compiled or ui_state.model_runner_tinygrad
|
||||
big_model_failed = ui_state.started and (ui_state.usbgpu_active is False)
|
||||
big_model_failed = ui_state.started and ui_state.big_model_failed
|
||||
loading = ui_state.usbgpu_loading or (big_model_selected and ui_state.started and ui_state.usbgpu_active is None)
|
||||
|
||||
if loading:
|
||||
|
||||
@@ -37,7 +37,7 @@ class MiciHomeLayoutSP(MiciHomeLayout):
|
||||
return
|
||||
|
||||
big_model_selected = ui_state.usbgpu_compiled or ui_state.model_runner_tinygrad
|
||||
big_model_failed = ui_state.started and (ui_state.usbgpu_active is False)
|
||||
big_model_failed = ui_state.started and ui_state.big_model_failed
|
||||
loading = ui_state.usbgpu_loading or (big_model_selected and ui_state.started and ui_state.usbgpu_active is None)
|
||||
|
||||
if loading:
|
||||
|
||||
@@ -112,6 +112,15 @@ class UIState(UIStateSP):
|
||||
def add_on_body_changed_callbacks(self, callback: Callable[[], None]):
|
||||
self._on_body_changed_callbacks.append(callback)
|
||||
|
||||
@property
|
||||
def big_model_failed(self) -> bool:
|
||||
# Mirrors the onroad HUD's four-condition check so sidebar and home icons reflect the same failure states
|
||||
return (self.usbgpu_active is False or
|
||||
not self.sm['deviceState'].chestnutPresent or
|
||||
(self.usbgpu_active is True and self.sm.recv_frame['modelV2'] > self.started_frame and
|
||||
not self.sm.alive['modelV2']) or
|
||||
(self.usbgpu_active is None and self.sm.recv_frame['modelV2'] > self.started_frame))
|
||||
|
||||
@property
|
||||
def engaged(self) -> bool:
|
||||
return self.started and (self.sm["selfdriveState"].enabled or self.sm["selfdriveStateSP"].mads.enabled)
|
||||
|
||||
Reference in New Issue
Block a user