From 2992c0b973bef20930611d6ed890e3a7103ec064 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Tue, 10 Sep 2019 11:19:33 -0400 Subject: [PATCH 1/8] Check for XBee IP in connection status --- src/TinyGsmClientXBee.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/TinyGsmClientXBee.h b/src/TinyGsmClientXBee.h index 320e5e2..9cb31e6 100644 --- a/src/TinyGsmClientXBee.h +++ b/src/TinyGsmClientXBee.h @@ -663,7 +663,16 @@ public: bool isNetworkConnected() { RegStatus s = getRegistrationStatus(); - return (s == REG_OK); + if (s == REG_OK) { + IPAddress ip = localIP(); + if (ip != IPAddress(0, 0, 0, 0)) { + return true; + } else { + return false; + } + } else { + return false; + } } bool waitForNetwork(unsigned long timeout_ms = 60000L) { From bcc6eeb05ce1eac878709baf63ef6d033a876c84 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Tue, 10 Sep 2019 18:09:09 -0400 Subject: [PATCH 2/8] don't accept 0xFF as XBee Wifi strength --- src/TinyGsmClientXBee.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/TinyGsmClientXBee.h b/src/TinyGsmClientXBee.h index 9cb31e6..addbfa6 100644 --- a/src/TinyGsmClientXBee.h +++ b/src/TinyGsmClientXBee.h @@ -657,6 +657,8 @@ public: XBEE_COMMAND_END_DECORATOR if (beeType == XBEE3_LTEM_ATT && intRes == 105) intRes = 0; // tends to reply with "69" when signal is unknown + if (beeType == XBEE3_LTEM_ATT && intRes == 0xFF) intRes = 0; // 0xFF returned for unknown + if (beeType == XBEE_S6B_WIFI) return -93 + intRes; // the maximum sensitivity is -93dBm else return -1*intRes; // need to convert to negative number } From b5ac089604ff00d60dbfa8bed2c2dc9b1020e337 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Tue, 10 Sep 2019 18:24:45 -0400 Subject: [PATCH 3/8] That signal fix should have been for WIFI --- src/TinyGsmClientXBee.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TinyGsmClientXBee.h b/src/TinyGsmClientXBee.h index addbfa6..4422986 100644 --- a/src/TinyGsmClientXBee.h +++ b/src/TinyGsmClientXBee.h @@ -657,7 +657,7 @@ public: XBEE_COMMAND_END_DECORATOR if (beeType == XBEE3_LTEM_ATT && intRes == 105) intRes = 0; // tends to reply with "69" when signal is unknown - if (beeType == XBEE3_LTEM_ATT && intRes == 0xFF) intRes = 0; // 0xFF returned for unknown + if (beeType == XBEE_S6B_WIFI && intRes == 0xFF) intRes = 0; // 0xFF returned for unknown if (beeType == XBEE_S6B_WIFI) return -93 + intRes; // the maximum sensitivity is -93dBm else return -1*intRes; // need to convert to negative number From fd523587a17039100b2a6002015b0df737b718cf Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Tue, 10 Sep 2019 18:31:46 -0400 Subject: [PATCH 4/8] Still wrong, fixing --- src/TinyGsmClientXBee.h | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/TinyGsmClientXBee.h b/src/TinyGsmClientXBee.h index 4422986..f855858 100644 --- a/src/TinyGsmClientXBee.h +++ b/src/TinyGsmClientXBee.h @@ -657,10 +657,16 @@ public: XBEE_COMMAND_END_DECORATOR if (beeType == XBEE3_LTEM_ATT && intRes == 105) intRes = 0; // tends to reply with "69" when signal is unknown - if (beeType == XBEE_S6B_WIFI && intRes == 0xFF) intRes = 0; // 0xFF returned for unknown - if (beeType == XBEE_S6B_WIFI) return -93 + intRes; // the maximum sensitivity is -93dBm - else return -1*intRes; // need to convert to negative number + if (beeType == XBEE_S6B_WIFI) { + if (intRes == 0xFF) { + return 0; // 0xFF returned for unknown + } else { + return -93 + intRes; // the maximum sensitivity is -93dBm + } + } else { + return -1*intRes; // need to convert to negative number + } } bool isNetworkConnected() { From e99a33a6734c34c19aa9de499fa7606d51753ea9 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Tue, 10 Sep 2019 19:05:06 -0400 Subject: [PATCH 5/8] If no saved IP, then can say we're not connected w/o command mode --- src/TinyGsmClientXBee.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/TinyGsmClientXBee.h b/src/TinyGsmClientXBee.h index f855858..b48bf1c 100644 --- a/src/TinyGsmClientXBee.h +++ b/src/TinyGsmClientXBee.h @@ -203,6 +203,9 @@ public: virtual uint8_t connected() { if (available()) { return true; + // if we never got an IP, it can't be connected + } else if (at->savedIP == IPAddress(0, 0, 0, 0)){ + return false; } return sock_connected; // NOTE: We dont't check or return From f339fe91f0c8534f899d1b88962a464c68c81692 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 11 Sep 2019 15:15:17 -0400 Subject: [PATCH 6/8] Fix last nagging compiler warnings --- src/TinyGsmClientESP8266.h | 2 +- src/TinyGsmClientXBee.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/TinyGsmClientESP8266.h b/src/TinyGsmClientESP8266.h index 8dc922d..b993805 100644 --- a/src/TinyGsmClientESP8266.h +++ b/src/TinyGsmClientESP8266.h @@ -388,7 +388,7 @@ protected: bool modemGetConnected(uint8_t mux) { sendAT(GF("+CIPSTATUS")); - if (waitResponse(3000, GF("STATUS:")) != 1) return REG_UNKNOWN; + if (waitResponse(3000, GF("STATUS:")) != 1) return false; int status = waitResponse(GFP(GSM_ERROR), GF("2"), GF("3"), GF("4"), GF("5")); if (status != 3) { diff --git a/src/TinyGsmClientXBee.h b/src/TinyGsmClientXBee.h index b48bf1c..5920c70 100644 --- a/src/TinyGsmClientXBee.h +++ b/src/TinyGsmClientXBee.h @@ -1181,6 +1181,7 @@ public: // 0x02 = Invalid parameters (bad IP/host) // 0x12 = DNS query lookup failure // 0x25 = Unknown server - DNS lookup failed (0x22 for UDP socket!) + // fall through case 0x02: case 0x12: case 0x25: { @@ -1189,6 +1190,7 @@ public: // If it's anything else (inc 0x02, 0x12, and 0x25)... // it's definitely NOT connected + // fall through default: { sockets[0]->sock_connected = false; savedOperatingIP = od; From ce8d6bd318ff43327bde2da2ce2f191fdc0ae6dd Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 18 Sep 2019 14:51:02 -0400 Subject: [PATCH 7/8] Updated comments about ESP32 issue --- .github/ISSUE_TEMPLATE.md | 1 - README.md | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index aeccd82..fc39447 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -15,7 +15,6 @@ with your board before submitting any issues. [ ] Request to support a new module [ ] Bug or problem compiling the library - [ ] Bug or issue with library functionality (ie, sending data over TCP/IP) diff --git a/README.md b/README.md index 5739b95..2784cfe 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,7 @@ When using ESP32 `HardwareSerial`, you may need to specify additional parameters Please [refer to this comment](https://github.com/vshymanskyy/TinyGSM/issues/91#issuecomment-356024747). #### HttpClient -You will not be able to compile the HttpClient or HttpsClient examples with ESP32 core >1.0.1. Downgrade to version 1.0.1 or use the WebClient example. Please comment on the issue on the ESP32 core, not in this library: https://github.com/espressif/arduino-esp32/issues/2755 +You will not be able to compile the HttpClient or HttpsClient examples with ESP32 core 1.0.2. Upgrade to 1.0.3, downgrade to version 1.0.1 or use the WebClient example. ### SAMD21 From c48969ac89aaaed30470ba031e495071f5f1e116 Mon Sep 17 00:00:00 2001 From: Sara Damiano Date: Wed, 18 Sep 2019 14:56:02 -0400 Subject: [PATCH 8/8] One character typo fix (dont't to don't..) --- src/TinyGsmClientXBee.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TinyGsmClientXBee.h b/src/TinyGsmClientXBee.h index 5920c70..9662ee0 100644 --- a/src/TinyGsmClientXBee.h +++ b/src/TinyGsmClientXBee.h @@ -208,7 +208,7 @@ public: return false; } return sock_connected; - // NOTE: We dont't check or return + // NOTE: We don't check or return // modemGetConnected() because we don't // want to go into command mode. // return at->modemGetConnected();