From 41442ac764a84b0c1ea051bfcb8259313a708dac Mon Sep 17 00:00:00 2001 From: Ryan howard Date: Thu, 8 Dec 2022 12:13:20 -0500 Subject: [PATCH 1/3] add an estop release err code --- hardware/opentrons_hardware/firmware_bindings/constants.py | 1 + 1 file changed, 1 insertion(+) diff --git a/hardware/opentrons_hardware/firmware_bindings/constants.py b/hardware/opentrons_hardware/firmware_bindings/constants.py index 633b7f63d68..8ff3080d260 100644 --- a/hardware/opentrons_hardware/firmware_bindings/constants.py +++ b/hardware/opentrons_hardware/firmware_bindings/constants.py @@ -169,6 +169,7 @@ class ErrorCode(int, Enum): estop_detected = 0x07 collision_detected = 0x08 labware_dropped = 0x09 + estop_released = 0x0A @unique From e88e71eb5ab47ea89697421271030b72103e50cd Mon Sep 17 00:00:00 2001 From: Ryan howard Date: Thu, 8 Dec 2022 12:31:37 -0500 Subject: [PATCH 2/3] add warning style to can_mon --- .../opentrons_hardware/scripts/can_mon.py | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/hardware/opentrons_hardware/scripts/can_mon.py b/hardware/opentrons_hardware/scripts/can_mon.py index b3cd8b400f8..d4815580be9 100644 --- a/hardware/opentrons_hardware/scripts/can_mon.py +++ b/hardware/opentrons_hardware/scripts/can_mon.py @@ -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, @@ -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 @@ -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" @@ -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 From 4a543365c333268861d2bc4bfb3fdcbfb5c36116 Mon Sep 17 00:00:00 2001 From: Ryan howard Date: Tue, 3 Jan 2023 12:03:59 -0500 Subject: [PATCH 3/3] sleep at the end of gpio init so that we don't crash the can messenger on startup --- hardware/opentrons_hardware/drivers/gpio/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hardware/opentrons_hardware/drivers/gpio/__init__.py b/hardware/opentrons_hardware/drivers/gpio/__init__.py index c70880ddb47..8138189037a 100644 --- a/hardware/opentrons_hardware/drivers/gpio/__init__.py +++ b/hardware/opentrons_hardware/drivers/gpio/__init__.py @@ -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" @@ -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."""