Commit 38ce5942 authored by Chris Woodall's avatar Chris Woodall
Browse files

Added support for constdefault with arrays

parent f75681e8
Pipeline #3785 passed with stage
in 36 seconds
......@@ -112,17 +112,24 @@ def cli(ctx, doc_dir, output_dir, master_dir, yaml_files):
# Find all array types and expand them out.
for (j, index) in enumerate(objdict['indexes']):
if index.get('array', False):
# get the const default if it exists.
constdefault = index.pop('constdefault', None)
for i in range(index['default']):
objdict['indexes'].append({
new_index = {
"index": index["index"],
"subindex": i + 1,
"name": "{0}_{1}".format(index["name"], i+1),
"datatype": index["datatype"],
"access": index["access"],
"save": index["save"],
"default": 0,
"comment": "{0} element {1}".format(index["name"], i+1)
})
"comment": "{0} element {1}".format(index["name"], i+1),
"export_for_mainboard": index.get("export_for_mainboard", False)
}
if constdefault:
new_index["constdefault"] = "{0}[{1}]".format(constdefault, i)
else:
new_index["default"] = 0
objdict['indexes'].append(new_index)
objdict['indexes'][j]["datatype"] = "U8"
objdict['indexes'][j]["access"] = "RO"
objdict['indexes'][j]["save"] = False
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment