Limit aux channel servo forwarding by max_aux_channels setting

No reason process forwarding for channels that aren't going to be active from the RX.
This commit is contained in:
Bruce Luckcuck 2018-11-10 13:54:46 -05:00
parent b58e8f827f
commit 003e89d747
1 changed files with 2 additions and 1 deletions

View File

@ -300,7 +300,8 @@ STATIC_UNIT_TESTED void forwardAuxChannelsToServos(uint8_t firstServoIndex)
{
// start forwarding from this channel
int channelOffset = servoConfig()->channelForwardingStartChannel;
for (int servoOffset = 0; servoOffset < MAX_AUX_CHANNEL_COUNT && channelOffset < MAX_SUPPORTED_RC_CHANNEL_COUNT; servoOffset++) {
const int maxAuxChannelCount = MIN(MAX_AUX_CHANNEL_COUNT, rxConfig()->max_aux_channel);
for (int servoOffset = 0; servoOffset < maxAuxChannelCount && channelOffset < MAX_SUPPORTED_RC_CHANNEL_COUNT; servoOffset++) {
pwmWriteServo(firstServoIndex + servoOffset, rcData[channelOffset++]);
}
}