pwm_out_sim: split module.yaml into HIL+SIM files

This commit is contained in:
Beat Küng 2021-11-08 11:25:03 +01:00 committed by Daniel Agar
parent b94c5db55d
commit 357a16aca6
7 changed files with 24 additions and 20 deletions

View File

@ -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}':

View File

@ -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}':

View File

@ -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

View File

@ -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

View File

@ -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

View File

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

View File

@ -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'