changed units PV readout to not read in constructors
This commit is contained in:
@@ -13,13 +13,12 @@ class PVAdjustable(Adjustable):
|
||||
def __init__(self,
|
||||
pvname_setvalue, pvname_readback=None, pvname_stop=None, pvname_done_moving=None, pvname_moving=None,
|
||||
accuracy=None, active_move=False, process_time=0, wait_time=0.1, timeout=60,
|
||||
ID=None, name=None, internal=False
|
||||
ID=None, name=None, units=None, internal=False
|
||||
):
|
||||
pv_setvalue = PV(pvname_setvalue)
|
||||
pv_readback = PV(pvname_readback) if pvname_readback else pv_setvalue
|
||||
|
||||
ID = ID or pvname_readback or pvname_setvalue
|
||||
units = pv_readback.units
|
||||
super().__init__(ID, name=name, units=units, internal=internal)
|
||||
|
||||
self.accuracy = accuracy
|
||||
@@ -48,6 +47,18 @@ class PVAdjustable(Adjustable):
|
||||
self._pcm = make_pcm(pvname_done_moving, pvname_moving)
|
||||
|
||||
|
||||
@property
|
||||
def units(self):
|
||||
units = self._units
|
||||
if units is not None:
|
||||
return units
|
||||
return self.pvs.readback.units
|
||||
|
||||
@units.setter
|
||||
def units(self, value):
|
||||
self._units = value
|
||||
|
||||
|
||||
def get_current_value(self, readback=True):
|
||||
if readback:
|
||||
return self.pvs.readback.get()
|
||||
|
||||
@@ -50,8 +50,7 @@ class SmarActStage(BaseDevice):
|
||||
|
||||
class SmarActAxis(Adjustable):
|
||||
|
||||
def __init__(self, ID, name=None, internal=False):
|
||||
units = PV(ID + ":DRIVE.EGU").get() #TODO
|
||||
def __init__(self, ID, name=None, units=None, internal=False):
|
||||
super().__init__(ID, name=name, units=units, internal=internal)
|
||||
|
||||
self._move_requested = False
|
||||
@@ -65,10 +64,23 @@ class SmarActAxis(Adjustable):
|
||||
set_pos = PV(ID + ":SET_POS"),
|
||||
stop = PV(ID + ":STOP.PROC"),
|
||||
hold = PV(ID + ":HOLD"),
|
||||
twv = PV(ID + ":TWV")
|
||||
twv = PV(ID + ":TWV"),
|
||||
units = PV(ID + ":DRIVE.EGU")
|
||||
)
|
||||
|
||||
|
||||
@property
|
||||
def units(self):
|
||||
units = self._units
|
||||
if units is not None:
|
||||
return units
|
||||
return self.pvs.units.get()
|
||||
|
||||
@units.setter
|
||||
def units(self, value):
|
||||
self._units = value
|
||||
|
||||
|
||||
def get_current_value(self, readback=True):
|
||||
if readback:
|
||||
return self.pvs.readback.get()
|
||||
|
||||
Reference in New Issue
Block a user