@@ -83,7 +83,6 @@ static void fhss_event_timer_cb(int8_t timer_id, uint16_t slots);
8383static void fhss_ws_update_uc_channel_callback (fhss_structure_t * fhss_structure );
8484static void fhss_unicast_handler (const fhss_api_t * fhss_api , uint16_t delay );
8585static bool fhss_ws_check_tx_allowed (fhss_structure_t * fhss_structure );
86- static void fhss_set_txrx_slot_length (fhss_structure_t * fhss_structure );
8786
8887// This function supports rounding up
8988static int64_t divide_integer (int64_t dividend , int32_t divisor )
@@ -147,6 +146,7 @@ fhss_structure_t *fhss_ws_enable(fhss_api_t *fhss_api, const fhss_ws_configurati
147146 fhss_struct -> fhss_event_timer = eventOS_callback_timer_register (fhss_event_timer_cb );
148147 fhss_struct -> ws -> fhss_configuration = * fhss_configuration ;
149148 fhss_struct -> number_of_channels = channel_count ;
149+ fhss_struct -> optimal_packet_length = OPTIMAL_PACKET_LENGTH ;
150150 fhss_ws_set_hop_count (fhss_struct , 0xff );
151151 fhss_struct -> rx_channel = fhss_configuration -> unicast_fixed_channel ;
152152 fhss_struct -> ws -> min_synch_interval = DEFAULT_MIN_SYNCH_INTERVAL ;
@@ -172,7 +172,7 @@ static int fhss_ws_manage_channel_table_allocation(fhss_structure_t *fhss_struct
172172 return 0 ;
173173}
174174
175- static void fhss_set_txrx_slot_length (fhss_structure_t * fhss_structure )
175+ void fhss_set_txrx_slot_length (fhss_structure_t * fhss_structure )
176176{
177177 // No broadcast schedule, no TX slots
178178 if (fhss_structure -> ws -> fhss_configuration .fhss_broadcast_interval == 0 || fhss_structure -> ws -> fhss_configuration .fhss_bc_dwell_interval == 0 ) {
@@ -198,7 +198,7 @@ static void fhss_set_txrx_slot_length(fhss_structure_t *fhss_structure)
198198 */
199199 uint32_t datarate = fhss_structure -> callbacks .read_datarate (fhss_structure -> fhss_api );
200200 if (datarate ) {
201- txrx_slot_length_ms_tmp = ((OPTIMAL_PACKET_LENGTH * 2 ) * (8000000 / datarate )) / 1000 ;
201+ txrx_slot_length_ms_tmp = ((fhss_structure -> optimal_packet_length * 2 ) * (8000000 / datarate )) / 1000 ;
202202 // Do not allow using too high TX slot length.
203203 if (txrx_slot_length_ms_tmp > WS_TXRX_SLOT_LEN_MS ) {
204204 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 );
0 commit comments