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

feature(hardware): add a warning style to can_mon and an "estop_released" error id #11924

Merged
merged 3 commits into from
Jan 3, 2023
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
2 changes: 2 additions & 0 deletions hardware/opentrons_hardware/drivers/gpio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from typing_extensions import Final
from unittest import mock
from logging import getLogger
from time import sleep

CONSUMER_NAME_DEFAULT: Final[str] = "opentrons"
ESTOP_OUT_GPIO_NAME: Final[str] = "SODIMM_210"
Expand Down Expand Up @@ -47,6 +48,7 @@ def __init__(self, consumer_name: Optional[str] = None) -> None:
)
self.deactivate_estop()
self.deactivate_nsync_out()
sleep(1)

def activate_estop(self) -> None:
"""Assert the emergency stop, which will disable all motors."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ class ErrorCode(int, Enum):
estop_detected = 0x07
collision_detected = 0x08
labware_dropped = 0x09
estop_released = 0x0A


@unique
Expand Down
21 changes: 18 additions & 3 deletions hardware/opentrons_hardware/scripts/can_mon.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import sys
from datetime import datetime
from logging.config import dictConfig
from typing import List, TextIO
from typing import List, TextIO, cast

from opentrons_hardware.drivers.can_bus import (
build,
Expand All @@ -18,6 +18,10 @@
from opentrons_hardware.firmware_bindings.constants import (
MessageId,
NodeId,
ErrorSeverity,
)
from opentrons_hardware.firmware_bindings.messages.message_definitions import (
ErrorMessage,
)

from opentrons_hardware.scripts.can_args import add_can_args, build_settings
Expand Down Expand Up @@ -89,6 +93,9 @@ async def task(
info_header_style = "\033[0;36;40m"
info_data_style = "\033[1;36;40m"

warn_header_style = "\033[0;33;40m"
warn_data_style = "\033[1;33;40m"

err_header_style = "\033[0;31;40m"
err_data_style = "\033[1;31;40m"

Expand All @@ -103,8 +110,16 @@ async def task(
arb_id_str = f"0x{arbitration_id.id:x}"

if arbitration_id.parts.message_id == MessageId.error_message:
header_style = err_header_style
data_style = err_data_style
err_msg = err_msg = cast(ErrorMessage, message)
if (
ErrorSeverity(err_msg.payload.severity.value)
== ErrorSeverity.warning
):
header_style = warn_header_style
data_style = warn_data_style
else:
header_style = err_header_style
data_style = err_data_style
else:
header_style = info_header_style
data_style = info_data_style
Expand Down