This commit is contained in:
+14
-17
@@ -4,28 +4,25 @@ from epics import get_pv as _get_pv
|
||||
from epics.device import Device
|
||||
from epics.motor import MotorException
|
||||
|
||||
################################################################ en +++++++++++
|
||||
class HastyPV(_PV):
|
||||
def put(self, value, *args, **kwargs):
|
||||
kwargs.setdefault("wait", True) # force wait=True par défaut
|
||||
result = super().put(value, *args, **kwargs)
|
||||
time.sleep(0.1) # petit délai post-write
|
||||
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)
|
||||
'''
|
||||
|
||||
|
||||
################################################################ en +++++++++++
|
||||
_ORIG_PUT = epics.PV.put
|
||||
|
||||
# put with a sleep : needed for platforms like IOC
|
||||
def put(self, value, *args, **kwargs):
|
||||
kwargs.setdefault("wait", True)
|
||||
kwargs.setdefault("timeout", 0.1)
|
||||
|
||||
res = _ORIG_PUT(self, value, *args, **kwargs)
|
||||
time.sleep(0.2)
|
||||
return res
|
||||
|
||||
# Monkey patch global
|
||||
epics.PV.put = put
|
||||
###################################################################
|
||||
|
||||
# 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):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user