mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-28 05:43:33 +08:00
generate_params.py: fix bitmask param type
This commit is contained in:
@@ -110,6 +110,13 @@ def parse_yaml_parameters_config(yaml_config, ethernet_supported):
|
|||||||
param_type = 'INT32'
|
param_type = 'INT32'
|
||||||
for key in param['values']:
|
for key in param['values']:
|
||||||
tags += '\n * @value {:} {:}'.format(key, param['values'][key])
|
tags += '\n * @value {:} {:}'.format(key, param['values'][key])
|
||||||
|
elif param['type'] == 'bitmask':
|
||||||
|
param_type = 'INT32'
|
||||||
|
for key in param['bit']:
|
||||||
|
tags += '\n * @bit {:} {:}'.format(key, param['bit'][key])
|
||||||
|
max_val = max(key for key in param['bit'])
|
||||||
|
tags += '\n * @min 0'
|
||||||
|
tags += '\n * @max {:}'.format((1<<(max_val+1)) - 1)
|
||||||
elif param['type'] == 'boolean':
|
elif param['type'] == 'boolean':
|
||||||
param_type = 'INT32'
|
param_type = 'INT32'
|
||||||
tags += '\n * @boolean'
|
tags += '\n * @boolean'
|
||||||
@@ -120,7 +127,7 @@ def parse_yaml_parameters_config(yaml_config, ethernet_supported):
|
|||||||
else:
|
else:
|
||||||
raise Exception("unknown param type {:}".format(param['type']))
|
raise Exception("unknown param type {:}".format(param['type']))
|
||||||
|
|
||||||
for tag in ['decimal', 'increment', 'category', 'volatile', 'bit',
|
for tag in ['decimal', 'increment', 'category', 'volatile',
|
||||||
'min', 'max', 'unit', 'reboot_required']:
|
'min', 'max', 'unit', 'reboot_required']:
|
||||||
if tag in param:
|
if tag in param:
|
||||||
tags += '\n * @{:} {:}'.format(tag, param[tag])
|
tags += '\n * @{:} {:}'.format(tag, param[tag])
|
||||||
|
|||||||
Reference in New Issue
Block a user