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 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 320e5e2..9662ee0 100644 --- a/src/TinyGsmClientXBee.h +++ b/src/TinyGsmClientXBee.h @@ -203,9 +203,12 @@ 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 + // NOTE: We don't check or return // modemGetConnected() because we don't // want to go into command mode. // return at->modemGetConnected(); @@ -657,13 +660,30 @@ 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) 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() { 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) { @@ -1161,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: { @@ -1169,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;