Limit channel count effectively

This commit is contained in:
Lorenz Meier 2014-10-07 22:46:07 +02:00
parent 726b10651a
commit 8c6c08dcb5
1 changed files with 6 additions and 2 deletions

View File

@ -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;