From 54804a2eec24d6e3e5ffac535d54c3c7b3e89396 Mon Sep 17 00:00:00 2001 From: Sven Augustin Date: Tue, 22 Jun 2021 21:22:18 +0200 Subject: [PATCH] made CHIC (theoretically) scanable, i.e., set_target_value returns a Task --- devices/undulator.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/devices/undulator.py b/devices/undulator.py index 011b14b..9fb08ae 100644 --- a/devices/undulator.py +++ b/devices/undulator.py @@ -65,7 +65,7 @@ class Undulators(Adjustable): tasks.append(t) wait_for_all(tasks) print("Warning: CHIC adjustment is still commented!") -# self.chic.set_target_value(value) #TODO: test whether an additional sleep is needed +# self.chic.set_target_value(value).wait() #TODO: test whether an additional sleep is needed return self._as_task(change, hold=hold) @@ -161,10 +161,17 @@ class CHIC(PVAdjustable): self.pvs.start = PV("SATUN-CHIC:APPLY-DELAY-OFFSET-PHASE") self.units = units - def set_target_value(self, value): + + def set_target_value(self, value, hold=False): value /= 1000 - super().set_target_value(value) - self.pv_start.put(1) + + def change(): + super().set_target_value(value).wait() + self.pvs.start.put(1, wait=True) + #TODO: test whether an additional sleep is needed + + return self._as_task(change, hold=hold) + def get_current_value(self): return super().get_current_value() * 1000