diff --git a/Tools/px4airframes/markdownout.py b/Tools/px4airframes/markdownout.py index 71fa3a1f16..7c8472a05e 100644 --- a/Tools/px4airframes/markdownout.py +++ b/Tools/px4airframes/markdownout.py @@ -5,6 +5,8 @@ class MarkdownTablesOutput(): def __init__(self, groups, board): result = ("# Airframes Reference\n" "> **Note** **This list is auto-generated from the source code** and contains the most recent airframes documentation.\n" + "> \n" + "> The **AUX** channels are only available on Pixhawk Boards (labeled with **AUX OUT**).\n" "\n") # TODO: describe meaning of green + blue color... @@ -15,25 +17,58 @@ class MarkdownTablesOutput(): # Display an image of the frame image_name = group.GetImageName() + result += '
\n' if image_name != 'AirframeUnknown': result += '\n' % (image_name) + # check if all outputs are equal for the group: if so, show them + # only once + outputs_prev = ['', ''] # split into MAINx and others (AUXx) + outputs_match = [True, True] + for param in group.GetParams(): + if not self.IsExcluded(param, board): + outputs_current = ['', ''] + for output_name in param.GetOutputCodes(): + value = param.GetOutputValue(output_name) + if output_name.lower().startswith('main'): + idx = 0 + else: + idx = 1 + outputs_current[idx] += '
  • %s: %s
  • ' % (output_name, value) + for i in range(2): + if len(outputs_current[i]) != 0: + if outputs_prev[i] == '': + outputs_prev[i] = outputs_current[i] + elif outputs_current[i] != outputs_prev[i]: + outputs_match[i] = False + + for i in range(2): + if len(outputs_prev[i]) == 0: + outputs_match[i] = False + if not outputs_match[i]: + outputs_prev[i] = '' + + if outputs_match[0] or outputs_match[1]: + result += '\n' + result += ' \n' + result += ' \n' + result += ' \n' + result += ' \n' + result += '\n' + result += '\n \n\n' % (outputs_prev[0], outputs_prev[1]) + result += '
    Common Outputs
      %s%s
    \n' + + result += '
    \n\n' + result += '\n' result += ' \n' result += ' \n' - result += ' \n' + result += ' \n' result += ' \n' result += '\n' for param in group.GetParams(): - - # check if there is an exclude tag for this airframe - excluded = False - for code in param.GetArchCodes(): - if "CONFIG_ARCH_BOARD_{0}".format(code) == board and param.GetArchValue(code) == "exclude": - excluded = True - - if not excluded: + if not self.IsExcluded(param, board): #print("generating: {0} {1}".format(param.GetName(), excluded)) name = param.GetName() airframe_id = param.GetId() @@ -47,11 +82,16 @@ class MarkdownTablesOutput(): if url != '': name_entry = '%s' % (url, name) outputs = '
    NameOutputs
    NameSpecific Outputs