From 850c07a6f910843bb87790a511a2c44ef68c6780 Mon Sep 17 00:00:00 2001 From: "gac-x01da (Resp. Clark Adam Hugh)" Date: Fri, 19 Jul 2024 10:53:34 +0200 Subject: [PATCH] fix: tested and fixed move with device at Debye --- debye_bec/devices/mo1_bragg.py | 5 +---- tests/tests_devices/test_mo1_bragg.py | 4 ++-- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/debye_bec/devices/mo1_bragg.py b/debye_bec/devices/mo1_bragg.py index b1e07ca..e339a28 100644 --- a/debye_bec/devices/mo1_bragg.py +++ b/debye_bec/devices/mo1_bragg.py @@ -404,7 +404,7 @@ class Mo1Bragg(Device, PositionerBase): # Start motion self.move_abs.put(1) # Currently sleep is needed due to delay in updates on PVs, maybe time can be reduced - time.sleep(0.25) + time.sleep(0.5) while self.motor_is_moving.get() == 0: # TODO check if the _run_subs is needed since we have an auto_monitor on the readback PV # However, since the move_type can change, it might be necessary to have it here @@ -602,9 +602,6 @@ class Mo1Bragg(Device, PositionerBase): if self.scan_control.scan_msg.get() != ScanControlLoadMessage.PENDING: self.scan_control.scan_val_reset.put(1) - # Wait for reset to be done - # TODO check if this sleep can really be removed - # time.sleep(1) if not self.wait_for_signals( signal_conditions=[(self.scan_control.scan_msg.get, ScanControlLoadMessage.PENDING)], diff --git a/tests/tests_devices/test_mo1_bragg.py b/tests/tests_devices/test_mo1_bragg.py index dabc44f..4aef71f 100644 --- a/tests/tests_devices/test_mo1_bragg.py +++ b/tests/tests_devices/test_mo1_bragg.py @@ -83,7 +83,7 @@ def test_move_succeeds(mock_bragg): with mock.patch.object(dev.motor_is_moving._read_pv, "mock_data", side_effect=[0, 1]): status = dev.move(0.5) # Sleep needed to allow thread to resolive in _move_and_finish, i.e. and the 0.25s sleep inside the function - time.sleep(0.5) + time.sleep(1) assert status.done is True assert status.success is True assert dev.setpoint.get() == 0.5 @@ -96,7 +96,7 @@ def test_stop_move(mock_bragg): dev.motor_is_moving._read_pv.mock_data = 0 # Move fails status = dev.move(0.5) - time.sleep(0.5) + time.sleep(1) assert status.done is False assert dev._stopped == False dev.stop()