From ccc1f0e8fa572cb94592ca820f077142363b2cee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Mon, 29 Nov 2021 13:50:09 +0100 Subject: [PATCH] generate_actuators_metadata: minor additions (index_offset, item_label_prefix) --- Tools/module_config/generate_actuators_metadata.py | 8 +++++++- validation/module_schema.yaml | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Tools/module_config/generate_actuators_metadata.py b/Tools/module_config/generate_actuators_metadata.py index 7addc000ba..abff0a01a0 100755 --- a/Tools/module_config/generate_actuators_metadata.py +++ b/Tools/module_config/generate_actuators_metadata.py @@ -346,33 +346,39 @@ def get_mixers(yaml_config, output_functions, verbose): if 'count' in actuator_conf: # possibly dynamic size actuator['count'] = actuator_conf['count'] - per_item_params = actuator_conf['per_item_parameters'] + per_item_params = actuator_conf.get('per_item_parameters', {}) params = [] if 'standard' in per_item_params: standard_params = per_item_params['standard'] + index_offset = standard_params.get('index_offset', 0) if 'position' in standard_params: params.extend([ { 'label': 'Position X', 'function': 'posx', 'name': standard_params['position'][0], + 'index-offset': index_offset, }, { 'label': 'Position Y', 'function': 'posy', 'name': standard_params['position'][1], + 'index-offset': index_offset, }, { 'label': 'Position Z', 'function': 'posz', 'name': standard_params['position'][2], 'advanced': True, + 'index-offset': index_offset, }, ]) if 'extra' in per_item_params: for extra_param in per_item_params['extra']: params.append({k.replace('_','-'): v for k, v in extra_param.items()}) actuator['per-item-parameters'] = params + if 'item_label_prefix' in actuator_conf: + actuator['item-label-prefix'] = actuator_conf['item_label_prefix'] else: # fixed size labels = [] pos_x = [] diff --git a/validation/module_schema.yaml b/validation/module_schema.yaml index 118c499f7b..465b56b0e0 100644 --- a/validation/module_schema.yaml +++ b/validation/module_schema.yaml @@ -539,6 +539,13 @@ mixer: oneof: - type: string - type: integer + item_label_prefix: + # optional per-item label prefix list or (indexed) string + oneof: + - type: list + schema: + type: string + - type: string parameters: type: list minlength: 1 @@ -556,6 +563,8 @@ mixer: schema: # position param names type: string + index_offset: + type: integer extra: type: list schema: *mixer_parameter