(Hopefully) better wait for close on SARA R410

This commit is contained in:
Sara Damiano
2019-05-08 13:08:40 -04:00
parent 3ecce8641e
commit 43cd516d1f
4 changed files with 13 additions and 15 deletions

View File

@@ -668,7 +668,7 @@ protected:
streamSkipUntil(','); // Skip total received
streamSkipUntil(','); // Skip have read
result = stream.readStringUntil('\n').toInt();
DBG("### DATA AVAILABLE:", result, "on", mux);
if (result) DBG("### DATA AVAILABLE:", result, "on", mux);
waitResponse();
}
if (!result) {

View File

@@ -723,7 +723,7 @@ protected:
streamSkipUntil(','); // Skip total received
streamSkipUntil(','); // Skip have read
result = stream.readStringUntil('\n').toInt();
DBG("### DATA AVAILABLE:", result, "on", mux);
if (result) DBG("### DATA AVAILABLE:", result, "on", mux);
waitResponse();
}
if (!result) {

View File

@@ -752,7 +752,7 @@ protected:
streamSkipUntil(','); // Skip total received
streamSkipUntil(','); // Skip have read
result = stream.readStringUntil('\n').toInt();
DBG("### DATA AVAILABLE:", result, "on", mux);
if (result) DBG("### DATA AVAILABLE:", result, "on", mux);
waitResponse();
}
if (!result) {

View File

@@ -71,19 +71,17 @@ public:
public:
virtual int connect(const char *host, uint16_t port) {
if (sock_connected) {
stop();
// If we're creating a new connection on the same client, we need to wait
// until the async close has finished on Cat-M modems.
// After close has completed, the +UUSOCL should appear.
if (at->isCatM) {
if (at->isCatM && sock_connected) {
DBG("Waiting for +UUSOCL URC on", mux);
for (unsigned long start = millis(); millis() - start < 120000L; ) {
at->maintain();
if (!sock_connected) break;
}
}
}
TINY_GSM_YIELD();
rx.clear();
// sock_connected = at->modemConnect(host, port, mux);
@@ -844,7 +842,7 @@ protected:
if (res == 1) {
streamSkipUntil(','); // Skip mux
result = stream.readStringUntil('\n').toInt();
DBG("### DATA AVAILABLE:", result, "on", mux);
if (result) DBG("### DATA AVAILABLE:", result, "on", mux);
waitResponse();
}
if (!result && res != 2 && res != 3) { // Don't check modemGetConnected after an error