From f3323f1136287f8aad3cd54eab70fbde3bfb27fb Mon Sep 17 00:00:00 2001 From: SRGDamia1 Date: Tue, 27 Mar 2018 14:51:01 -0400 Subject: [PATCH] Moved fxns from Wifi connect to init for ESP --- src/TinyGsmClientESP8266.h | 20 ++++++++------------ src/TinyGsmClientXBee.h | 2 +- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/TinyGsmClientESP8266.h b/src/TinyGsmClientESP8266.h index 4998de7..3652277 100644 --- a/src/TinyGsmClientESP8266.h +++ b/src/TinyGsmClientESP8266.h @@ -238,6 +238,14 @@ public: if (waitResponse() != 1) { return false; } + sendAT(GF("+CIPMUX=1")); // Enable Multiple Connections + if (waitResponse() != 1) { + return false; + } + sendAT(GF("+CWMODE_CUR=1")); // Put into "station" mode + if (waitResponse() != 1) { + return false; + } return true; } @@ -378,22 +386,10 @@ public: * WiFi functions */ bool networkConnect(const char* ssid, const char* pwd) { - - sendAT(GF("+CIPMUX=1")); - if (waitResponse() != 1) { - return false; - } - - sendAT(GF("+CWMODE_CUR=1")); - if (waitResponse() != 1) { - return false; - } - sendAT(GF("+CWJAP_CUR=\""), ssid, GF("\",\""), pwd, GF("\"")); if (waitResponse(30000L, GFP(GSM_OK), GF(GSM_NL "FAIL" GSM_NL)) != 1) { return false; } - return true; } diff --git a/src/TinyGsmClientXBee.h b/src/TinyGsmClientXBee.h index ec050fb..622944a 100644 --- a/src/TinyGsmClientXBee.h +++ b/src/TinyGsmClientXBee.h @@ -401,7 +401,7 @@ public: bool radioOff() TINY_GSM_ATTR_NOT_IMPLEMENTED; - bool sleepEnable() TINY_GSM_ATTR_NOT_IMPLEMENTED; + bool sleepEnable(bool enable = true) TINY_GSM_ATTR_NOT_IMPLEMENTED; /* * SIM card functions