forked from Archive/PX4-Autopilot
commit
b3e74175bc
|
@ -12,11 +12,11 @@ class DokuWikiTablesOutput():
|
|||
result += "^ Name ^ Description ^ Min ^ Max ^ Default ^\n"
|
||||
result += "^ ::: ^ Comment ^^^^\n"
|
||||
for param in group.GetParams():
|
||||
code = param.GetFieldValue("code")
|
||||
code = param.GetName()
|
||||
def_val = param.GetDefault()
|
||||
name = param.GetFieldValue("short_desc")
|
||||
min_val = param.GetFieldValue("min")
|
||||
max_val = param.GetFieldValue("max")
|
||||
def_val = param.GetFieldValue("default")
|
||||
long_desc = param.GetFieldValue("long_desc")
|
||||
|
||||
if name == code:
|
||||
|
|
|
@ -37,20 +37,30 @@ class Parameter(object):
|
|||
|
||||
# Define sorting order of the fields
|
||||
priority = {
|
||||
"code": 10,
|
||||
"type": 9,
|
||||
"board": 9,
|
||||
"short_desc": 8,
|
||||
"long_desc": 7,
|
||||
"default": 6,
|
||||
"min": 5,
|
||||
"max": 4,
|
||||
"unit": 3,
|
||||
# all others == 0 (sorted alphabetically)
|
||||
}
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, name, type, default = ""):
|
||||
self.fields = {}
|
||||
self.name = name
|
||||
self.type = type
|
||||
self.default = default
|
||||
|
||||
def GetName(self):
|
||||
return self.name
|
||||
|
||||
def GetType(self):
|
||||
return self.type
|
||||
|
||||
def GetDefault(self):
|
||||
return self.default
|
||||
|
||||
def SetField(self, code, value):
|
||||
"""
|
||||
Set named field value
|
||||
|
@ -88,7 +98,7 @@ class SourceParser(object):
|
|||
re_is_a_number = re.compile(r'^-?[0-9\.]')
|
||||
re_remove_dots = re.compile(r'\.+$')
|
||||
|
||||
valid_tags = set(["group", "min", "max", "unit"])
|
||||
valid_tags = set(["group", "board", "min", "max", "unit"])
|
||||
|
||||
# Order of parameter groups
|
||||
priority = {
|
||||
|
@ -177,15 +187,12 @@ class SourceParser(object):
|
|||
# Non-empty line outside the comment
|
||||
m = self.re_parameter_definition.match(line)
|
||||
if m:
|
||||
tp, code, defval = m.group(1, 2, 3)
|
||||
tp, name, defval = m.group(1, 2, 3)
|
||||
# Remove trailing type specifier from numbers: 0.1f => 0.1
|
||||
if self.re_is_a_number.match(defval):
|
||||
defval = self.re_cut_type_specifier.sub('', defval)
|
||||
param = Parameter()
|
||||
param.SetField("code", code)
|
||||
param.SetField("short_desc", code)
|
||||
param.SetField("type", tp)
|
||||
param.SetField("default", defval)
|
||||
param = Parameter(name, tp, defval)
|
||||
param.SetField("short_desc", name)
|
||||
# If comment was found before the parameter declaration,
|
||||
# inject its data into the newly created parameter.
|
||||
group = "Miscellaneous"
|
||||
|
@ -211,11 +218,9 @@ class SourceParser(object):
|
|||
# Nasty code dup, but this will all go away soon, so quick and dirty (DonLakeFlyer)
|
||||
m = self.re_px4_parameter_definition.match(line)
|
||||
if m:
|
||||
tp, code = m.group(1, 2)
|
||||
param = Parameter()
|
||||
param.SetField("code", code)
|
||||
param.SetField("short_desc", code)
|
||||
param.SetField("type", tp)
|
||||
tp, name = m.group(1, 2)
|
||||
param = Parameter(name, tp)
|
||||
param.SetField("short_desc", name)
|
||||
# If comment was found before the parameter declaration,
|
||||
# inject its data into the newly created parameter.
|
||||
group = "Miscellaneous"
|
||||
|
|
|
@ -18,26 +18,36 @@ def indent(elem, level=0):
|
|||
|
||||
class XMLOutput():
|
||||
|
||||
def __init__(self, groups):
|
||||
def __init__(self, groups, board):
|
||||
xml_parameters = ET.Element("parameters")
|
||||
xml_version = ET.SubElement(xml_parameters, "version")
|
||||
xml_version.text = "2"
|
||||
xml_version.text = "3"
|
||||
last_param_name = ""
|
||||
board_specific_param_set = False
|
||||
for group in groups:
|
||||
xml_group = ET.SubElement(xml_parameters, "group")
|
||||
xml_group.attrib["name"] = group.GetName()
|
||||
for param in group.GetParams():
|
||||
xml_param = ET.SubElement(xml_group, "parameter")
|
||||
for code in param.GetFieldCodes():
|
||||
value = param.GetFieldValue(code)
|
||||
if code == "code":
|
||||
xml_param.attrib["name"] = value
|
||||
elif code == "default":
|
||||
xml_param.attrib["default"] = value
|
||||
elif code == "type":
|
||||
xml_param.attrib["type"] = value
|
||||
else:
|
||||
xml_field = ET.SubElement(xml_param, code)
|
||||
xml_field.text = value
|
||||
if (last_param_name == param.GetName() and not board_specific_param_set) or last_param_name != param.GetName():
|
||||
xml_param = ET.SubElement(xml_group, "parameter")
|
||||
xml_param.attrib["name"] = param.GetName()
|
||||
xml_param.attrib["default"] = param.GetDefault()
|
||||
xml_param.attrib["type"] = param.GetType()
|
||||
last_param_name = param.GetName()
|
||||
for code in param.GetFieldCodes():
|
||||
value = param.GetFieldValue(code)
|
||||
if code == "board":
|
||||
if value == board:
|
||||
board_specific_param_set = True
|
||||
xml_field = ET.SubElement(xml_param, code)
|
||||
xml_field.text = value
|
||||
else:
|
||||
xml_group.remove(xml_param)
|
||||
else:
|
||||
xml_field = ET.SubElement(xml_param, code)
|
||||
xml_field.text = value
|
||||
if last_param_name != param.GetName():
|
||||
board_specific_param_set = False
|
||||
indent(xml_parameters)
|
||||
self.xml_document = ET.ElementTree(xml_parameters)
|
||||
|
||||
|
|
|
@ -65,6 +65,11 @@ def main():
|
|||
metavar="FILENAME",
|
||||
help="Create XML file"
|
||||
" (default FILENAME: parameters.xml)")
|
||||
parser.add_argument("-b", "--board",
|
||||
nargs='?',
|
||||
const="",
|
||||
metavar="BOARD",
|
||||
help="Board to create xml parameter xml for")
|
||||
parser.add_argument("-w", "--wiki",
|
||||
nargs='?',
|
||||
const="parameters.wiki",
|
||||
|
@ -116,7 +121,7 @@ def main():
|
|||
# Output to XML file
|
||||
if args.xml:
|
||||
print("Creating XML file " + args.xml)
|
||||
out = xmlout.XMLOutput(param_groups)
|
||||
out = xmlout.XMLOutput(param_groups, args.board)
|
||||
out.Save(args.xml)
|
||||
|
||||
# Output to DokuWiki tables
|
||||
|
|
|
@ -494,7 +494,7 @@ $(filter %.S.o,$(OBJS)): $(WORK_DIR)%.S.o: %.S $(GLOBAL_DEPS)
|
|||
$(PRODUCT_BUNDLE): $(PRODUCT_BIN)
|
||||
@$(ECHO) %% Generating $@
|
||||
ifdef GEN_PARAM_XML
|
||||
python $(PX4_BASE)/Tools/px_process_params.py --src-path $(PX4_BASE)/src --xml
|
||||
python $(PX4_BASE)/Tools/px_process_params.py --src-path $(PX4_BASE)/src --board CONFIG_ARCH_BOARD_$(CONFIG_BOARD) --xml
|
||||
$(Q) $(MKFW) --prototype $(IMAGE_DIR)/$(BOARD).prototype \
|
||||
--git_identity $(PX4_BASE) \
|
||||
--parameter_xml $(PRODUCT_PARAMXML) \
|
||||
|
|
|
@ -960,6 +960,7 @@ PARAM_DEFINE_INT32(BAT_V_SCALE_IO, 10000);
|
|||
/**
|
||||
* Scaling factor for battery voltage sensor on FMU v2.
|
||||
*
|
||||
* @board CONFIG_ARCH_BOARD_PX4FMU_V2
|
||||
* @group Battery Calibration
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(BAT_V_SCALING, 0.0082f);
|
||||
|
@ -969,6 +970,7 @@ PARAM_DEFINE_FLOAT(BAT_V_SCALING, 0.0082f);
|
|||
*
|
||||
* For R70 = 133K, R71 = 10K --> scale = 1.8 * 143 / (4096*10) = 0.0063
|
||||
*
|
||||
* @board CONFIG_ARCH_BOARD_AEROCORE
|
||||
* @group Battery Calibration
|
||||
*/
|
||||
PARAM_DEFINE_FLOAT(BAT_V_SCALING, 0.0063f);
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
*/
|
||||
|
||||
#include <px4.h>
|
||||
#include <systemlib/circuit_breaker_params.h>
|
||||
|
||||
/**
|
||||
* Circuit breaker for power supply check
|
||||
|
@ -56,7 +55,7 @@
|
|||
* @max 894281
|
||||
* @group Circuit Breaker
|
||||
*/
|
||||
PX4_PARAM_DEFINE_INT32(CBRK_SUPPLY_CHK);
|
||||
PARAM_DEFINE_INT32(CBRK_SUPPLY_CHK, 0);
|
||||
|
||||
/**
|
||||
* Circuit breaker for rate controller output
|
||||
|
@ -69,7 +68,7 @@ PX4_PARAM_DEFINE_INT32(CBRK_SUPPLY_CHK);
|
|||
* @max 140253
|
||||
* @group Circuit Breaker
|
||||
*/
|
||||
PX4_PARAM_DEFINE_INT32(CBRK_RATE_CTRL);
|
||||
PARAM_DEFINE_INT32(CBRK_RATE_CTRL, 0);
|
||||
|
||||
/**
|
||||
* Circuit breaker for IO safety
|
||||
|
@ -81,7 +80,7 @@ PX4_PARAM_DEFINE_INT32(CBRK_RATE_CTRL);
|
|||
* @max 22027
|
||||
* @group Circuit Breaker
|
||||
*/
|
||||
PX4_PARAM_DEFINE_INT32(CBRK_IO_SAFETY);
|
||||
PARAM_DEFINE_INT32(CBRK_IO_SAFETY, 0);
|
||||
|
||||
/**
|
||||
* Circuit breaker for airspeed sensor
|
||||
|
@ -93,7 +92,7 @@ PX4_PARAM_DEFINE_INT32(CBRK_IO_SAFETY);
|
|||
* @max 162128
|
||||
* @group Circuit Breaker
|
||||
*/
|
||||
PX4_PARAM_DEFINE_INT32(CBRK_AIRSPD_CHK);
|
||||
PARAM_DEFINE_INT32(CBRK_AIRSPD_CHK, 0);
|
||||
|
||||
/**
|
||||
* Circuit breaker for flight termination
|
||||
|
@ -106,7 +105,7 @@ PX4_PARAM_DEFINE_INT32(CBRK_AIRSPD_CHK);
|
|||
* @max 121212
|
||||
* @group Circuit Breaker
|
||||
*/
|
||||
PX4_PARAM_DEFINE_INT32(CBRK_FLIGHTTERM);
|
||||
PARAM_DEFINE_INT32(CBRK_FLIGHTTERM, 121212);
|
||||
|
||||
/**
|
||||
* Circuit breaker for engine failure detection
|
||||
|
@ -120,4 +119,4 @@ PX4_PARAM_DEFINE_INT32(CBRK_FLIGHTTERM);
|
|||
* @max 284953
|
||||
* @group Circuit Breaker
|
||||
*/
|
||||
PX4_PARAM_DEFINE_INT32(CBRK_ENGINEFAIL);
|
||||
PARAM_DEFINE_INT32(CBRK_ENGINEFAIL, 284953);
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
#define PARAM_CBRK_SUPPLY_CHK_DEFAULT 0
|
||||
#define PARAM_CBRK_RATE_CTRL_DEFAULT 0
|
||||
#define PARAM_CBRK_IO_SAFETY_DEFAULT 0
|
||||
#define PARAM_CBRK_AIRSPD_CHK_DEFAULT 0
|
||||
#define PARAM_CBRK_FLIGHTTERM_DEFAULT 121212
|
||||
#define PARAM_CBRK_ENGINEFAIL_DEFAULT 284953
|
||||
#define PARAM_CBRK_GPSFAIL_DEFAULT 240024
|
Loading…
Reference in New Issue