Fix isGprsConnected, gprsDisconnect

This commit is contained in:
Volodymyr Shymanskyy
2017-09-28 02:11:52 +03:00
parent f7983673da
commit 77c5109f9e

View File

@@ -398,16 +398,17 @@ public:
bool gprsDisconnect() {
sendAT(GF("+CIPSHUT"));
if (waitResponse(60000L) != 1)
return false;
waitResponse(5000L);
for (int i = 0; i<3; i++) {
sendAT(GF("+CGATT=0"));
if (waitResponse(60000L) != 1)
return false;
if (waitResponse(5000L) == 1)
return true;
}
return false;
}
bool isGprsConnected() {
sendAT(GF("+CGATT?"));
if (waitResponse(GF(GSM_NL "+CGATT:")) != 1) {
@@ -415,14 +416,7 @@ public:
}
int res = stream.readStringUntil('\n').toInt();
waitResponse();
if (res != 1)
return false;
sendAT(GF("+CIFSR")); // TODO: check this
if (waitResponse() != 1)
return false;
return true;
return (res == 1);
}
String getLocalIP() {