diff --git a/slic/core/adjustable/pvadjustable.py b/slic/core/adjustable/pvadjustable.py index 2d8d0a9c1..c9efd46d4 100644 --- a/slic/core/adjustable/pvadjustable.py +++ b/slic/core/adjustable/pvadjustable.py @@ -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() diff --git a/slic/devices/general/smaract.py b/slic/devices/general/smaract.py index 0e4121f9a..d118ced86 100644 --- a/slic/devices/general/smaract.py +++ b/slic/devices/general/smaract.py @@ -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()