From 87ea95e975700b9c6dc8ac7c9bf8251b2d39aa45 Mon Sep 17 00:00:00 2001 From: appel_c Date: Fri, 9 May 2025 16:25:41 +0200 Subject: [PATCH] fix: improve move method of mo1_bragg_devices --- debye_bec/devices/mo1_bragg/mo1_bragg_devices.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/debye_bec/devices/mo1_bragg/mo1_bragg_devices.py b/debye_bec/devices/mo1_bragg/mo1_bragg_devices.py index fada768..37cd9ce 100644 --- a/debye_bec/devices/mo1_bragg/mo1_bragg_devices.py +++ b/debye_bec/devices/mo1_bragg/mo1_bragg_devices.py @@ -251,9 +251,7 @@ class Mo1BraggPositioner(Device, PositionerBase): success (bool) : Flag to indicate if the motion was successful """ self.move_stop.put(1) - if self._move_thread is not None: - self._move_thread.join() - self._move_thread = None + self._stopped = True super().stop(success=success) def stop_scan(self) -> None: @@ -323,12 +321,14 @@ class Mo1BraggPositioner(Device, PositionerBase): update_frequency (float): Optional, frequency to update the current position of the motion, defaults to 0.1s """ + motor_name = None try: # Set the target position on IOC self.setpoint.put(target_pos) self.move_abs.put(1) # Currently sleep is needed due to delay in updates on PVs, maybe time can be reduced time.sleep(0.5) + motor_name = self.name while self.motor_is_moving.get() == 0: if self.stopped: raise Mo1BraggStoppedError(f"Device {self.name} was stopped") @@ -338,7 +338,9 @@ class Mo1BraggPositioner(Device, PositionerBase): # pylint: disable=broad-except except Exception as exc: content = traceback.format_exc() - logger.error(f"Error in move thread of device {self.name}: {content}") + logger.error( + f"Error in move thread of device {motor_name if motor_name else ''}: {content}" + ) status.set_exception(exc=exc) def move(self, value: float, **kwargs) -> DeviceStatus: