mirror of
https://github.com/naruxde/revpimodio2.git
synced 2025-11-08 22:03:53 +01:00
feature: make export flag configurable for StructIO
replaceable IOs should also allow the configuration of the export flag
This commit is contained in:
@@ -1197,7 +1197,7 @@ class StructIO(IOBase):
|
||||
kwargs.get("defaultvalue", None),
|
||||
bitlength,
|
||||
parentio._slc_address.start,
|
||||
False,
|
||||
kwargs.get('export', parentio.export),
|
||||
str(parentio._slc_address.start).rjust(4, "0"),
|
||||
kwargs.get("bmk", ""),
|
||||
bitaddress
|
||||
|
||||
@@ -388,6 +388,16 @@ class RevPiModIO(object):
|
||||
"".format(io, creplaceio[io]["bit"])
|
||||
)
|
||||
|
||||
if "export" in creplaceio[io]:
|
||||
try:
|
||||
dict_replace["export"] = creplaceio[io].getboolean("export")
|
||||
except Exception:
|
||||
raise ValueError(
|
||||
"replace_io_file: could not convert '{0}' "
|
||||
"export '{1}' to bool"
|
||||
"".format(io, creplaceio[io]["export"])
|
||||
)
|
||||
|
||||
# Convert defaultvalue from config file
|
||||
if "defaultvalue" in creplaceio[io]:
|
||||
if dict_replace["frm"] == "?":
|
||||
@@ -845,6 +855,8 @@ class RevPiModIO(object):
|
||||
cp[io.name]["defaultvalue"] = str(io.defaultvalue)
|
||||
if io.bmk != "":
|
||||
cp[io.name]["bmk"] = io.bmk
|
||||
if io.export is not None:
|
||||
cp[io.name]["export"] = io.export
|
||||
|
||||
try:
|
||||
with open(filename, "w") as fh:
|
||||
|
||||
Reference in New Issue
Block a user