Browse Source

pwm_out_sim: split module.yaml into HIL+SIM files

master
Beat Küng 3 years ago committed by Daniel Agar
parent
commit
357a16aca6
  1. 5
      Tools/module_config/generate_actuators_metadata.py
  2. 6
      Tools/module_config/generate_params.py
  3. 9
      src/drivers/pwm_out_sim/CMakeLists.txt
  4. 7
      src/drivers/pwm_out_sim/module.yaml
  5. 8
      src/drivers/pwm_out_sim/module_hil.yaml
  6. 7
      src/drivers/pwm_out_sim/module_sim.yaml
  7. 2
      validation/module_schema.yaml

5
Tools/module_config/generate_actuators_metadata.py

@ -105,9 +105,6 @@ def process_module_name(module_name): @@ -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): @@ -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}':

6
Tools/module_config/generate_params.py

@ -59,9 +59,6 @@ def process_module_name(module_name): @@ -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): @@ -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}':

9
src/drivers/pwm_out_sim/CMakeLists.txt

@ -30,13 +30,20 @@ @@ -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

7
src/drivers/pwm_out_sim/module.yaml

@ -1,7 +0,0 @@ @@ -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

8
src/drivers/pwm_out_sim/module_hil.yaml

@ -0,0 +1,8 @@ @@ -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

7
src/drivers/pwm_out_sim/module_sim.yaml

@ -0,0 +1,7 @@ @@ -0,0 +1,7 @@
module_name: SIM
actuator_output:
output_groups:
- param_prefix: PWM_MAIN
channel_label: Channel
num_channels: 16

2
validation/module_schema.yaml

@ -269,7 +269,7 @@ actuator_output: @@ -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'

Loading…
Cancel
Save