mirror of
https://github.com/naruxde/revpimodio2.git
synced 2025-11-08 13:53:53 +01:00
fix: Check offset values of the devices for integers
In the event of a misconfiguration in PiCtory, it may happen that the offset values are given as floating point numbers. These devices and their IOs must ignore ModiO that it cannot be ensured which offset is correct. Signed-off-by: Sven Sager <akira@narux.de>
This commit is contained in:
@@ -302,6 +302,19 @@ class RevPiModIO(object):
|
||||
# Devices initialisieren
|
||||
err_names_check = {}
|
||||
for device in sorted(lst_devices, key=lambda x: x["offset"]):
|
||||
# Pre-check of values
|
||||
if float(device.get("offset")) != int(device.get("offset")):
|
||||
# Offset misconfigured
|
||||
warnings.warn(
|
||||
"Offset value {0} of device {1} on position {2} is invalid. "
|
||||
"This device and all IOs are ignored.".format(
|
||||
device.get("offset"),
|
||||
device.get("name"),
|
||||
device.get("position"),
|
||||
)
|
||||
)
|
||||
continue
|
||||
|
||||
# VDev alter piCtory Versionen auf KUNBUS-Standard ändern
|
||||
if device["position"] == "adap.":
|
||||
device["position"] = 64
|
||||
|
||||
Reference in New Issue
Block a user