From 5e6b38e09517657e2756c77843e0e9f4e2974a92 Mon Sep 17 00:00:00 2001 From: ahiuchingau <20424172+ahiuchingau@users.noreply.github.com> Date: Wed, 17 Apr 2024 18:40:22 -0400 Subject: [PATCH 1/2] remove can messenger listener --- .../hardware_control/motor_enable_disable.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hardware/opentrons_hardware/hardware_control/motor_enable_disable.py b/hardware/opentrons_hardware/hardware_control/motor_enable_disable.py index 9928b841da9..32897d16679 100644 --- a/hardware/opentrons_hardware/hardware_control/motor_enable_disable.py +++ b/hardware/opentrons_hardware/hardware_control/motor_enable_disable.py @@ -122,7 +122,9 @@ def _listener(message: MessageDefinition, arb_id: ArbitrationId) -> None: ) else: log.debug("Read motor status terminated, no missing nodes.") - return reported + finally: + can_messenger.remove_listener(_listener) + return reported async def get_tip_motor_enabled( From 4adf900694e81e3829fc59d4853185acc862b59f Mon Sep 17 00:00:00 2001 From: ahiuchingau <20424172+ahiuchingau@users.noreply.github.com> Date: Wed, 17 Apr 2024 18:50:28 -0400 Subject: [PATCH 2/2] retract function should acquire motion lock --- api/src/opentrons/hardware_control/ot3api.py | 21 ++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/api/src/opentrons/hardware_control/ot3api.py b/api/src/opentrons/hardware_control/ot3api.py index 0d97855045f..5edc327ced1 100644 --- a/api/src/opentrons/hardware_control/ot3api.py +++ b/api/src/opentrons/hardware_control/ot3api.py @@ -1655,16 +1655,17 @@ async def retract_axis(self, axis: Axis) -> None: motor_ok = self._backend.check_motor_status([axis]) encoder_ok = self._backend.check_encoder_status([axis]) - if motor_ok and encoder_ok: - # we can move to the home position without checking the limit switch - origin = await self._backend.update_position() - target_pos = {axis: self._backend.home_position()[axis]} - await self._backend.move(origin, target_pos, 400, HWStopCondition.none) - else: - # home the axis - await self._home_axis(axis) - await self._cache_current_position() - await self._cache_encoder_position() + async with self._motion_lock: + if motor_ok and encoder_ok: + # we can move to the home position without checking the limit switch + origin = await self._backend.update_position() + target_pos = {axis: self._backend.home_position()[axis]} + await self._backend.move(origin, target_pos, 400, HWStopCondition.none) + else: + # home the axis + await self._home_axis(axis) + await self._cache_current_position() + await self._cache_encoder_position() # Gantry/frame (i.e. not pipette) config API @property