Skip to content

Commit

Permalink
feat(robot-server): Pulse status bar yellow during error recovery (#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
SyntaxColoring authored Aug 9, 2024
1 parent def8db3 commit e54341a
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 15 deletions.
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

0 comments on commit e54341a

Please sign in to comment.