Skip to content

Commit

Permalink
Advance buffer
Browse files Browse the repository at this point in the history
  • Loading branch information
mmosca committed Jun 21, 2024
1 parent a564ac4 commit 978818b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/main/rx/crsf.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ STATIC_UNIT_TESTED uint8_t crsfFrameStatus(rxRuntimeConfig_t *rxRuntimeConfig)
int firstChannel = rcChannelsHeader->firstChannel;
switch(rcChannelsHeader->resolution) {
case CRSF_11_BIT:
for (int i = 0; i < channelCount;) {
for (int i = 0; i < channelCount; rcChannels11++) {
if(firstChannel + i < CRSF_MAX_CHANNEL)
crsfChannelData[firstChannel + i++] = rcChannels11->chan0;
if(firstChannel + i < CRSF_MAX_CHANNEL)
Expand All @@ -333,7 +333,7 @@ STATIC_UNIT_TESTED uint8_t crsfFrameStatus(rxRuntimeConfig_t *rxRuntimeConfig)
}
return RX_FRAME_COMPLETE;
case CRSF_12_BIT:
for (int i = 0; i < channelCount;) {
for (int i = 0; i < channelCount; rcChannels12++) {
if(firstChannel + i < CRSF_MAX_CHANNEL)
crsfChannelData[firstChannel + i++] = rcChannels12->chan0 >> 1; // Drop 1 bit to match 11 bit range
if(firstChannel + i < CRSF_MAX_CHANNEL)
Expand All @@ -342,7 +342,7 @@ STATIC_UNIT_TESTED uint8_t crsfFrameStatus(rxRuntimeConfig_t *rxRuntimeConfig)

return RX_FRAME_COMPLETE;
case CRSF_13_BIT:
for (int i = 0; i < channelCount;) {
for (int i = 0; i < channelCount; rcChannels13++) {
if(firstChannel + i < CRSF_MAX_CHANNEL)
crsfChannelData[firstChannel + i++] = rcChannels13->chan0 >> 2; // Drop 2 bits to match 11 bit range
if(firstChannel + i < CRSF_MAX_CHANNEL)
Expand Down

0 comments on commit 978818b

Please sign in to comment.