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

Merge pull request #7853 from mikeller/fix_sumd_v3

Fixed bug in SUMD V3 channel number handling.
This commit is contained in:
Michael Keller 2019-03-24 10:44:39 +13:00 committed by GitHub
commit ae5c924c96
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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