MLZ: Fix mapping in NamedDigitalOutput device
Change-Id: Iaef2c4672eb3eceeaba2ec5750f964864ce76aa9 Reviewed-on: https://forge.frm2.tum.de/review/17733 Tested-by: JenkinsCodeReview <bjoern_pedersen@frm2.tum.de> Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
This commit is contained in:
@@ -27,6 +27,7 @@
|
|||||||
Here we support devices which fulfill the official
|
Here we support devices which fulfill the official
|
||||||
MLZ TANGO interface for the respective device classes.
|
MLZ TANGO interface for the respective device classes.
|
||||||
"""
|
"""
|
||||||
|
from __future__ import division
|
||||||
|
|
||||||
import re
|
import re
|
||||||
from time import sleep, time as currenttime
|
from time import sleep, time as currenttime
|
||||||
@@ -397,9 +398,8 @@ class Sensor(AnalogInput):
|
|||||||
# we support the adjust method
|
# we support the adjust method
|
||||||
|
|
||||||
commands = {
|
commands = {
|
||||||
'setposition' : Command('Set the position to the given value.',
|
'setposition': Command('Set the position to the given value.',
|
||||||
arguments=[FloatRange()],
|
arguments=[FloatRange()], result=None,
|
||||||
result=None
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -422,7 +422,7 @@ class AnalogOutput(PyTangoDevice, Drivable):
|
|||||||
parameters = {
|
parameters = {
|
||||||
'userlimits': Param('User defined limits of device value',
|
'userlimits': Param('User defined limits of device value',
|
||||||
datatype=TupleOf(FloatRange(), FloatRange()),
|
datatype=TupleOf(FloatRange(), FloatRange()),
|
||||||
default=(float('-Inf'),float('+Inf')),
|
default=(float('-Inf'), float('+Inf')),
|
||||||
unit='main', readonly=False, poll=10,
|
unit='main', readonly=False, poll=10,
|
||||||
),
|
),
|
||||||
'abslimits': Param('Absolute limits of device value',
|
'abslimits': Param('Absolute limits of device value',
|
||||||
@@ -565,9 +565,8 @@ class Actuator(AnalogOutput):
|
|||||||
}
|
}
|
||||||
|
|
||||||
commands = {
|
commands = {
|
||||||
'setposition' : Command('Set the position to the given value.',
|
'setposition': Command('Set the position to the given value.',
|
||||||
arguments=[FloatRange()],
|
arguments=[FloatRange()], result=None,
|
||||||
result=None
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -814,17 +813,20 @@ class NamedDigitalOutput(DigitalOutput):
|
|||||||
"""A DigitalOutput with numeric values mapped to names.
|
"""A DigitalOutput with numeric values mapped to names.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
# parameters = {
|
parameters = {
|
||||||
# 'mapping': Param('A dictionary mapping state names to integers',
|
'mapping': Param('A dictionary mapping state names to integers',
|
||||||
# datatype=EnumType(), export=False), # XXX: !!!
|
datatype=StringType(), export=False),
|
||||||
# }
|
}
|
||||||
#
|
|
||||||
# def init(self):
|
def init(self):
|
||||||
# super(NamedDigitalOutput, self).init()
|
super(NamedDigitalOutput, self).init()
|
||||||
# try: # XXX: !!!
|
try:
|
||||||
# self.parameters['value'].datatype = EnumType(**eval(self.mapping))
|
# pylint: disable=eval-used
|
||||||
# except Exception as e:
|
self.parameters['value'].datatype = EnumType(**eval(self.mapping))
|
||||||
# raise ValueError('Illegal Value for mapping: %r' % e)
|
# pylint: disable=eval-used
|
||||||
|
self.parameters['target'].datatype = EnumType(**eval(self.mapping))
|
||||||
|
except Exception as e:
|
||||||
|
raise ValueError('Illegal Value for mapping: %r' % e)
|
||||||
|
|
||||||
def write_target(self, value):
|
def write_target(self, value):
|
||||||
# map from enum-str to integer value
|
# map from enum-str to integer value
|
||||||
@@ -919,8 +921,8 @@ class StringIO(PyTangoDevice, Module):
|
|||||||
arguments=[], result=IntRange(0)),
|
arguments=[], result=IntRange(0)),
|
||||||
'multicommunicate': Command('perform a sequence of communications',
|
'multicommunicate': Command('perform a sequence of communications',
|
||||||
arguments=[ArrayOf(
|
arguments=[ArrayOf(
|
||||||
TupleOf(StringType(), IntRange()),100)],
|
TupleOf(StringType(), IntRange()), 100)],
|
||||||
result=ArrayOf(StringType(),100)),
|
result=ArrayOf(StringType(), 100)),
|
||||||
}
|
}
|
||||||
|
|
||||||
def do_communicate(self, value=StringType()):
|
def do_communicate(self, value=StringType()):
|
||||||
|
|||||||
Reference in New Issue
Block a user