From 175539ec7cc5b9debdd5d892dfa4f103e97b82fa Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Thu, 3 Dec 2020 20:04:38 +0100 Subject: [PATCH] added proper waiting for the start of the move --- slic/devices/general/smaract.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/slic/devices/general/smaract.py b/slic/devices/general/smaract.py index 5b6746db..5d7fe0a5 100644 --- a/slic/devices/general/smaract.py +++ b/slic/devices/general/smaract.py @@ -68,12 +68,22 @@ class SmarActAxis(Adjustable): stopper = lambda: self.pvs.stop.put(1) return self._as_task(change, stopper=stopper, hold=hold) - def _move(self, value, checktime=0.1): + + def _move(self, value, checktime=0.1, timeout=60): + timeout += time.time() + self.pvs.drive.put(value) - time.sleep(checktime) + + while not self.is_moving(): + time.sleep(checktime) + if time.time() >= timeout: + tname = typename(self) + raise SmarActError(f"starting to move {tname} \"{self.name}\" to {value} {self.units} timed out") + while self.is_moving(): time.sleep(checktime) + def is_moving(self): """ 0 : Stopped