Skip to content

Commit 10c0f20

Browse files
author
Teijo Kinnunen
committed
LoRaWAN: Terminate RX when receiving uplink messages
This prevents RX2 window to be enabled at the same time when repeating transmission, when QoS repeated TX is in effect. Failure to do so seems to place the LoRaWAN stack in a state where send() always fails with WOULD_BLOCK error.
1 parent 033fffe commit 10c0f20

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

features/lorawan/lorastack/mac/LoRaMac.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -738,6 +738,15 @@ void LoRaMac::on_radio_rx_done(const uint8_t *const payload, uint16_t size,
738738
break;
739739

740740
default:
741+
// This can happen e.g. if we happen to receive uplink of another device
742+
// during the receive window. Block RX2 window since it can overlap with
743+
// QOS TX and cause a mess.
744+
tr_debug("RX unexpected mtype %u", mac_hdr.bits.mtype);
745+
if (get_current_slot() == RX_SLOT_WIN_1) {
746+
_lora_time.stop(_params.timers.rx_window2_timer);
747+
}
748+
_mcps_indication.status = LORAMAC_EVENT_INFO_STATUS_ADDRESS_FAIL;
749+
_mcps_indication.pending = false;
741750
break;
742751
}
743752
}

0 commit comments

Comments
 (0)