From b0827e9565897995c3ae38745fe88d05cd9c162c Mon Sep 17 00:00:00 2001 From: SRGDamia1 Date: Thu, 13 Apr 2017 01:37:26 -0400 Subject: [PATCH] Minor debugging tweaks --- TinyGsmClientSIM800.h | 1 - TinyGsmClientXBee.h | 12 ++++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/TinyGsmClientSIM800.h b/TinyGsmClientSIM800.h index 8a65522..62c0bf9 100644 --- a/TinyGsmClientSIM800.h +++ b/TinyGsmClientSIM800.h @@ -618,7 +618,6 @@ public: if (gotData) { sockets[mux]->sock_available = modemGetAvailable(mux); } - data = ""; return index; } diff --git a/TinyGsmClientXBee.h b/TinyGsmClientXBee.h index 684d8f4..3dd48a0 100644 --- a/TinyGsmClientXBee.h +++ b/TinyGsmClientXBee.h @@ -285,7 +285,12 @@ public: bool waitForNetwork(unsigned long timeout = 60000L) { for (unsigned long start = millis(); millis() - start < timeout; ) { - if (modemGetConnected()) { + commandMode(); + sendAT(GF("AI")); + waitResponse(); + String res = streamReadUntil('\r'); + exitCommand(); + if (res == 0) { return true; } delay(1000); @@ -389,7 +394,7 @@ public: streamWrite("AT", cmd..., GSM_NL); stream.flush(); TINY_GSM_YIELD(); - DBG("\r\n", ">>> AT:", cmd...); + DBG("\r\n", ">>> AT ", cmd..., "\r\n"); } // TODO: Optimize this! @@ -444,13 +449,12 @@ public: data.replace(GSM_NL GSM_NL, GSM_NL); data.replace(GSM_NL, "\r\n" " "); if (data.length()) { - DBG(GSM_NL, "<<< ", data); + DBG("\r\n", "<<< ", data); } } // if (gotData) { // sockets[mux]->sock_available = modemGetAvailable(mux); // } - data = ""; return index; }