Skip to content

Commit

Permalink
Issue #1144 - Refactored stack FramePending variable handling and ren…
Browse files Browse the repository at this point in the history
…amed FramePending to IsUplinkTxPending.
  • Loading branch information
Daniel Jaeckle authored and mluis1 committed Dec 14, 2021
1 parent 15ff602 commit edff6ce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
3 changes: 1 addition & 2 deletions src/apps/LoRaMac/common/LmHandler/LmHandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,8 +745,7 @@ static void McpsIndication( McpsIndication_t *mcpsIndication )
// Call packages RxProcess function
LmHandlerPackagesNotify( PACKAGE_MCPS_INDICATION, mcpsIndication );

if( ( ( mcpsIndication->FramePending != 0 ) && ( LmHandlerGetCurrentClass( ) == CLASS_A ) ) ||
( mcpsIndication->ResponseTimeout > 0 ) )
if( mcpsIndication->IsUplinkTxPending != 0 )
{
// The server signals that it has pending data to be sent.
// We schedule an uplink as soon as possible to flush the server.
Expand Down
10 changes: 8 additions & 2 deletions src/mac/LoRaMac.c
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ static void ProcessRadioRxDone( void )
MacCtx.McpsIndication.RxSlot = MacCtx.RxSlot;
MacCtx.McpsIndication.Port = 0;
MacCtx.McpsIndication.Multicast = 0;
MacCtx.McpsIndication.FramePending = 0;
MacCtx.McpsIndication.IsUplinkTxPending = 0;
MacCtx.McpsIndication.Buffer = NULL;
MacCtx.McpsIndication.BufferSize = 0;
MacCtx.McpsIndication.RxData = false;
Expand Down Expand Up @@ -1203,7 +1203,6 @@ static void ProcessRadioRxDone( void )

MacCtx.McpsIndication.Status = LORAMAC_EVENT_INFO_STATUS_OK;
MacCtx.McpsIndication.Multicast = multicast;
MacCtx.McpsIndication.FramePending = macMsgData.FHDR.FCtrl.Bits.FPending;
MacCtx.McpsIndication.Buffer = NULL;
MacCtx.McpsIndication.BufferSize = 0;
MacCtx.McpsIndication.DownLinkCounter = downLinkCounter;
Expand Down Expand Up @@ -1252,6 +1251,13 @@ static void ProcessRadioRxDone( void )
}
}

// Set the pending status
if( ( ( ( Nvm.MacGroup1.SrvAckRequested == true ) || ( macMsgData.FHDR.FCtrl.Bits.FPending > 0 ) ) && ( Nvm.MacGroup2.DeviceClass == CLASS_A ) ) ||
( MacCtx.McpsIndication.ResponseTimeout > 0 ) )
{
MacCtx.McpsIndication.IsUplinkTxPending = 1;
}

RemoveMacCommands( MacCtx.McpsIndication.RxSlot, macMsgData.FHDR.FCtrl, MacCtx.McpsConfirm.McpsRequest );

switch( fType )
Expand Down
2 changes: 1 addition & 1 deletion src/mac/LoRaMac.h
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ typedef struct sMcpsIndication
/*!
* Frame pending status
*/
uint8_t FramePending;
uint8_t IsUplinkTxPending;
/*!
* Pointer to the received data stream
*/
Expand Down

1 comment on commit edff6ce

@sborshch
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like IsUplinkTxPending should have type bool and assigned values "true" and "false" instead of uint8_t, "1" and "0" respectively.

Please sign in to comment.