diff --git a/hardware/opentrons_hardware/firmware_bindings/constants.py b/hardware/opentrons_hardware/firmware_bindings/constants.py index 39f18095334..c27ba57d20e 100644 --- a/hardware/opentrons_hardware/firmware_bindings/constants.py +++ b/hardware/opentrons_hardware/firmware_bindings/constants.py @@ -21,6 +21,8 @@ class NodeId(int, Enum): head_l = 0x51 head_r = 0x52 gripper = 0x20 + gripper_z = 0x21 + gripper_g = 0x22 pipette_left_bootloader = pipette_left | 0xF pipette_right_bootloader = pipette_right | 0xF gantry_x_bootloader = gantry_x | 0xF @@ -56,6 +58,8 @@ class MessageId(int, Enum): task_info_response = 0x305 pipette_info_request = 0x306 pipette_info_response = 0x307 + gripper_info_request = 0x308 + gripper_info_response = 0x309 stop_request = 0x00 diff --git a/hardware/opentrons_hardware/firmware_bindings/messages/fields.py b/hardware/opentrons_hardware/firmware_bindings/messages/fields.py index 2153428e8aa..19ad59c96f1 100644 --- a/hardware/opentrons_hardware/firmware_bindings/messages/fields.py +++ b/hardware/opentrons_hardware/firmware_bindings/messages/fields.py @@ -116,6 +116,18 @@ class PipetteSerialField(utils.BinaryFieldBase[bytes]): FORMAT = f"{NUM_BYTES}s" +class GripperSerialField(utils.BinaryFieldBase[bytes]): + """The serial number of a gripper. + + This is sized to handle only the datecode part of the serial + number; the full field can be synthesized from this, the + model number, and the name. + """ + + NUM_BYTES = 12 + FORMAT = f"{NUM_BYTES}s" + + class SensorOutputBindingField(utils.UInt8Field): """sensor type.""" diff --git a/hardware/opentrons_hardware/firmware_bindings/messages/message_definitions.py b/hardware/opentrons_hardware/firmware_bindings/messages/message_definitions.py index 39aa8db832f..8d9768cb8ed 100644 --- a/hardware/opentrons_hardware/firmware_bindings/messages/message_definitions.py +++ b/hardware/opentrons_hardware/firmware_bindings/messages/message_definitions.py @@ -469,3 +469,17 @@ class BindSensorOutputResponse: # noqa: D101 message_id: Literal[ MessageId.bind_sensor_output_response ] = MessageId.bind_sensor_output_response + + +@dataclass +class GripperInfoRequest(EmptyPayloadMessage): # noqa: D101 + message_id: Literal[MessageId.gripper_info_request] = MessageId.gripper_info_request + + +@dataclass +class GripperInfoResponse: # noqa: D101 + payload: payloads.GripperInfoResponsePayload + payload_type: Type[BinarySerializable] = payloads.GripperInfoResponsePayload + message_id: Literal[ + MessageId.gripper_info_response + ] = MessageId.gripper_info_response diff --git a/hardware/opentrons_hardware/firmware_bindings/messages/messages.py b/hardware/opentrons_hardware/firmware_bindings/messages/messages.py index cbef3e863c9..78d2ab4277d 100644 --- a/hardware/opentrons_hardware/firmware_bindings/messages/messages.py +++ b/hardware/opentrons_hardware/firmware_bindings/messages/messages.py @@ -68,6 +68,8 @@ defs.HomeRequest, defs.PipetteInfoRequest, defs.PipetteInfoResponse, + defs.GripperInfoRequest, + defs.GripperInfoResponse, defs.BindSensorOutputRequest, ] diff --git a/hardware/opentrons_hardware/firmware_bindings/messages/payloads.py b/hardware/opentrons_hardware/firmware_bindings/messages/payloads.py index cc62a587579..4f0c0512bd6 100644 --- a/hardware/opentrons_hardware/firmware_bindings/messages/payloads.py +++ b/hardware/opentrons_hardware/firmware_bindings/messages/payloads.py @@ -14,6 +14,7 @@ SensorTypeField, PipetteNameField, PipetteSerialField, + GripperSerialField, SensorOutputBindingField, ) from .. import utils @@ -388,3 +389,11 @@ class BrushedMotorPwmPayload(utils.BinarySerializable): freq: utils.UInt32Field duty_cycle: utils.UInt32Field + + +@dataclass +class GripperInfoResponsePayload(utils.BinarySerializable): + """A response carrying data about an attached gripper.""" + + gripper_model: utils.UInt16Field + gripper_serial: GripperSerialField