mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-26 09:26:25 +08:00
fix(tools): preserve newlines and float values in param migration
- migrate_c_params.py: preserve newlines and paragraph breaks in long descriptions, use YAML block scalars for multi-line strings - generate_params.py: support @value tags on float type parameters (fixes RC*_REV enum values being lost during yaml generation)
This commit is contained in:
@@ -108,7 +108,7 @@ def parse_yaml_parameters_config(yaml_config, ethernet_supported):
|
||||
tags = '@group {:}'.format(param_group)
|
||||
if param['type'] == 'enum':
|
||||
param_type = 'INT32'
|
||||
for key in param['values']:
|
||||
for key in sorted(param['values'], key=float):
|
||||
tags += '\n * @value {:} {:}'.format(key, param['values'][key])
|
||||
elif param['type'] == 'bitmask':
|
||||
param_type = 'INT32'
|
||||
@@ -124,6 +124,9 @@ def parse_yaml_parameters_config(yaml_config, ethernet_supported):
|
||||
param_type = 'INT32'
|
||||
elif param['type'] == 'float':
|
||||
param_type = 'FLOAT'
|
||||
if 'values' in param:
|
||||
for key in sorted(param['values'], key=float):
|
||||
tags += '\n * @value {:} {:}'.format(key, param['values'][key])
|
||||
else:
|
||||
raise Exception("unknown param type {:}".format(param['type']))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user