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