BugID:16959715: fix the problem of LoRaMac Command not flush immediately
@@ -84,10 +84,12 @@ static bool send_frame(void)
if (LoRaMacQueryTxPossible(tx_data.BuffSize, &txInfo) !=
LORAMAC_STATUS_OK) {
-
- return true;
- }
-
+ // Send empty frame in order to flush MAC commands
+ mcpsReq.Type = MCPS_UNCONFIRMED;
+ mcpsReq.Req.Unconfirmed.fBuffer = NULL;
+ mcpsReq.Req.Unconfirmed.fBufferSize = 0;
+ mcpsReq.Req.Unconfirmed.Datarate = lora_param.TxDatarate;
+ } else {
if (is_tx_confirmed == 0) {
mcpsReq.Type = MCPS_UNCONFIRMED;
mcpsReq.Req.Unconfirmed.fPort = tx_data.Port;
@@ -102,6 +104,7 @@ static bool send_frame(void)
mcpsReq.Req.Confirmed.NbTrials = num_trials;
mcpsReq.Req.Confirmed.Datarate = lora_param.TxDatarate;
}
+ }
if (LoRaMacMcpsRequest(&mcpsReq) == LORAMAC_STATUS_OK) {
return false;
