@@ -195,7 +195,7 @@ void fhss_set_txrx_slot_length(fhss_structure_t *fhss_structure)
195195 if (fhss_structure -> ws -> fhss_configuration .fhss_broadcast_interval == 0 || fhss_structure -> ws -> fhss_configuration .fhss_bc_dwell_interval == 0 ) {
196196 return ;
197197 }
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 ;
199199 if (fhss_structure -> callbacks .read_datarate ) {
200200 /* Calculate minimum TX slot length which can fit optimal packet length twice.
201201 * 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)
217217 if (datarate ) {
218218 txrx_slot_length_ms_tmp = ((fhss_structure -> optimal_packet_length * 2 ) * (8000000 / datarate )) / 1000 ;
219219 // 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 ;
223228 }
224229 }
225230 }
0 commit comments