mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-26 09:26:25 +08:00
docs(tools): Improve rendering of boolean parameters (#27325)
This commit is contained in:
@@ -85,10 +85,19 @@ If a listed parameter is missing from the Firmware see: [Finding/Updating Parame
|
||||
bitmask_output+=f"- `{bit}`: {bit_text}\n"
|
||||
bitmask_output+='\n\n'
|
||||
|
||||
if is_boolean and def_val=='1':
|
||||
def_val='Enabled (1)'
|
||||
if is_boolean and def_val=='0':
|
||||
def_val='Disabled (0)'
|
||||
if is_boolean:
|
||||
BOOLEAN_LABELS = {
|
||||
'0': 'Disabled',
|
||||
'1': 'Enabled'
|
||||
}
|
||||
# Give def_value an explanatory string (is def_value if no match)
|
||||
def_val = f"{BOOLEAN_LABELS[def_val]} ({def_val})" if def_val in BOOLEAN_LABELS else def_val
|
||||
|
||||
# Format values and their descriptions for display.
|
||||
boolean_values = '**Values:**\n\n'
|
||||
for key, label in BOOLEAN_LABELS.items():
|
||||
boolean_values += f"- `{key}`: {label}\n"
|
||||
boolean_values += '\n'
|
||||
|
||||
result += f'### {name} (`{type}`)' + ' {#' + name + '}\n\n'
|
||||
if apply_note_board_specific_group:
|
||||
@@ -99,6 +108,8 @@ If a listed parameter is missing from the Firmware see: [Finding/Updating Parame
|
||||
result += f'{short_desc}\n\n'
|
||||
if long_desc:
|
||||
result += f'{long_desc}\n\n'
|
||||
if is_boolean:
|
||||
result += boolean_values
|
||||
if enum_codes:
|
||||
result += enum_output
|
||||
if bitmask_list:
|
||||
|
||||
Reference in New Issue
Block a user