Skip to content

Commit 4680a7b

Browse files
committed
timeout for bad weather
1 parent add9265 commit 4680a7b

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

src/GPRS.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ Result openGPRSContext(SIM800 *sim800, const char *apn)
5252

5353
sim800->sendATTest();
5454

55-
while ((sim800->sendCmdAndWaitForResp_P(REGISTRATION_STATUS, CONNECTED, 10000) != TRUE &&
56-
sim800->sendCmdAndWaitForResp_P(REGISTRATION_STATUS, ROAMING, 10000) != TRUE) &&
55+
while ((sim800->sendCmdAndWaitForResp_P(REGISTRATION_STATUS, CONNECTED, 12000) != TRUE &&
56+
sim800->sendCmdAndWaitForResp_P(REGISTRATION_STATUS, ROAMING, 12000) != TRUE) &&
5757
attempts < MAX_ATTEMPTS)
5858
{
5959
sim800->sendCmdAndWaitForResp_P(READ_VOLTAGE, AT_OK, 2000);
@@ -67,20 +67,20 @@ Result openGPRSContext(SIM800 *sim800, const char *apn)
6767
}
6868
}
6969

70-
if (sim800->sendCmdAndWaitForResp_P(BEARER_PROFILE_GPRS, AT_OK, 12000) == FALSE)
70+
if (sim800->sendCmdAndWaitForResp_P(BEARER_PROFILE_GPRS, AT_OK, 14000) == FALSE)
7171
result = ERROR_BEARER_PROFILE_GPRS;
7272

7373
char httpApn[64];
7474
char tmp[24];
7575
strcpy_P(tmp, apn);
7676
sprintf_P(httpApn, BEARER_PROFILE_APN, tmp);
77-
if (sim800->sendCmdAndWaitForResp(httpApn, AT_OK_, 8000) == FALSE)
77+
if (sim800->sendCmdAndWaitForResp(httpApn, AT_OK_, 10000) == FALSE)
7878
result = ERROR_BEARER_PROFILE_APN;
7979

80-
while (sim800->sendCmdAndWaitForResp_P(QUERY_BEARER, BEARER_OPEN, 8000) == FALSE && attempts < MAX_ATTEMPTS)
80+
while (sim800->sendCmdAndWaitForResp_P(QUERY_BEARER, BEARER_OPEN, 10000) == FALSE && attempts < MAX_ATTEMPTS)
8181
{
8282
attempts++;
83-
if (sim800->sendCmdAndWaitForResp_P(OPEN_GPRS_CONTEXT, AT_OK, 8000) == FALSE)
83+
if (sim800->sendCmdAndWaitForResp_P(OPEN_GPRS_CONTEXT, AT_OK, 10000) == FALSE)
8484
{
8585
result = ERROR_OPEN_GPRS_CONTEXT;
8686
}

src/Http.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Result HTTP::connect(const char *apn)
5555
{
5656
Result result = openGPRSContext(this, apn);
5757

58-
if (sendCmdAndWaitForResp_P(HTTP_INIT, AT_OK, 6000) == FALSE)
58+
if (sendCmdAndWaitForResp_P(HTTP_INIT, AT_OK, 8000) == FALSE)
5959
result = ERROR_HTTP_INIT;
6060

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

86-
sendCmdAndWaitForResp(buffer, resp, 5000);
86+
sendCmdAndWaitForResp(buffer, resp, 7000);
8787

8888
purgeSerial();
8989
sendCmd(body);
@@ -108,7 +108,7 @@ Result HTTP::get(const char *uri, char *response)
108108
Result result;
109109
setHTTPSession(uri);
110110

111-
if (sendCmdAndWaitForResp_P(HTTP_GET, HTTP_2XX, 2000) == TRUE)
111+
if (sendCmdAndWaitForResp_P(HTTP_GET, HTTP_2XX, 7000) == TRUE)
112112
{
113113
char buffer[16];
114114
strcpy_P(buffer, HTTP_READ);

0 commit comments

Comments
 (0)