merge manually with mlz repo
as of 2023-05-04 Change-Id: I5926617c454844927799e20a489db20d538db100
This commit is contained in:
@ -460,6 +460,12 @@ class AnalogOutput(PyTangoDevice, Drivable):
|
||||
_history = ()
|
||||
_timeout = None
|
||||
_moving = False
|
||||
__main_unit = None
|
||||
|
||||
def applyMainUnit(self, mainunit):
|
||||
# called from __init__ method
|
||||
# replacement of '$' by main unit must be done later
|
||||
self.__main_unit = mainunit
|
||||
|
||||
def initModule(self):
|
||||
super().initModule()
|
||||
@ -469,12 +475,18 @@ class AnalogOutput(PyTangoDevice, Drivable):
|
||||
|
||||
def startModule(self, start_events):
|
||||
super().startModule(start_events)
|
||||
# query unit from tango and update value property
|
||||
attrInfo = self._dev.attribute_query('value')
|
||||
# prefer configured unit if nothing is set on the Tango device, else
|
||||
# update
|
||||
if attrInfo.unit != 'No unit':
|
||||
self.accessibles['value'].datatype.setProperty('unit', attrInfo.unit)
|
||||
try:
|
||||
# query unit from tango and update value property
|
||||
attrInfo = self._dev.attribute_query('value')
|
||||
# prefer configured unit if nothing is set on the Tango device, else
|
||||
# update
|
||||
if attrInfo.unit != 'No unit':
|
||||
self.accessibles['value'].datatype.setProperty('unit', attrInfo.unit)
|
||||
self.__main_unit = attrInfo.unit
|
||||
except Exception as e:
|
||||
self.log.error(e)
|
||||
if self.__main_unit:
|
||||
super().applyMainUnit(self.__main_unit)
|
||||
|
||||
def doPoll(self):
|
||||
super().doPoll()
|
||||
@ -543,7 +555,7 @@ class AnalogOutput(PyTangoDevice, Drivable):
|
||||
return self.abslimits[1]
|
||||
|
||||
def __getusermin(self):
|
||||
return self.userlimits[0]
|
||||
return max(self.userlimits[0], self.abslimits[0])
|
||||
|
||||
def __setusermin(self, value):
|
||||
self.userlimits = (value, self.userlimits[1])
|
||||
@ -551,7 +563,7 @@ class AnalogOutput(PyTangoDevice, Drivable):
|
||||
usermin = property(__getusermin, __setusermin)
|
||||
|
||||
def __getusermax(self):
|
||||
return self.userlimits[1]
|
||||
return min(self.userlimits[1], self.abslimits[1])
|
||||
|
||||
def __setusermax(self, value):
|
||||
self.userlimits = (self.userlimits[0], value)
|
||||
|
Reference in New Issue
Block a user