From 5c1c040064bb71beb35469f50eb64d424c8d1a1b Mon Sep 17 00:00:00 2001 From: caila-marashaj Date: Fri, 15 Mar 2024 15:49:16 -0400 Subject: [PATCH] add can messges for lld testing --- .../firmware_bindings/constants.py | 3 +++ .../messages/message_definitions.py | 26 +++++++++++++++++++ .../firmware_bindings/messages/payloads.py | 14 ++++++++++ .../hardware_control/tool_sensors.py | 2 -- 4 files changed, 43 insertions(+), 2 deletions(-) diff --git a/hardware/opentrons_hardware/firmware_bindings/constants.py b/hardware/opentrons_hardware/firmware_bindings/constants.py index 6d173e6effcf..cb623907dfbb 100644 --- a/hardware/opentrons_hardware/firmware_bindings/constants.py +++ b/hardware/opentrons_hardware/firmware_bindings/constants.py @@ -172,6 +172,7 @@ class MessageId(int, Enum): execute_move_group_request = 0x18 clear_all_move_groups_request = 0x19 home_request = 0x20 + add_sensor_move_request = 0x23 move_completed = 0x13 motor_position_request = 0x12 @@ -249,6 +250,7 @@ class MessageId(int, Enum): peripheral_status_request = 0x8C peripheral_status_response = 0x8D baseline_sensor_response = 0x8E + send_accumulated_pressure_data = 0x8F set_hepa_fan_state_request = 0x90 get_hepa_fan_state_request = 0x91 @@ -402,6 +404,7 @@ class MoveStopCondition(int, Enum): stall = 0x10 ignore_stalls = 0x20 limit_switch_backoff = 0x40 + sensor_report = 0x80 @unique diff --git a/hardware/opentrons_hardware/firmware_bindings/messages/message_definitions.py b/hardware/opentrons_hardware/firmware_bindings/messages/message_definitions.py index 49698329264b..3ad26b140ae5 100644 --- a/hardware/opentrons_hardware/firmware_bindings/messages/message_definitions.py +++ b/hardware/opentrons_hardware/firmware_bindings/messages/message_definitions.py @@ -193,6 +193,19 @@ class AddLinearMoveRequest(BaseMessage): # noqa: D101 message_id: Literal[MessageId.add_move_request] = MessageId.add_move_request +@dataclass +class AddSensorLinearMoveRequest(BaseMessage): # noqa: D101 + """Sensor Linear Move Request.""" + + payload: payloads.AddSensorLinearMoveBasePayload + payload_type: Type[ + payloads.AddSensorLinearMoveBasePayload + ] = payloads.AddSensorLinearMoveBasePayload + message_id: Literal[ + MessageId.add_sensor_move_request + ] = MessageId.add_sensor_move_request + + @dataclass class GetMoveGroupRequest(BaseMessage): # noqa: D101 payload: payloads.MoveGroupRequestPayload @@ -977,3 +990,16 @@ class GetHepaUVStateResponse(BaseMessage): message_id: Literal[ MessageId.get_hepa_uv_state_response ] = MessageId.get_hepa_uv_state_response + + +@dataclass +class SendAccumulatedPressureDataRequest(BaseMessage): + """Send all the saved sensor data.""" + + payload: payloads.SendAccumulatedPressureDataPayload + payload_type: Type[ + payloads.SendAccumulatedPressureDataPayload + ] = payloads.SendAccumulatedPressureDataPayload + message_id: Literal[ + MessageId.send_accumulated_pressure_data + ] = MessageId.send_accumulated_pressure_data diff --git a/hardware/opentrons_hardware/firmware_bindings/messages/payloads.py b/hardware/opentrons_hardware/firmware_bindings/messages/payloads.py index 508dad99de99..4dae6fe29a68 100644 --- a/hardware/opentrons_hardware/firmware_bindings/messages/payloads.py +++ b/hardware/opentrons_hardware/firmware_bindings/messages/payloads.py @@ -481,6 +481,13 @@ class BindSensorOutputResponsePayload(SensorPayload): binding: SensorOutputBindingField +@dataclass(eq=False) +class AddSensorLinearMoveBasePayload(AddLinearMoveRequestPayload): + """A request to add a linear move that also requires sensor reading for its duration.""" + + sensor_id: SensorIdField + + @dataclass(eq=False) class PipetteInfoResponsePayload(EmptyPayload): """A response carrying data about an attached pipette.""" @@ -668,3 +675,10 @@ class GetHepaUVStatePayloadResponse(EmptyPayload): uv_duration_s: utils.UInt32Field uv_light_on: utils.UInt8Field remaining_time_s: utils.UInt32Field + + +@dataclass(eq=False) +class SendAccumulatedPressureDataPayload(EmptyPayload): + """Send queued readings from a sensor.""" + + sensor_id: SensorIdField diff --git a/hardware/opentrons_hardware/hardware_control/tool_sensors.py b/hardware/opentrons_hardware/hardware_control/tool_sensors.py index 974378956976..43ccf7d37953 100644 --- a/hardware/opentrons_hardware/hardware_control/tool_sensors.py +++ b/hardware/opentrons_hardware/hardware_control/tool_sensors.py @@ -222,8 +222,6 @@ async def liquid_probe( ): return await sensor_runner.run(can_messenger=messenger) - return positions - async def check_overpressure( messenger: CanMessenger,