Skip to content

Commit 36a4c55

Browse files
author
Hasnain Virk
committed
[IOTCELL-1182] User TX priority over automatic uplinks
In the case when an automatic uplink was queued and the user do have something send, we should give priority to user data instead od automatic uplink message.
1 parent 8292aff commit 36a4c55

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

features/lorawan/LoRaWANStack.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -805,8 +805,12 @@ void LoRaWANStack::send_event_to_application(const lorawan_event_t event) const
805805

806806
void LoRaWANStack::send_automatic_uplink_message(const uint8_t port)
807807
{
808+
// we will silently ignore the automatic uplink event if the user is already
809+
// sending something
808810
const int16_t ret = handle_tx(port, NULL, 0, MSG_CONFIRMED_FLAG, true, true);
809-
if (ret < 0) {
811+
if (ret == LORAWAN_STATUS_WOULD_BLOCK) {
812+
_automatic_uplink_ongoing = false;
813+
} else if (ret < 0) {
810814
tr_debug("Failed to generate AUTOMATIC UPLINK, error code = %d", ret);
811815
send_event_to_application(AUTOMATIC_UPLINK_ERROR);
812816
}

0 commit comments

Comments
 (0)