1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 04:15:44 +03:00

Fixed bug in SUMD V3 channel number handling.

This commit is contained in:
mikeller 2019-03-22 09:36:46 +13:00 committed by Michael Keller
parent 8239950c7d
commit 32bcf606b5

View file

@ -112,8 +112,6 @@ static uint8_t sumdFrameStatus(rxRuntimeConfig_t *rxRuntimeConfig)
{
UNUSED(rxRuntimeConfig);
uint8_t channelIndex;
uint8_t frameStatus = RX_FRAME_PENDING;
if (!sumdFrameDone) {
@ -139,10 +137,9 @@ static uint8_t sumdFrameStatus(rxRuntimeConfig_t *rxRuntimeConfig)
return frameStatus;
}
if (sumdChannelCount > MAX_SUPPORTED_RC_CHANNEL_COUNT)
sumdChannelCount = MAX_SUPPORTED_RC_CHANNEL_COUNT;
unsigned channelsToProcess = MIN(sumdChannelCount, MAX_SUPPORTED_RC_CHANNEL_COUNT);
for (channelIndex = 0; channelIndex < sumdChannelCount; channelIndex++) {
for (unsigned channelIndex = 0; channelIndex < channelsToProcess; channelIndex++) {
sumdChannels[channelIndex] = (
(sumd[SUMD_BYTES_PER_CHANNEL * channelIndex + SUMD_OFFSET_CHANNEL_1_HIGH] << 8) |
sumd[SUMD_BYTES_PER_CHANNEL * channelIndex + SUMD_OFFSET_CHANNEL_1_LOW]