@@ -267,11 +267,12 @@ typedef union uLoRaMacRadioEvents
267267 uint32_t Value ;
268268 struct sEvents
269269 {
270- uint32_t RxTimeout : 1 ;
271- uint32_t RxError : 1 ;
272- uint32_t TxTimeout : 1 ;
273- uint32_t RxDone : 1 ;
274- uint32_t TxDone : 1 ;
270+ uint32_t RxProcessPending : 1 ;
271+ uint32_t RxTimeout : 1 ;
272+ uint32_t RxError : 1 ;
273+ uint32_t TxTimeout : 1 ;
274+ uint32_t RxDone : 1 ;
275+ uint32_t TxDone : 1 ;
275276 }Events ;
276277}LoRaMacRadioEvents_t ;
277278
@@ -706,6 +707,7 @@ static void OnRadioRxDone( uint8_t *payload, uint16_t size, int16_t rssi, int8_t
706707 RxDoneParams .Snr = snr ;
707708
708709 LoRaMacRadioEvents .Events .RxDone = 1 ;
710+ LoRaMacRadioEvents .Events .RxProcessPending = 1 ;
709711
710712 if ( ( MacCtx .MacCallbacks != NULL ) && ( MacCtx .MacCallbacks -> MacProcessNotify != NULL ) )
711713 {
@@ -839,6 +841,8 @@ static void ProcessRadioRxDone( void )
839841 AddressIdentifier_t addrID = UNICAST_DEV_ADDR ;
840842 FCntIdentifier_t fCntID ;
841843
844+ LoRaMacRadioEvents .Events .RxProcessPending = 0 ;
845+
842846 MacCtx .McpsConfirm .AckReceived = false;
843847 MacCtx .McpsIndication .Rssi = rssi ;
844848 MacCtx .McpsIndication .Snr = snr ;
@@ -1382,6 +1386,11 @@ static void LoRaMacHandleIrqEvents( void )
13821386
13831387bool LoRaMacIsBusy ( void )
13841388{
1389+ if ( LoRaMacRadioEvents .Events .RxProcessPending == 1 )
1390+ {
1391+ return true;
1392+ }
1393+
13851394 if ( ( MacCtx .MacState == LORAMAC_IDLE ) &&
13861395 ( MacCtx .AllowRequests == LORAMAC_REQUEST_HANDLING_ON ) )
13871396 {
@@ -3409,6 +3418,9 @@ LoRaMacStatus_t LoRaMacInitialization( LoRaMacPrimitives_t* primitives, LoRaMacC
34093418 // Store the current initialization time
34103419 Nvm .MacGroup2 .InitializationTime = SysTimeGetMcuTime ( );
34113420
3421+ // Initialize MAC radio events
3422+ LoRaMacRadioEvents .Value = 0 ;
3423+
34123424 // Initialize Radio driver
34133425 MacCtx .RadioEvents .TxDone = OnRadioTxDone ;
34143426 MacCtx .RadioEvents .RxDone = OnRadioRxDone ;
0 commit comments