mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-02-05 19:01:00 +08:00
params: use PWM_MAIN_* instead of PWM_FMU_*
This commit is contained in:
@@ -31,6 +31,9 @@ parser.add_argument('--ethernet', action='store_true',
|
||||
help='Ethernet support')
|
||||
parser.add_argument('--board', type=str, action='store',
|
||||
help='board name, e.g. ')
|
||||
parser.add_argument('--board-with-io', dest='board_with_io', action='store_true',
|
||||
help='Indicate that the board as an IO for extra PWM',
|
||||
default=False)
|
||||
parser.add_argument('-v', '--verbose', dest='verbose', action='store_true',
|
||||
help='Verbose Output')
|
||||
|
||||
@@ -40,23 +43,30 @@ verbose = args.verbose
|
||||
params_output_file = args.params_file
|
||||
timer_config_file = args.timer_config
|
||||
ethernet_supported = args.ethernet
|
||||
board_with_io = args.board_with_io
|
||||
board = args.board
|
||||
|
||||
root_dir = os.path.join(os.path.dirname(os.path.realpath(__file__)),"../..")
|
||||
output_functions_file = os.path.join(root_dir,"src/lib/mixer_module/output_functions.yaml")
|
||||
|
||||
def process_param_prefix(param_prefix):
|
||||
if param_prefix == '${PWM_FMU_OR_HIL}':
|
||||
if board == 'px4_sitl': return 'PWM_FMU'
|
||||
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'
|
||||
if '${' in param_prefix:
|
||||
raise Exception('unhandled variable in {:}'.format(param_prefix))
|
||||
return param_prefix
|
||||
|
||||
def process_channel_label(channel_label):
|
||||
if channel_label == '${PWM_FMU_OR_HIL}':
|
||||
if channel_label == '${PWM_MAIN_OR_HIL}':
|
||||
if board == 'px4_sitl': return 'PWM Sim'
|
||||
return 'HIL actuator'
|
||||
if channel_label == '${PWM_MAIN_OR_AUX}':
|
||||
if board_with_io: return 'PWM Aux'
|
||||
return 'PWM Main'
|
||||
if '${' in channel_label:
|
||||
raise Exception('unhandled variable in {:}'.format(channel_label))
|
||||
return channel_label
|
||||
@@ -171,9 +181,8 @@ def get_actuator_output_params(yaml_config, output_functions,
|
||||
# We do this by extending the output_groups list and parse in a later iteration
|
||||
if 'generator' in group:
|
||||
if group['generator'] == 'pwm':
|
||||
# We might set these depending on presence of IO in build...
|
||||
param_prefix = process_param_prefix(group['param_prefix'])
|
||||
channel_labels = group['channel_labels']
|
||||
channel_labels = [process_channel_label(label) for label in group['channel_labels']]
|
||||
standard_params = group.get('standard_params', [])
|
||||
extra_function_groups = group.get('extra_function_groups', [])
|
||||
pwm_timer_param = group.get('pwm_timer_param', None)
|
||||
|
||||
Reference in New Issue
Block a user