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),
|
kwargs.get("defaultvalue", None),
|
||||||
bitlength,
|
bitlength,
|
||||||
parentio._slc_address.start,
|
parentio._slc_address.start,
|
||||||
False,
|
kwargs.get('export', parentio.export),
|
||||||
str(parentio._slc_address.start).rjust(4, "0"),
|
str(parentio._slc_address.start).rjust(4, "0"),
|
||||||
kwargs.get("bmk", ""),
|
kwargs.get("bmk", ""),
|
||||||
bitaddress
|
bitaddress
|
||||||
|
|||||||
@@ -388,6 +388,16 @@ class RevPiModIO(object):
|
|||||||
"".format(io, creplaceio[io]["bit"])
|
"".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
|
# Convert defaultvalue from config file
|
||||||
if "defaultvalue" in creplaceio[io]:
|
if "defaultvalue" in creplaceio[io]:
|
||||||
if dict_replace["frm"] == "?":
|
if dict_replace["frm"] == "?":
|
||||||
@@ -845,6 +855,8 @@ class RevPiModIO(object):
|
|||||||
cp[io.name]["defaultvalue"] = str(io.defaultvalue)
|
cp[io.name]["defaultvalue"] = str(io.defaultvalue)
|
||||||
if io.bmk != "":
|
if io.bmk != "":
|
||||||
cp[io.name]["bmk"] = io.bmk
|
cp[io.name]["bmk"] = io.bmk
|
||||||
|
if io.export is not None:
|
||||||
|
cp[io.name]["export"] = io.export
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with open(filename, "w") as fh:
|
with open(filename, "w") as fh:
|
||||||
|
|||||||
Reference in New Issue
Block a user