Skip to content

Commit

Permalink
increase timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
jaka87 committed Dec 9, 2020
1 parent f728e35 commit add9265
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/Ftp.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "Sim800.h"
#include "Result.h"


class FTP : public SIM800
{

Expand Down
10 changes: 5 additions & 5 deletions src/GPRS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ Result openGPRSContext(SIM800 *sim800, const char *apn)

sim800->sendATTest();

while ((sim800->sendCmdAndWaitForResp_P(REGISTRATION_STATUS, CONNECTED, 5000) != TRUE &&
sim800->sendCmdAndWaitForResp_P(REGISTRATION_STATUS, ROAMING, 5000) != TRUE) &&
while ((sim800->sendCmdAndWaitForResp_P(REGISTRATION_STATUS, CONNECTED, 10000) != TRUE &&
sim800->sendCmdAndWaitForResp_P(REGISTRATION_STATUS, ROAMING, 10000) != TRUE) &&
attempts < MAX_ATTEMPTS)
{
sim800->sendCmdAndWaitForResp_P(READ_VOLTAGE, AT_OK, 2000);
Expand All @@ -67,7 +67,7 @@ Result openGPRSContext(SIM800 *sim800, const char *apn)
}
}

if (sim800->sendCmdAndWaitForResp_P(BEARER_PROFILE_GPRS, AT_OK, 10000) == FALSE)
if (sim800->sendCmdAndWaitForResp_P(BEARER_PROFILE_GPRS, AT_OK, 12000) == FALSE)
result = ERROR_BEARER_PROFILE_GPRS;

char httpApn[64];
Expand All @@ -77,10 +77,10 @@ Result openGPRSContext(SIM800 *sim800, const char *apn)
if (sim800->sendCmdAndWaitForResp(httpApn, AT_OK_, 8000) == FALSE)
result = ERROR_BEARER_PROFILE_APN;

while (sim800->sendCmdAndWaitForResp_P(QUERY_BEARER, BEARER_OPEN, 6000) == FALSE && attempts < MAX_ATTEMPTS)
while (sim800->sendCmdAndWaitForResp_P(QUERY_BEARER, BEARER_OPEN, 8000) == FALSE && attempts < MAX_ATTEMPTS)
{
attempts++;
if (sim800->sendCmdAndWaitForResp_P(OPEN_GPRS_CONTEXT, AT_OK, 6000) == FALSE)
if (sim800->sendCmdAndWaitForResp_P(OPEN_GPRS_CONTEXT, AT_OK, 8000) == FALSE)
{
result = ERROR_OPEN_GPRS_CONTEXT;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Result HTTP::connect(const char *apn)
{
Result result = openGPRSContext(this, apn);

if (sendCmdAndWaitForResp_P(HTTP_INIT, AT_OK, 5000) == FALSE)
if (sendCmdAndWaitForResp_P(HTTP_INIT, AT_OK, 6000) == FALSE)
result = ERROR_HTTP_INIT;

return result;
Expand All @@ -65,7 +65,7 @@ Result HTTP::disconnect()
{
Result result = closeGPRSContext(this);

if (sendCmdAndWaitForResp_P(HTTP_CLOSE, AT_OK, 4000) == FALSE)
if (sendCmdAndWaitForResp_P(HTTP_CLOSE, AT_OK, 5000) == FALSE)
result = ERROR_HTTP_CLOSE;

return result;
Expand All @@ -83,7 +83,7 @@ Result HTTP::post(const char *uri, const char *body, char *response)
sprintf_P(buffer, HTTP_DATA, strlen(body), delayToDownload);
strcpy_P(resp, DOWNLOAD);

sendCmdAndWaitForResp(buffer, resp, 4000);
sendCmdAndWaitForResp(buffer, resp, 5000);

purgeSerial();
sendCmd(body);
Expand Down
2 changes: 1 addition & 1 deletion src/Sim800.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#define DEFAULT_TIMEOUT 5000

// Comment or uncomment this to debug the library
//#define DEBUG true
// #define DEBUG true

/** SIM800 class.
* Used for SIM800 communication. attention that SIM800 module communicate with MCU in serial protocol
Expand Down

0 comments on commit add9265

Please sign in to comment.