Skip to content

Commit 07f4ca8

Browse files
author
Kimmo Vaisanen
committed
Lora: Fix TX_ERROR event if corrupted msg is received for CONFIRMED request
When node sends a CONFIRMED message and gateway sends ACK in RX1 window but the message gets corrupted during the transmission (e.g. MIC fails), currently our stack already checks for retransmission after RX1 and if retries attemps are exhausted, TX_ERROR event is sent to application. This is wrong as MAC layer will still attempt reception in RX2 window. This commit fixes the behaviour so that TX_ERROR is not sent until RX2 window has been closed.
1 parent 54f40a0 commit 07f4ca8

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

features/lorawan/LoRaWANStack.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,8 @@ void LoRaWANStack::process_reception(const uint8_t *const payload, uint16_t size
668668
_ctrl_flags &= ~TX_ONGOING_FLAG;
669669
state_controller(DEVICE_STATE_STATUS_CHECK);
670670
} else {
671-
if (!_loramac.continue_sending_process()) {
671+
if (!_loramac.continue_sending_process() &&
672+
_loramac.get_current_slot() != RX_SLOT_WIN_1) {
672673
tr_error("Retries exhausted for Class A device");
673674
_ctrl_flags &= ~TX_DONE_FLAG;
674675
_ctrl_flags |= TX_ONGOING_FLAG;

features/lorawan/lorastack/mac/LoRaMac.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,7 @@ bool LoRaMac::continue_sending_process()
780780
if (_params.ack_timeout_retry_counter > _params.max_ack_timeout_retries) {
781781
_mac_commands.clear_command_buffer();
782782
_params.adr_ack_counter++;
783+
_lora_time.stop(_params.timers.ack_timeout_timer);
783784
return false;
784785
}
785786

0 commit comments

Comments
 (0)