From 1c4165f301bc4bae254caf7ba166d8a7853c281a Mon Sep 17 00:00:00 2001 From: x12sa Date: Wed, 13 May 2026 16:06:19 +0200 Subject: [PATCH] fix(npoint): retry on wait_for_connection --- csaxs_bec/devices/npoint/npoint.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/csaxs_bec/devices/npoint/npoint.py b/csaxs_bec/devices/npoint/npoint.py index fcf7d10..221ccb9 100644 --- a/csaxs_bec/devices/npoint/npoint.py +++ b/csaxs_bec/devices/npoint/npoint.py @@ -448,26 +448,15 @@ class NPointAxis(Device, PositionerBase): self.high_limit_travel.put(limits[1]) def wait_for_connection(self, timeout: float = 30.0) -> bool: - self.controller.on(timeout=timeout) - self._update_setpoint_from_readback() - - def _update_setpoint_from_readback(self): - """ - The setpoint is only stored locally. After a restart, - we need to update it to match the current readback value. - """ for attempt in range(5): try: + self.controller.on(timeout=timeout) + self.user_setpoint.setpoint = self.readback.get() - except Exception as e: - logger.warning( - f"NPointAxis {self.name}: Failed to update the setpoint from the readback value on attempt {attempt+1} during startup: {e}" - ) + except TimeoutError: + self.controller.off(update_config=False) time.sleep(1) else: - logger.info( - f"NPointAxis {self.name}: Successfully updated the setpoint from the readback value on attempt {attempt+1} during startup." - ) break else: raise TimeoutError(