Skip to content

Commit

Permalink
Merge pull request #30 from qba667/master
Browse files Browse the repository at this point in the history
Fix for latest AFHDS 2a and AFHDS 3 receivers.
  • Loading branch information
Cleric-K committed Sep 3, 2019
2 parents 6b028b6 + 96ade8c commit 9ffb202
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions vJoySerialFeeder/SerialProtocols/IbusReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,15 @@ public int ReadChannelsStandard()
data_end = data_start + data_len;
data_start++; // skip command byte
int ch = 0;
while(data_start+1 < data_end)
channelData[ch++] = (Buffer[data_start++] | (Buffer[data_start++] << 8));

int index = data_start;
while (index + 1 < data_end)
channelData[ch++] = (Buffer[index++] | ((Buffer[index++] & 0x0F) << 8));
//see https://github.com/betaflight/betaflight/pull/8749
index = data_start + 1;
while (index + 1 < data_end) {
channelData[ch++] = ((Buffer[index] & 0xF0) >> 4) | (Buffer[index + 2] & 0xF0) | ((Buffer[index + 4] & 0xF0) << 4);
index += 6;
}
Buffer.Slide(idx);

return ch;
Expand Down

0 comments on commit 9ffb202

Please sign in to comment.