diff --git a/api/src/opentrons/hardware_control/ot3api.py b/api/src/opentrons/hardware_control/ot3api.py index 08dcb488aab..8b0da72115d 100644 --- a/api/src/opentrons/hardware_control/ot3api.py +++ b/api/src/opentrons/hardware_control/ot3api.py @@ -2629,7 +2629,7 @@ async def _liquid_probe_pass( force_both_sensors: bool = False, ) -> float: plunger_direction = -1 if probe_settings.aspirate_while_sensing else 1 - await self._backend.liquid_probe( + end_z = await self._backend.liquid_probe( mount, p_travel, probe_settings.mount_speed, @@ -2641,8 +2641,17 @@ async def _liquid_probe_pass( probe=probe, force_both_sensors=force_both_sensors, ) - end_pos = await self.gantry_position(mount, refresh=True) - return end_pos.z + machine_pos = await self._backend.update_position() + machine_pos[Axis.by_mount(mount)] = end_z + deck_end_z = self._deck_from_machine(machine_pos)[Axis.by_mount(mount)] + offset = offset_for_mount( + mount, + top_types.Point(*self._config.left_mount_offset), + top_types.Point(*self._config.right_mount_offset), + top_types.Point(*self._config.gripper_mount_offset), + ) + cp = self.critical_point_for(mount, None) + return deck_end_z + offset.z + cp.z async def liquid_probe( self, diff --git a/api/tests/opentrons/hardware_control/test_ot3_api.py b/api/tests/opentrons/hardware_control/test_ot3_api.py index 20a8f090374..bb1352d3157 100644 --- a/api/tests/opentrons/hardware_control/test_ot3_api.py +++ b/api/tests/opentrons/hardware_control/test_ot3_api.py @@ -815,15 +815,9 @@ async def test_liquid_probe( with patch.object( hardware_backend, "liquid_probe", AsyncMock(spec=hardware_backend.liquid_probe) ) as mock_liquid_probe: - return_dict = { - head_node: 140, - NodeId.gantry_x: 0, - NodeId.gantry_y: 0, - pipette_node: 0, - } # make sure aspirate while sensing reverses direction - mock_liquid_probe.return_value = return_dict + mock_liquid_probe.return_value = 140 fake_settings_aspirate = LiquidProbeSettings( mount_speed=5, plunger_speed=20, @@ -849,8 +843,6 @@ async def test_liquid_probe( force_both_sensors=False, ) - return_dict[head_node], return_dict[pipette_node] = 142, 142 - mock_liquid_probe.return_value = return_dict await ot3_hardware.liquid_probe( mount, fake_max_z_dist, fake_liquid_settings ) # should raise no exceptions @@ -903,7 +895,7 @@ async def test_liquid_probe_plunger_moves( PipetteLiquidNotFoundError, PipetteLiquidNotFoundError, PipetteLiquidNotFoundError, - None, + 140, ] fake_max_z_dist = 75.0 @@ -1056,16 +1048,10 @@ async def test_multi_liquid_probe( with patch.object( hardware_backend, "liquid_probe", AsyncMock(spec=hardware_backend.liquid_probe) ) as mock_liquid_probe: - return_dict = { - NodeId.head_l: 140, - NodeId.gantry_x: 0, - NodeId.gantry_y: 0, - NodeId.pipette_left: 0, - } side_effects = [ PipetteLiquidNotFoundError(), PipetteLiquidNotFoundError(), - return_dict, + 140, ] # make sure aspirate while sensing reverses direction @@ -1103,9 +1089,6 @@ async def test_multi_liquid_probe( ) assert mock_liquid_probe.call_count == 3 - return_dict[NodeId.head_l], return_dict[NodeId.pipette_left] = 142, 142 - mock_liquid_probe.return_value = return_dict - async def test_liquid_not_found( ot3_hardware: ThreadManager[OT3API], diff --git a/hardware/opentrons_hardware/hardware_control/tool_sensors.py b/hardware/opentrons_hardware/hardware_control/tool_sensors.py index 6b6443d8828..1d795878f9d 100644 --- a/hardware/opentrons_hardware/hardware_control/tool_sensors.py +++ b/hardware/opentrons_hardware/hardware_control/tool_sensors.py @@ -201,7 +201,7 @@ async def run_sync_buffer_to_csv( ), expected_nodes=[tool], ) - if raise_z is not None and False: + if raise_z is not None: # if probing is finished, move the head node back up before requesting the data buffer if positions[head_node].move_ack == MoveCompleteAck.stopped_by_condition: await raise_z.run(can_messenger=messenger)