feature: make export flag configurable for StructIO

replaceable IOs should also allow the configuration of the export flag
This commit is contained in:
Nicolai Buchwitz
2021-01-12 19:10:13 +01:00
parent ff0f84bb03
commit 186406623b
2 changed files with 13 additions and 1 deletions

View File

@@ -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

View File

@@ -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: