mirror of https://github.com/ArduPilot/ardupilot
param_parser - better tolerance for missing parameters
This commit is contained in:
parent
855d67c30a
commit
4de662e2af
|
@ -26,15 +26,21 @@ def wikichars_escape(text):
|
||||||
text = re.sub("\\"+c, '`'+c+'`', text)
|
text = re.sub("\\"+c, '`'+c+'`', text)
|
||||||
return text
|
return text
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def wiki_parameters(g, f):
|
def wiki_parameters(g, f):
|
||||||
|
|
||||||
t = "\n\n== %s Parameters ==\n" % (camelcase_escape(g.name))
|
t = "\n\n== %s Parameters ==\n" % (camelcase_escape(g.name))
|
||||||
|
|
||||||
for param in g.params:
|
for param in g.params:
|
||||||
|
if hasattr(param, 'DisplayName'):
|
||||||
t += "\n\n=== %s (%s) ===" % (camelcase_escape(param.DisplayName),camelcase_escape(param.name))
|
t += "\n\n=== %s (%s) ===" % (camelcase_escape(param.DisplayName),camelcase_escape(param.name))
|
||||||
|
else:
|
||||||
|
t += "\n\n=== %s ===" % camelcase_escape(param.name)
|
||||||
|
|
||||||
|
if hasattr(param, 'Description'):
|
||||||
t += "\n\n_%s_\n" % wikichars_escape(param.Description)
|
t += "\n\n_%s_\n" % wikichars_escape(param.Description)
|
||||||
|
else:
|
||||||
|
t += "\n\n_TODO: description_\n"
|
||||||
|
|
||||||
for field in param.__dict__.keys():
|
for field in param.__dict__.keys():
|
||||||
if field not in ['name', 'DisplayName', 'Description', 'User'] and field in known_param_fields:
|
if field not in ['name', 'DisplayName', 'Description', 'User'] and field in known_param_fields:
|
||||||
if field == 'Values' and prog_values_field.match(param.__dict__[field]):
|
if field == 'Values' and prog_values_field.match(param.__dict__[field]):
|
||||||
|
@ -51,8 +57,6 @@ def wiki_parameters(g, f):
|
||||||
f.write(t)
|
f.write(t)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
apm_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../')
|
apm_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), '../../../')
|
||||||
vehicle_paths = glob.glob(apm_path + "*/Parameters.pde")
|
vehicle_paths = glob.glob(apm_path + "*/Parameters.pde")
|
||||||
|
|
||||||
|
@ -114,6 +118,7 @@ print "Found %u documented libraries" % len(libraries)
|
||||||
for library in libraries:
|
for library in libraries:
|
||||||
print "===\n\n\nProcessing library %s" % library.name
|
print "===\n\n\nProcessing library %s" % library.name
|
||||||
|
|
||||||
|
if hasattr(library, 'Path'):
|
||||||
paths = library.Path.split(',')
|
paths = library.Path.split(',')
|
||||||
for path in paths:
|
for path in paths:
|
||||||
path = path.strip()
|
path = path.strip()
|
||||||
|
@ -139,8 +144,10 @@ for library in libraries:
|
||||||
|
|
||||||
##print p.__dict__
|
##print p.__dict__
|
||||||
library.params.append(p)
|
library.params.append(p)
|
||||||
|
else:
|
||||||
|
print "Skipped: no Path found"
|
||||||
|
|
||||||
#print "Processed %u documented parameters" % len(library.params)
|
print "Processed %u documented parameters" % len(library.params)
|
||||||
|
|
||||||
wiki_fname = 'Parameters.wiki'
|
wiki_fname = 'Parameters.wiki'
|
||||||
f = open(wiki_fname, mode='w')
|
f = open(wiki_fname, mode='w')
|
||||||
|
|
Loading…
Reference in New Issue