mlz: Zapf fix unit handling and small errors
Change-Id: Iaa5ed175582d8399cc0c69ba72c3ab8e6e51ecf6 Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/32920 Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de> Tested-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de> Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de>
This commit is contained in:
parent
1017925ca0
commit
7d7cb02f17
@ -99,6 +99,8 @@ class ZapfPinata(Pinata):
|
|||||||
'min': max(devinfo.info['absmin'], -UNLIMITED),
|
'min': max(devinfo.info['absmin'], -UNLIMITED),
|
||||||
'max': min(devinfo.info['absmax'], UNLIMITED),
|
'max': min(devinfo.info['absmax'], UNLIMITED),
|
||||||
}
|
}
|
||||||
|
if devinfo.info['unit'] and devinfo.info['basetype'] == 'float':
|
||||||
|
config['value']['unit'] = devinfo.info['unit']
|
||||||
if devinfo.info['access'] == 'rw':
|
if devinfo.info['access'] == 'rw':
|
||||||
config['target'] = {
|
config['target'] = {
|
||||||
'min': config['value']['min'],
|
'min': config['value']['min'],
|
||||||
@ -131,8 +133,6 @@ STATUS_MAP = {
|
|||||||
class PLCBase:
|
class PLCBase:
|
||||||
status = Parameter(datatype=StatusType(Drivable, 'INITIALIZING',
|
status = Parameter(datatype=StatusType(Drivable, 'INITIALIZING',
|
||||||
'DISABLED', 'STARTING'))
|
'DISABLED', 'STARTING'))
|
||||||
status_code = Parameter('raw internal status code',
|
|
||||||
IntRange(0, 2**32-1))
|
|
||||||
plcio = Property('plc io device', ValueType())
|
plcio = Property('plc io device', ValueType())
|
||||||
plc_name = Property('plc io device', StringType(), export=True)
|
plc_name = Property('plc io device', StringType(), export=True)
|
||||||
_pinata = Attached(ZapfPinata) # TODO: make this automatic?
|
_pinata = Attached(ZapfPinata) # TODO: make this automatic?
|
||||||
@ -159,6 +159,12 @@ class PLCBase:
|
|||||||
dataty = cls._map_datatype(info)
|
dataty = cls._map_datatype(info)
|
||||||
if dataty is None:
|
if dataty is None:
|
||||||
continue
|
continue
|
||||||
|
if info['basetype'] == 'float' and info['unit']: # TODO: better handling
|
||||||
|
param = Parameter(info['description'],
|
||||||
|
dataty,
|
||||||
|
unit=info['unit'],
|
||||||
|
readonly=readonly)
|
||||||
|
else:
|
||||||
param = Parameter(info['description'],
|
param = Parameter(info['description'],
|
||||||
dataty,
|
dataty,
|
||||||
readonly=readonly)
|
readonly=readonly)
|
||||||
@ -223,7 +229,7 @@ class PLCBase:
|
|||||||
if not add_members:
|
if not add_members:
|
||||||
return cls
|
return cls
|
||||||
new_name = '_' + cls.__name__ + '_' \
|
new_name = '_' + cls.__name__ + '_' \
|
||||||
+ internalize_name("blub")
|
+ internalize_name("extended")
|
||||||
return type(new_name, (cls,), add_members)
|
return type(new_name, (cls,), add_members)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -254,10 +260,6 @@ class PLCBase:
|
|||||||
msg.append(self.plcio.decode_errid(err_id))
|
msg.append(self.plcio.decode_errid(err_id))
|
||||||
return status, ', '.join(msg)
|
return status, ', '.join(msg)
|
||||||
|
|
||||||
def read_status_code(self):
|
|
||||||
state, reason, aux, _ = self.plcio.read_status()
|
|
||||||
return state << 28 | reason << 24 | aux
|
|
||||||
|
|
||||||
@Command()
|
@Command()
|
||||||
def stop(self):
|
def stop(self):
|
||||||
"""Stop the operation of this module.
|
"""Stop the operation of this module.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user