diff options
author | Lorenz Meier <lm@inf.ethz.ch> | 2014-10-07 22:46:07 +0200 |
---|---|---|
committer | Lorenz Meier <lm@inf.ethz.ch> | 2014-10-07 22:46:07 +0200 |
commit | 8c6c08dcb5ce87e613cbf867571f219a60e1b813 (patch) | |
tree | 0de1ec6a1d8ae9615da1a71ff718a3df6334d897 /src | |
parent | 726b10651aa38f1b542e6f3845da9aaf58af72a2 (diff) | |
download | px4-firmware-8c6c08dcb5ce87e613cbf867571f219a60e1b813.tar.gz px4-firmware-8c6c08dcb5ce87e613cbf867571f219a60e1b813.tar.bz2 px4-firmware-8c6c08dcb5ce87e613cbf867571f219a60e1b813.zip |
Limit channel count effectively
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/rc/st24.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/lib/rc/st24.c b/src/lib/rc/st24.c index 2b2178f97..e8a791b8f 100644 --- a/src/lib/rc/st24.c +++ b/src/lib/rc/st24.c @@ -176,7 +176,9 @@ int st24_decode(uint8_t byte, uint8_t *rssi, uint8_t *rx_count, uint16_t *channe *rssi = d->rssi; *rx_count = d->packet_count; - *channel_count = 12; + + /* this can lead to rounding of the strides */ + *channel_count = (max_chan_count < 12) ? max_chan_count : 12; unsigned stride_count = (*channel_count * 3) / 2; unsigned chan_index = 0; @@ -202,7 +204,9 @@ int st24_decode(uint8_t byte, uint8_t *rssi, uint8_t *rx_count, uint16_t *channe *rssi = d->rssi; *rx_count = d->packet_count; - *channel_count = 24; + + /* this can lead to rounding of the strides */ + *channel_count = (max_chan_count < 24) ? max_chan_count : 24; unsigned stride_count = (*channel_count * 3) / 2; unsigned chan_index = 0; |