From cee09b665600e353168cf2be39f7e8fa6d595ee3 Mon Sep 17 00:00:00 2001 From: Hasnain Virk Date: Thu, 20 Sep 2018 14:54:54 +0300 Subject: [PATCH] Making sure that RX slots open after state change After transmission we should change the state before invoking opening of slots as we may start receiving in the rx slots and the state would suddenly change from SENDING to RECEIVING without going through the ACK_WAIT state (in case of CONFIRMED messages). Tests show that after this slight adjustment, our number of ack retries have significantly reduced. --- features/lorawan/LoRaWANStack.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/features/lorawan/LoRaWANStack.cpp b/features/lorawan/LoRaWANStack.cpp index a22267573c..764ac77052 100644 --- a/features/lorawan/LoRaWANStack.cpp +++ b/features/lorawan/LoRaWANStack.cpp @@ -576,7 +576,6 @@ void LoRaWANStack::process_transmission_timeout() void LoRaWANStack::process_transmission(void) { tr_debug("Transmission completed"); - _loramac.on_radio_tx_done(_tx_timestamp); if (_device_current_state == DEVICE_STATE_JOINING) { _device_current_state = DEVICE_STATE_AWAITING_JOIN_ACCEPT; @@ -588,6 +587,8 @@ void LoRaWANStack::process_transmission(void) _device_current_state = DEVICE_STATE_AWAITING_ACK; } } + + _loramac.on_radio_tx_done(_tx_timestamp); } void LoRaWANStack::post_process_tx_with_reception()