Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix _Cellular_AtcmdDataSend interDelayMS #155

Merged
merged 3 commits into from
Oct 23, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions source/cellular_pkthandler.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,7 @@ static CellularPktStatus_t _Cellular_AtcmdRequestTimeoutWithCallbackRaw( Cellula
uint32_t timeoutMS );
static CellularPktStatus_t _Cellular_DataSendWithTimeoutDelayRaw( CellularContext_t * pContext,
CellularAtDataReq_t dataReq,
uint32_t timeoutMs,
uint32_t interDelayMS );
uint32_t timeoutMs );
static void _Cellular_PktHandlerAcquirePktRequestMutex( CellularContext_t * pContext );
static void _Cellular_PktHandlerReleasePktRequestMutex( CellularContext_t * pContext );
static int _searchCompareFunc( const void * pInputToken,
Expand Down Expand Up @@ -267,8 +266,7 @@ static CellularPktStatus_t _Cellular_AtcmdRequestTimeoutWithCallbackRaw( Cellula

static CellularPktStatus_t _Cellular_DataSendWithTimeoutDelayRaw( CellularContext_t * pContext,
CellularAtDataReq_t dataReq,
uint32_t timeoutMs,
uint32_t interDelayMS )
uint32_t timeoutMs )
{
CellularPktStatus_t respCode = CELLULAR_PKT_STATUS_OK;
CellularPktStatus_t pktStatus = CELLULAR_PKT_STATUS_OK;
Expand Down Expand Up @@ -299,9 +297,6 @@ static CellularPktStatus_t _Cellular_DataSendWithTimeoutDelayRaw( CellularContex
}
}

/* Some driver required wait for a minimum of delay before sending data. */
Platform_Delay( interDelayMS );

/* End pattern for specific modem. */
if( ( pktStatus == CELLULAR_PKT_STATUS_OK ) && ( dataReq.pEndPattern != NULL ) )
{
Expand Down Expand Up @@ -706,7 +701,13 @@ CellularPktStatus_t _Cellular_AtcmdDataSend( CellularContext_t * pContext,

if( pktStatus == CELLULAR_PKT_STATUS_OK )
{
pktStatus = _Cellular_DataSendWithTimeoutDelayRaw( pContext, dataReq, dataTimeoutMS, interDelayMS );
if( interDelayMS > 0U )
{
/* Cellular modem may require a minimum delay before sending data. */
Platform_Delay( interDelayMS );
}

pktStatus = _Cellular_DataSendWithTimeoutDelayRaw( pContext, dataReq, dataTimeoutMS );
}

_Cellular_PktHandlerReleasePktRequestMutex( pContext );
Expand Down Expand Up @@ -763,7 +764,7 @@ CellularPktStatus_t _Cellular_TimeoutAtcmdDataSendSuccessToken( CellularContext_

if( pktStatus == CELLULAR_PKT_STATUS_OK )
{
pktStatus = _Cellular_DataSendWithTimeoutDelayRaw( pContext, dataReq, dataTimeoutMS, 0U );
pktStatus = _Cellular_DataSendWithTimeoutDelayRaw( pContext, dataReq, dataTimeoutMS );
}

_Cellular_PktHandlerReleasePktRequestMutex( pContext );
Expand Down