Skip to content

Commit

Permalink
[stm32] spektrum: always decode up to 12 channels
Browse files Browse the repository at this point in the history
but only copy RADIO_CONTROL_NB_CHANNEL to radio_control.values
  • Loading branch information
flixr committed Nov 28, 2014
1 parent f38c5db commit 7ae4ab3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
Expand Up @@ -446,7 +446,7 @@ void RadioControlEventImp(void (*frame_handler)(void)) {
case(0) : /* 10 bit */
ChannelNum = (ChannelData >> 10) & 0x0f;
/* don't bother decoding unused channels */
if (ChannelNum < RADIO_CONTROL_NB_CHANNEL) {
if (ChannelNum < SPEKTRUM_NB_CHANNEL) {
SpektrumBuf[ChannelNum] = ChannelData & 0x3ff;
SpektrumBuf[ChannelNum] -= 0x200;
SpektrumBuf[ChannelNum] *= MAX_PPRZ/0x156;
Expand All @@ -457,7 +457,7 @@ void RadioControlEventImp(void (*frame_handler)(void)) {
case(1) : /* 11 bit */
ChannelNum = (ChannelData >> 11) & 0x0f;
/* don't bother decoding unused channels */
if (ChannelNum < RADIO_CONTROL_NB_CHANNEL) {
if (ChannelNum < SPEKTRUM_NB_CHANNEL) {
SpektrumBuf[ChannelNum] = ChannelData & 0x7ff;
SpektrumBuf[ChannelNum] -= 0x400;
SpektrumBuf[ChannelNum] *= MAX_PPRZ/0x2AC;
Expand Down
Expand Up @@ -29,6 +29,7 @@
* have the same channel assignments.
*/

#define SPEKTRUM_NB_CHANNEL 12

#ifndef RADIO_CONTROL_NB_CHANNEL
#define RADIO_CONTROL_NB_CHANNEL 12
Expand Down

0 comments on commit 7ae4ab3

Please sign in to comment.