diff --git a/slic/utils/hastyepics.py b/slic/utils/hastyepics.py index dfd2285d9..fbfa707d2 100644 --- a/slic/utils/hastyepics.py +++ b/slic/utils/hastyepics.py @@ -1,30 +1,16 @@ import epics from epics import get_pv as _get_pv -from epics import PV as _PV -import time from epics.device import Device from epics.motor import MotorException -################################################################ en +++++++++++ -class HastyPV(_PV): - def put(self, value, *args, **kwargs): - kwargs.setdefault("wait", True) - result = super().put(value, *args, **kwargs) - time.sleep(0.1) - return result -################################################################### -''' # speed up: do not wait for the connection to happen def get_pv(*args, connect=False, timeout=0, **kwargs): return _get_pv(*args, connect=connect, timeout=timeout, **kwargs) -''' -# speed up: do not wait for the connection to happen -def get_pv(*args, connect=False, timeout=0, **kwargs): - return HastyPV(*args, connect=connect, timeout=timeout, **kwargs) - + + # this is a copy of the epics.Motor constructor with some modifications class Motor(epics.Motor): @@ -34,23 +20,15 @@ class Motor(epics.Motor): raise MotorException("must supply motor name") if name.endswith('.VAL'): - print("Before :", name, "\n") name = name[:-4] - print("After :", name, "\n") if name.endswith('.'): - print("Before :", name, "\n") name = name[:-1] - print("After :", name, "\n") - self._prefix = name - print("LATER:", getattr(self, '_prefix'), "\n") - print("Prefix :", name, "\n") Device.__init__(self, name, delim='.', attrs=self._init_list, timeout=timeout) - print("LATER:", getattr(self, '_prefix'), "\n") - print("After device :", name, "\n") + # speed up: do not get any data from PVs during construction # # make sure this is really a motor! # rectype = self.get('RTYP') @@ -60,10 +38,8 @@ class Motor(epics.Motor): for key, val in self._extras.items(): pvname = "%s%s" % (name, val) self.add_pv(pvname, attr=key) - print("After add_pv:", name, "\n") + self._callbacks = {} - print("LATER:", getattr(self, '_prefix'), "\n") - print("End :", name, "\n") # speed up: used by Motor.get_pv() with connect=True, i.e., waiting for connection