Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(robot-server): Pulse status bar yellow during error recovery #15957

Merged
merged 2 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ async def _status_bar_software_error(self) -> None:
if self._enabled:
await self._controller.static_color(status_bar.YELLOW)

async def _status_bar_error_recovery(self) -> None:
self._status_bar_state = StatusBarState.ERROR_RECOVERY
if self._enabled:
await self._controller.pulse_color(status_bar.YELLOW)

async def _status_bar_confirm(self) -> None:
# Confirm should revert to IDLE
self._status_bar_state = StatusBarState.IDLE
Expand Down Expand Up @@ -163,6 +168,7 @@ async def set_status_bar_state(self, state: StatusBarState) -> None:
StatusBarState.PAUSED: self._status_bar_paused,
StatusBarState.HARDWARE_ERROR: self._status_bar_hardware_error,
StatusBarState.SOFTWARE_ERROR: self._status_bar_software_error,
StatusBarState.ERROR_RECOVERY: self._status_bar_error_recovery,
StatusBarState.CONFIRMATION: self._status_bar_confirm,
StatusBarState.RUN_COMPLETED: self._status_bar_run_complete,
StatusBarState.UPDATING: self._status_bar_updating,
Expand Down
28 changes: 17 additions & 11 deletions api/src/opentrons/hardware_control/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,17 +572,23 @@ class PauseType(enum.Enum):


class StatusBarState(enum.Enum):
IDLE = 0
RUNNING = 1
PAUSED = 2
HARDWARE_ERROR = 3
SOFTWARE_ERROR = 4
CONFIRMATION = 5
RUN_COMPLETED = 6
UPDATING = 7
ACTIVATION = 8
DISCO = 9
OFF = 10
"""Semantic status bar states.

These mostly correspond to cases listed out in the Flex manual.
"""

IDLE = enum.auto()
RUNNING = enum.auto()
PAUSED = enum.auto()
HARDWARE_ERROR = enum.auto()
SOFTWARE_ERROR = enum.auto()
ERROR_RECOVERY = enum.auto()
CONFIRMATION = enum.auto()
RUN_COMPLETED = enum.auto()
UPDATING = enum.auto()
ACTIVATION = enum.auto()
DISCO = enum.auto()
OFF = enum.auto()

def transient(self) -> bool:
return self.value in {
Expand Down
8 changes: 4 additions & 4 deletions robot-server/robot_server/runs/light_control_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ def _engine_status_to_status_bar(
return StatusBarState.IDLE if initialization_done else StatusBarState.OFF
case EngineStatus.RUNNING:
return StatusBarState.RUNNING
case EngineStatus.PAUSED | EngineStatus.BLOCKED_BY_OPEN_DOOR:
return StatusBarState.PAUSED
case (
EngineStatus.PAUSED
| EngineStatus.BLOCKED_BY_OPEN_DOOR
| EngineStatus.AWAITING_RECOVERY
EngineStatus.AWAITING_RECOVERY
| EngineStatus.AWAITING_RECOVERY_PAUSED
| EngineStatus.AWAITING_RECOVERY_BLOCKED_BY_OPEN_DOOR
):
return StatusBarState.PAUSED
return StatusBarState.ERROR_RECOVERY
case EngineStatus.STOP_REQUESTED | EngineStatus.FINISHING:
return StatusBarState.UPDATING
case EngineStatus.STOPPED:
Expand Down
Loading