mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 14:08:52 +08:00
Params: Switch level to category and move it to attribute along with volatile
This makes it easier for QGC to parse.
This commit is contained in:
@@ -78,7 +78,7 @@ add_custom_command(OUTPUT ${parameters_xml}
|
||||
--inject-xml ${CMAKE_CURRENT_SOURCE_DIR}/parameters_injected.xml
|
||||
--overrides ${PARAM_DEFAULT_OVERRIDES}
|
||||
#--verbose
|
||||
DEPENDS ${param_src_files} px_process_params.py px4params/srcparser.py px4params/srcscanner.py parameters_injected.xml
|
||||
DEPENDS ${param_src_files} px_process_params.py px4params/srcparser.py px4params/srcscanner.py px4params/xmlout.py parameters_injected.xml
|
||||
COMMENT "Generating parameters.xml"
|
||||
)
|
||||
add_custom_target(parameters_xml DEPENDS ${parameters_xml})
|
||||
|
||||
@@ -58,6 +58,7 @@ class Parameter(object):
|
||||
self.type = type
|
||||
self.default = default
|
||||
self.volatile = "false"
|
||||
self.category = ""
|
||||
|
||||
def GetName(self):
|
||||
return self.name
|
||||
@@ -68,6 +69,9 @@ class Parameter(object):
|
||||
def GetDefault(self):
|
||||
return self.default
|
||||
|
||||
def GetCategory(self):
|
||||
return self.category.title()
|
||||
|
||||
def GetVolatile(self):
|
||||
return self.volatile
|
||||
|
||||
@@ -95,6 +99,12 @@ class Parameter(object):
|
||||
"""
|
||||
self.volatile = "true"
|
||||
|
||||
def SetCategory(self, category):
|
||||
"""
|
||||
Set param category
|
||||
"""
|
||||
self.category = category
|
||||
|
||||
def GetFieldCodes(self):
|
||||
"""
|
||||
Return list of existing field codes in convenient order
|
||||
@@ -165,7 +175,7 @@ class SourceParser(object):
|
||||
re_remove_dots = re.compile(r'\.+$')
|
||||
re_remove_carriage_return = re.compile('\n+')
|
||||
|
||||
valid_tags = set(["group", "board", "min", "max", "unit", "decimal", "increment", "reboot_required", "value", "boolean", "bit", "level", "volatile"])
|
||||
valid_tags = set(["group", "board", "min", "max", "unit", "decimal", "increment", "reboot_required", "value", "boolean", "bit", "category", "volatile"])
|
||||
|
||||
# Order of parameter groups
|
||||
priority = {
|
||||
@@ -294,6 +304,8 @@ class SourceParser(object):
|
||||
group = tags[tag]
|
||||
elif tag == "volatile":
|
||||
param.SetVolatile()
|
||||
elif tag == "category":
|
||||
param.SetCategory(tags[tag])
|
||||
elif tag not in self.valid_tags:
|
||||
sys.stderr.write("Skipping invalid documentation tag: '%s'\n" % tag)
|
||||
return False
|
||||
|
||||
@@ -41,7 +41,10 @@ class XMLOutput():
|
||||
xml_param.attrib["name"] = param.GetName()
|
||||
xml_param.attrib["default"] = param.GetDefault()
|
||||
xml_param.attrib["type"] = param.GetType()
|
||||
xml_param.attrib["volatile"] = param.GetVolatile()
|
||||
if (param.GetVolatile() == "true"):
|
||||
xml_param.attrib["volatile"] = param.GetVolatile()
|
||||
if (param.GetCategory()):
|
||||
xml_param.attrib["category"] = param.GetCategory()
|
||||
last_param_name = param.GetName()
|
||||
for code in param.GetFieldCodes():
|
||||
value = param.GetFieldValue(code)
|
||||
|
||||
Reference in New Issue
Block a user