mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-06-01 02:55:07 +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+=f"- `{bit}`: {bit_text}\n"
|
||||||
bitmask_output+='\n\n'
|
bitmask_output+='\n\n'
|
||||||
|
|
||||||
if is_boolean and def_val=='1':
|
if is_boolean:
|
||||||
def_val='Enabled (1)'
|
BOOLEAN_LABELS = {
|
||||||
if is_boolean and def_val=='0':
|
'0': 'Disabled',
|
||||||
def_val='Disabled (0)'
|
'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'
|
result += f'### {name} (`{type}`)' + ' {#' + name + '}\n\n'
|
||||||
if apply_note_board_specific_group:
|
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'
|
result += f'{short_desc}\n\n'
|
||||||
if long_desc:
|
if long_desc:
|
||||||
result += f'{long_desc}\n\n'
|
result += f'{long_desc}\n\n'
|
||||||
|
if is_boolean:
|
||||||
|
result += boolean_values
|
||||||
if enum_codes:
|
if enum_codes:
|
||||||
result += enum_output
|
result += enum_output
|
||||||
if bitmask_list:
|
if bitmask_list:
|
||||||
|
|||||||
Reference in New Issue
Block a user