Skip to content

Commit eab2bad

Browse files
author
Hasnain Virk
committed
Queuing the automatic uplink
If the automatic uplink is sent directly the call-stack becomes larger than 1K which may cause serious problems in debug builds. Just to have a respite between RX and TX we queue an event for the automatic uplink rather than directly undergoing an automatic uplink.
1 parent 828815c commit eab2bad

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

features/lorawan/LoRaWANStack.cpp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -854,9 +854,11 @@ void LoRaWANStack::mlme_indication_handler()
854854
#if MBED_CONF_LORA_AUTOMATIC_UPLINK_MESSAGE
855855
_automatic_uplink_ongoing = true;
856856
tr_debug("mlme indication: sending empty uplink to port 0 to acknowledge MAC commands...");
857-
send_automatic_uplink_message(0);
857+
const uint8_t port = 0;
858+
const int ret = _queue->call(this, &LoRaWANStack::send_automatic_uplink_message, port);
859+
MBED_ASSERT(ret != 0);
860+
(void)ret;
858861
#else
859-
860862
send_event_to_application(UPLINK_REQUIRED);
861863
#endif
862864
return;
@@ -984,7 +986,9 @@ void LoRaWANStack::mcps_indication_handler()
984986
#if (MBED_CONF_LORA_AUTOMATIC_UPLINK_MESSAGE)
985987
tr_debug("Sending empty uplink message...");
986988
_automatic_uplink_ongoing = true;
987-
send_automatic_uplink_message(mcps_indication->port);
989+
const int ret = _queue->call(this, &LoRaWANStack::send_automatic_uplink_message, mcps_indication->port);
990+
MBED_ASSERT(ret != 0);
991+
(void)ret;
988992
#else
989993
send_event_to_application(UPLINK_REQUIRED);
990994
#endif

0 commit comments

Comments
 (0)