From ce828af85c4fbdf7205543c461076f72b2a3f73c Mon Sep 17 00:00:00 2001 From: Nick <145654544+ttechnick@users.noreply.github.com> Date: Fri, 6 Mar 2026 09:00:52 +0100 Subject: [PATCH] actuators: remove function from center param (#26517) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix center parameter metadata * revert module_schema --------- Co-authored-by: Beat Küng --- .../generate_actuators_metadata.py | 17 ++++--- Tools/module_config/generate_params.py | 6 +-- src/drivers/pca9685_pwm_out/module.yaml | 2 +- src/drivers/pwm_out/module.yaml | 2 +- validation/module_schema.yaml | 44 +++++++++---------- 5 files changed, 33 insertions(+), 38 deletions(-) diff --git a/Tools/module_config/generate_actuators_metadata.py b/Tools/module_config/generate_actuators_metadata.py index 5d38ecf499..38471b6821 100755 --- a/Tools/module_config/generate_actuators_metadata.py +++ b/Tools/module_config/generate_actuators_metadata.py @@ -234,14 +234,14 @@ def get_actuator_output(yaml_config, output_functions, timer_config_file, verbos param_prefix = process_param_prefix(group['param_prefix']) standard_params = group.get('standard_params', {}) standard_params_array = [ - ( 'function', 'Function', 'FUNC', False ), - ( 'disarmed', 'Disarmed', 'DIS', False ), - ( 'min', 'Minimum', 'MIN', False ), - ( 'max', 'Maximum', 'MAX', False ), - ( 'center', 'Center\n(for Servos)', 'CENT', False ), - ( 'failsafe', 'Failsafe', 'FAIL', True ), + ( 'function', 'Function', 'FUNC', False, True ), + ( 'disarmed', 'Disarmed', 'DIS', False, True ), + ( 'min', 'Minimum', 'MIN', False, True ), + ( 'center', 'Center\n(for Servos)', 'CENT', False, False ), + ( 'max', 'Maximum', 'MAX', False, True ), + ( 'failsafe', 'Failsafe', 'FAIL', True, True ), ] - for key, label, param_suffix, advanced in standard_params_array: + for key, label, param_suffix, advanced, has_function in standard_params_array: show_if = None if key in standard_params and 'show_if' in standard_params[key]: show_if = standard_params[key]['show_if'] @@ -250,13 +250,12 @@ def get_actuator_output(yaml_config, output_functions, timer_config_file, verbos param = { 'label': label, 'name': param_prefix+'_'+param_suffix+'${i}', - 'function': key, } + if has_function: param['function'] = key if advanced: param['advanced'] = True if show_if: param['show-if'] = show_if per_channel_params.append(param) - param = { 'label': 'Rev Range\n(for Servos)', 'name': param_prefix+'_REV', diff --git a/Tools/module_config/generate_params.py b/Tools/module_config/generate_params.py index ecc29a4519..4404873bb4 100755 --- a/Tools/module_config/generate_params.py +++ b/Tools/module_config/generate_params.py @@ -312,11 +312,7 @@ When set to -1 (default), the value depends on the function (see {:}). if standard_params[key]['max'] >= 1<<16: raise Exception('maximum value for {:} expected <= {:} (got {:})'.format(key, 1<<16, standard_params[key]['max'])) - if key == 'failsafe': - standard_params[key]['default'] = -1 - standard_params[key]['min'] = -1 - - if key == 'center': + if key == 'failsafe' or key == 'center': standard_params[key]['default'] = -1 standard_params[key]['min'] = -1 diff --git a/src/drivers/pca9685_pwm_out/module.yaml b/src/drivers/pca9685_pwm_out/module.yaml index e10d8da38c..ce69223dd7 100644 --- a/src/drivers/pca9685_pwm_out/module.yaml +++ b/src/drivers/pca9685_pwm_out/module.yaml @@ -6,8 +6,8 @@ actuator_output: standard_params: disarmed: { min: 800, max: 2200, default: 1000 } min: { min: 800, max: 1400, default: 1100 } - max: { min: 1600, max: 2200, default: 1900 } center: { min: 800, max: 2200} + max: { min: 1600, max: 2200, default: 1900 } failsafe: { min: 800, max: 2200 } custom_params: - name: 'DUTY_EN' diff --git a/src/drivers/pwm_out/module.yaml b/src/drivers/pwm_out/module.yaml index 2c5e54e83d..c788296e3d 100644 --- a/src/drivers/pwm_out/module.yaml +++ b/src/drivers/pwm_out/module.yaml @@ -7,8 +7,8 @@ actuator_output: standard_params: disarmed: { min: 800, max: 2200, default: 1000 } min: { min: 800, max: 1400, default: 1000 } - max: { min: 1600, max: 2200, default: 2000 } center: { min: 800, max: 2200} + max: { min: 1600, max: 2200, default: 2000 } failsafe: { min: 800, max: 2200 } extra_function_groups: [ pwm_fmu ] pwm_timer_param: diff --git a/validation/module_schema.yaml b/validation/module_schema.yaml index a2f77f75ee..9af7de8234 100644 --- a/validation/module_schema.yaml +++ b/validation/module_schema.yaml @@ -330,28 +330,6 @@ actuator_output: # ui only shows the param if this condition is true type: string regex: *condition_regex - max: - type: dict - schema: - min: - # Minimum maximum value - type: integer - min: 0 - max: 65536 - max: - # Maximum maximum value - type: integer - min: 0 - max: 65536 - default: - # Default maximum value - type: integer - min: 0 - max: 65536 - show_if: - # ui only shows the param if this condition is true - type: string - regex: *condition_regex center: type: dict schema: @@ -374,6 +352,28 @@ actuator_output: # ui only shows the param if this condition is true type: string regex: *condition_regex + max: + type: dict + schema: + min: + # Minimum maximum value + type: integer + min: 0 + max: 65536 + max: + # Maximum maximum value + type: integer + min: 0 + max: 65536 + default: + # Default maximum value + type: integer + min: 0 + max: 65536 + show_if: + # ui only shows the param if this condition is true + type: string + regex: *condition_regex failsafe: type: dict schema: