workaround

This commit is contained in:
gac-maloja
2022-10-12 17:32:05 +02:00
parent ee17250afa
commit 0b49d68236

View File

@ -1,5 +1,6 @@
from epics import PV from epics import PV
from slic.core.adjustable import Adjustable, PVAdjustable from slic.core.adjustable import Adjustable, PVAdjustable
from slic.core.task import Task
from slic.utils import json_load from slic.utils import json_load
from slic.utils import unpickle from slic.utils import unpickle
from models.parallel_model import parallel2gap from models.parallel_model import parallel2gap
@ -98,17 +99,18 @@ class UndShiftRadialBase(PVAdjustable): #TODO: better name?
def __init__(self, ID, accuracy=0.001): def __init__(self, ID, accuracy=0.001):
super().__init__(ID + "-SET", ID + "-TL", accuracy=accuracy) super().__init__(ID + "-SET", ID + "-TL", accuracy=accuracy)
self.pv_on = PV(ID + "-ONOFF") self.pv_on = PV(ID + "-ON")
self.pv_go = PV(ID + "-GO") self.pv_go = PV(ID + "-GO")
def set_target_value(self, value): def set_target_value(self, value):
t = super().set_target_value(value) f = super().set_target_value
print('wait1') t = Task(
sleep(0.9) lambda: f(value)
print('wait2') )
t.start()
sleep(0.3)
self.pv_on.put(1) self.pv_on.put(1)
print('wait3') sleep(0.3)
sleep(0.9)
self.pv_go.put(1) self.pv_go.put(1)
t.wait() t.wait()
@ -169,8 +171,8 @@ if __name__ == "__main__":
ups = UndPhases("SATUN-PHASES", params) ups = UndPhases("SATUN-PHASES", params)
sleep(1) sleep(1)
print(ups.phases[0], ups.phases[0].shift) print(ups.phases[0], ups.phases[0].shift)
ups.phases[0].set_target_value(phase).wait() # ups.phases[0].set_target_value(phase).wait()
print(ups.phases[0], ups.phases[0].shift) # print(ups.phases[0], ups.phases[0].shift)