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
|
||||||
@ -398,8 +399,7 @@ class Sensor(AnalogInput):
|
|||||||
|
|
||||||
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
|
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -566,8 +566,7 @@ 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
|
||||||
|
Reference in New Issue
Block a user