Skip to content

Commit edff6ce

Browse files
Daniel Jaecklemluis1
authored andcommitted
Issue #1144 - Refactored stack FramePending variable handling and renamed FramePending to IsUplinkTxPending.
1 parent 15ff602 commit edff6ce

File tree

3 files changed

+10
-5
lines changed

3 files changed

+10
-5
lines changed

src/apps/LoRaMac/common/LmHandler/LmHandler.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -745,8 +745,7 @@ static void McpsIndication( McpsIndication_t *mcpsIndication )
745745
// Call packages RxProcess function
746746
LmHandlerPackagesNotify( PACKAGE_MCPS_INDICATION, mcpsIndication );
747747

748-
if( ( ( mcpsIndication->FramePending != 0 ) && ( LmHandlerGetCurrentClass( ) == CLASS_A ) ) ||
749-
( mcpsIndication->ResponseTimeout > 0 ) )
748+
if( mcpsIndication->IsUplinkTxPending != 0 )
750749
{
751750
// The server signals that it has pending data to be sent.
752751
// We schedule an uplink as soon as possible to flush the server.

src/mac/LoRaMac.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -914,7 +914,7 @@ static void ProcessRadioRxDone( void )
914914
MacCtx.McpsIndication.RxSlot = MacCtx.RxSlot;
915915
MacCtx.McpsIndication.Port = 0;
916916
MacCtx.McpsIndication.Multicast = 0;
917-
MacCtx.McpsIndication.FramePending = 0;
917+
MacCtx.McpsIndication.IsUplinkTxPending = 0;
918918
MacCtx.McpsIndication.Buffer = NULL;
919919
MacCtx.McpsIndication.BufferSize = 0;
920920
MacCtx.McpsIndication.RxData = false;
@@ -1203,7 +1203,6 @@ static void ProcessRadioRxDone( void )
12031203

12041204
MacCtx.McpsIndication.Status = LORAMAC_EVENT_INFO_STATUS_OK;
12051205
MacCtx.McpsIndication.Multicast = multicast;
1206-
MacCtx.McpsIndication.FramePending = macMsgData.FHDR.FCtrl.Bits.FPending;
12071206
MacCtx.McpsIndication.Buffer = NULL;
12081207
MacCtx.McpsIndication.BufferSize = 0;
12091208
MacCtx.McpsIndication.DownLinkCounter = downLinkCounter;
@@ -1252,6 +1251,13 @@ static void ProcessRadioRxDone( void )
12521251
}
12531252
}
12541253

1254+
// Set the pending status
1255+
if( ( ( ( Nvm.MacGroup1.SrvAckRequested == true ) || ( macMsgData.FHDR.FCtrl.Bits.FPending > 0 ) ) && ( Nvm.MacGroup2.DeviceClass == CLASS_A ) ) ||
1256+
( MacCtx.McpsIndication.ResponseTimeout > 0 ) )
1257+
{
1258+
MacCtx.McpsIndication.IsUplinkTxPending = 1;
1259+
}
1260+
12551261
RemoveMacCommands( MacCtx.McpsIndication.RxSlot, macMsgData.FHDR.FCtrl, MacCtx.McpsConfirm.McpsRequest );
12561262

12571263
switch( fType )

src/mac/LoRaMac.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1003,7 +1003,7 @@ typedef struct sMcpsIndication
10031003
/*!
10041004
* Frame pending status
10051005
*/
1006-
uint8_t FramePending;
1006+
uint8_t IsUplinkTxPending;
10071007
/*!
10081008
* Pointer to the received data stream
10091009
*/

0 commit comments

Comments
 (0)