Skip to content

Commit

Permalink
generate_params.py: add PWM_AUX_* for boards w/o IO and >8 channels
Browse files Browse the repository at this point in the history
  • Loading branch information
bkueng authored and dagar committed Nov 22, 2021
1 parent c73028b commit 7faaad7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions Tools/module_config/generate_params.py
Expand Up @@ -6,6 +6,7 @@
import argparse
import os
import sys
from copy import deepcopy

from output_groups_from_timer_config import get_timer_groups, get_output_groups

Expand Down Expand Up @@ -197,6 +198,21 @@ def add_local_param(param_name, param_def):
verbose=verbose)
all_params.update(timer_params)
output_groups.extend(timer_output_groups)

# In case of a board w/o IO and >8 PWM channels, pwm_out splits
# into 2 instances (if SYS_CTRL_ALLOC==0) and we need to add the
# PWM_AUX min/max/disarmed params as well.
num_channels = len(timer_groups['types'])
if not board_with_io and num_channels > 8:
output_groups.append(
{
'param_prefix': 'PWM_AUX',
'channel_label': 'PWM AUX',
'instance_start': 1,
'num_channels': num_channels - 8,
'standard_params': deepcopy(timer_output_groups[0]['standard_params'])
})

else:
raise Exception('unknown generator {:}'.format(group['generator']))
continue
Expand Down

4 comments on commit 7faaad7

@taileron
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pwm outs above 8 now work perfectly on the corresponding boards with all parameters expect pwm_aux_out is always set to "1234" and does not allow for any change

@bkueng
Copy link
Member Author

@bkueng bkueng commented on 7faaad7 Nov 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@taileron which airframe do you use? Some of them override the setting, and it's also set for fixed-wing or multirotor in general (ROMFS/px4fmu_common/init.d/rc.fw_defaults).

@taileron
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bkueng used octo x, (+extra loaded mount.aux.mix) takes rc.mc_defaults which uses that default as well. I thought, however, that these defaults only apply during set-up and could be changed later.
The same PWM frequency is always output as at the main, even if something else was specified in the aux_rate parameter. Of course, this could be due to the fact that some identical io timers are used for both.

@bkueng
Copy link
Member Author

@bkueng bkueng commented on 7faaad7 Nov 25, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes that was surely the intention but the logic around that is a bit convoluted. All of this will become simpler with dynamic control allocation (SYS_CTRL_ALLOC param, mavlink/qgroundcontrol#9952). You're welcome to test it.

Please sign in to comment.