From 357a16aca6a468637e9a7d40c192ec5918e008ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beat=20K=C3=BCng?= Date: Mon, 8 Nov 2021 11:25:03 +0100 Subject: [PATCH] pwm_out_sim: split module.yaml into HIL+SIM files --- Tools/module_config/generate_actuators_metadata.py | 5 ----- Tools/module_config/generate_params.py | 6 ------ src/drivers/pwm_out_sim/CMakeLists.txt | 9 ++++++++- src/drivers/pwm_out_sim/module.yaml | 7 ------- src/drivers/pwm_out_sim/module_hil.yaml | 8 ++++++++ src/drivers/pwm_out_sim/module_sim.yaml | 7 +++++++ validation/module_schema.yaml | 2 +- 7 files changed, 24 insertions(+), 20 deletions(-) delete mode 100644 src/drivers/pwm_out_sim/module.yaml create mode 100644 src/drivers/pwm_out_sim/module_hil.yaml create mode 100644 src/drivers/pwm_out_sim/module_sim.yaml diff --git a/Tools/module_config/generate_actuators_metadata.py b/Tools/module_config/generate_actuators_metadata.py index b10a40bde9..930eab5cb6 100755 --- a/Tools/module_config/generate_actuators_metadata.py +++ b/Tools/module_config/generate_actuators_metadata.py @@ -105,9 +105,6 @@ def process_module_name(module_name): return module_name def process_param_prefix(param_prefix): - if param_prefix == '${PWM_MAIN_OR_HIL}': - if board == 'px4_sitl': return 'PWM_MAIN' - return 'HIL_ACT' if param_prefix == '${PWM_MAIN_OR_AUX}': if board_with_io: return 'PWM_AUX' return 'PWM_MAIN' @@ -116,8 +113,6 @@ def process_param_prefix(param_prefix): return param_prefix def process_channel_label(module_name, channel_label, no_prefix): - if channel_label == '${PWM_MAIN_OR_HIL}': - return 'Channel' if channel_label == '${PWM_MAIN_OR_AUX_CAP}': return 'CAP' if channel_label == '${PWM_MAIN_OR_AUX}': diff --git a/Tools/module_config/generate_params.py b/Tools/module_config/generate_params.py index d9018950c3..11d6d89251 100755 --- a/Tools/module_config/generate_params.py +++ b/Tools/module_config/generate_params.py @@ -59,9 +59,6 @@ def process_module_name(module_name): return module_name def process_param_prefix(param_prefix): - if param_prefix == '${PWM_MAIN_OR_HIL}': - if board == 'px4_sitl': return 'PWM_MAIN' - return 'HIL_ACT' if param_prefix == '${PWM_MAIN_OR_AUX}': if board_with_io: return 'PWM_AUX' return 'PWM_MAIN' @@ -70,9 +67,6 @@ def process_param_prefix(param_prefix): return param_prefix def process_channel_label(module_name, channel_label, no_prefix): - if channel_label == '${PWM_MAIN_OR_HIL}': - if board == 'px4_sitl': return 'PWM Sim' - return 'HIL actuator' if channel_label == '${PWM_MAIN_OR_AUX_CAP}': return 'PWM Capture' if channel_label == '${PWM_MAIN_OR_AUX}': diff --git a/src/drivers/pwm_out_sim/CMakeLists.txt b/src/drivers/pwm_out_sim/CMakeLists.txt index dcde17e2af..0eba6f7116 100644 --- a/src/drivers/pwm_out_sim/CMakeLists.txt +++ b/src/drivers/pwm_out_sim/CMakeLists.txt @@ -30,13 +30,20 @@ # POSSIBILITY OF SUCH DAMAGE. # ############################################################################ + +if (${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL} STREQUAL "px4_sitl") + set(module_config "module_sim.yaml") +else() + set(module_config "module_hil.yaml") +endif() + px4_add_module( MODULE drivers__pwm_out_sim MAIN pwm_out_sim SRCS PWMSim.cpp MODULE_CONFIG - module.yaml + ${module_config} DEPENDS mixer mixer_module diff --git a/src/drivers/pwm_out_sim/module.yaml b/src/drivers/pwm_out_sim/module.yaml deleted file mode 100644 index 947e977de2..0000000000 --- a/src/drivers/pwm_out_sim/module.yaml +++ /dev/null @@ -1,7 +0,0 @@ - -module_name: PWM Sim -actuator_output: - output_groups: - - param_prefix: ${PWM_MAIN_OR_HIL} - channel_label: ${PWM_MAIN_OR_HIL} - num_channels: 16 diff --git a/src/drivers/pwm_out_sim/module_hil.yaml b/src/drivers/pwm_out_sim/module_hil.yaml new file mode 100644 index 0000000000..25b9db39e0 --- /dev/null +++ b/src/drivers/pwm_out_sim/module_hil.yaml @@ -0,0 +1,8 @@ + +module_name: HIL +actuator_output: + show_subgroups_if: 'SYS_HITL>0' + output_groups: + - param_prefix: HIL_ACT + channel_label: Channel + num_channels: 16 diff --git a/src/drivers/pwm_out_sim/module_sim.yaml b/src/drivers/pwm_out_sim/module_sim.yaml new file mode 100644 index 0000000000..9964f0c419 --- /dev/null +++ b/src/drivers/pwm_out_sim/module_sim.yaml @@ -0,0 +1,7 @@ + +module_name: SIM +actuator_output: + output_groups: + - param_prefix: PWM_MAIN + channel_label: Channel + num_channels: 16 diff --git a/validation/module_schema.yaml b/validation/module_schema.yaml index 3457fdcff6..2cf2916a24 100644 --- a/validation/module_schema.yaml +++ b/validation/module_schema.yaml @@ -269,7 +269,7 @@ actuator_output: # parameter prefix for the min/max/disarmed/func params, e.g. PWM_MAIN. # This also needs to be specified in the source code. type: string - regex: '([0-9A-Z_]+|\$\{PWM_MAIN_OR_AUX\}|\$\{PWM_MAIN_OR_HIL\})' + regex: '([0-9A-Z_]+|\$\{PWM_MAIN_OR_AUX\})' required: true channel_label: # Human-readable per-channel label (index will be added), e.g. 'PWM Main'