made quadrants device an adjustable

This commit is contained in:
gac-maloja
2022-10-12 18:53:26 +02:00
parent 76273d6dac
commit 36843b4720

View File

@ -129,21 +129,24 @@ class UndRadial(UndShiftRadialBase):
class UndShiftQuadrants(SimpleDevice): class UndShiftQuadrants(Adjustable):
def __init__(self, ID, accuracy=0.001): def __init__(self, ID, accuracy=0.001):
ID += "SHIFT" ID += "SHIFT"
super().__init__(ID)
names = ["TL", "BL", "TR", "BR"] names = ["TL", "BL", "TR", "BR"]
pvnames = [f"{ID}-{n}" for n in names] pvnames = [f"{ID}-{n}" for n in names]
adjs = {n.lower(): PVAdjustable(pvn + "-SET", pvn, accuracy=accuracy) for n, pvn in zip(names, pvnames)} adjs = {n.lower(): PVAdjustable(pvn + "-SET", pvn, accuracy=accuracy) for n, pvn in zip(names, pvnames)}
self.adjs = SimpleDevice(ID, **adjs)
super().__init__(ID, **adjs)
self.pv_on = PV(ID + "-ON") self.pv_on = PV(ID + "-ON")
self.pv_go = PV(ID + "-GO") self.pv_go = PV(ID + "-GO")
def set(self, tl, bl, tr, br): def set_target_value(self, value):
tl = value
br = -tl
bl = tr = bl = 0
vals = (tl, bl, tr, br) vals = (tl, bl, tr, br)
tasks = [a.set_target_value(v) for a, v in zip(self.adjs, vals)] tasks = [a.set_target_value(v) for a, v in zip(self.adjs, vals)]
@ -156,6 +159,13 @@ class UndShiftQuadrants(SimpleDevice):
t.wait() t.wait()
def get_current_value(self):
return self.adjs.tl.get_current_value()
def is_moving(self):
return any(a.is_moving() for a in self.adjs)
class UndTotalK: class UndTotalK:
""" """