@@ -195,7 +195,7 @@ void fhss_set_txrx_slot_length(fhss_structure_t *fhss_structure)
195
195
if (fhss_structure -> ws -> fhss_configuration .fhss_broadcast_interval == 0 || fhss_structure -> ws -> fhss_configuration .fhss_bc_dwell_interval == 0 ) {
196
196
return ;
197
197
}
198
- uint32_t txrx_slot_length_ms_tmp = WS_TXRX_SLOT_LEN_MS ;
198
+ uint32_t txrx_slot_length_ms_tmp = WS_TXRX_SLOT_LEN_MS_MAX ;
199
199
if (fhss_structure -> callbacks .read_datarate ) {
200
200
/* Calculate minimum TX slot length which can fit optimal packet length twice.
201
201
* Twice, because 0, 1, 4, 5... hop starts transmission at the beginning of TX slot and 2, 3, 6, 7... hop at the middle of TX slot
@@ -217,9 +217,14 @@ void fhss_set_txrx_slot_length(fhss_structure_t *fhss_structure)
217
217
if (datarate ) {
218
218
txrx_slot_length_ms_tmp = ((fhss_structure -> optimal_packet_length * 2 ) * (8000000 / datarate )) / 1000 ;
219
219
// Do not allow using too high TX slot length.
220
- if (txrx_slot_length_ms_tmp > WS_TXRX_SLOT_LEN_MS ) {
221
- tr_debug ("TX slot length setting too high %" PRIu32 "ms, using %" PRIu32 "ms" , txrx_slot_length_ms_tmp , (uint32_t )WS_TXRX_SLOT_LEN_MS );
222
- txrx_slot_length_ms_tmp = WS_TXRX_SLOT_LEN_MS ;
220
+ if (txrx_slot_length_ms_tmp > WS_TXRX_SLOT_LEN_MS_MAX ) {
221
+ tr_debug ("TX slot length setting too high %" PRIu32 "ms, using %" PRIu32 "ms" , txrx_slot_length_ms_tmp , (uint32_t )WS_TXRX_SLOT_LEN_MS_MAX );
222
+ txrx_slot_length_ms_tmp = WS_TXRX_SLOT_LEN_MS_MAX ;
223
+ }
224
+ // Do not allow using too low TX slot length.
225
+ if (txrx_slot_length_ms_tmp < WS_TXRX_SLOT_LEN_MS_MIN ) {
226
+ tr_debug ("TX slot length setting too low %" PRIu32 "ms, using %" PRIu32 "ms" , txrx_slot_length_ms_tmp , (uint32_t )WS_TXRX_SLOT_LEN_MS_MIN );
227
+ txrx_slot_length_ms_tmp = WS_TXRX_SLOT_LEN_MS_MIN ;
223
228
}
224
229
}
225
230
}
0 commit comments