From 82b7457aceed6cc2716c6b25bc191a38f40708e2 Mon Sep 17 00:00:00 2001 From: neil hancock Date: Mon, 5 Nov 2018 11:55:08 -0800 Subject: [PATCH] support WiFi S6B no passwd --- src/TinyGsmClientXBee.h | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/TinyGsmClientXBee.h b/src/TinyGsmClientXBee.h index 5f744c7..26eafe8 100644 --- a/src/TinyGsmClientXBee.h +++ b/src/TinyGsmClientXBee.h @@ -597,16 +597,22 @@ public: bool networkConnect(const char* ssid, const char* pwd) { if (!commandMode()) return false; // return immediately + //nh For no pwd don't set setscurity or pwd + if (NULL == ssid ) return exitAndFail(); - sendAT(GF("EE"), 2); // Set security to WPA2 + if (NULL != pwd) + { + sendAT(GF("EE"), 2); // Set security to WPA2 + if (waitResponse() != 1) return exitAndFail(); + sendAT(GF("PK"), pwd); + } else { + sendAT(GF("EE"), 0); // Set No security + } if (waitResponse() != 1) return exitAndFail(); sendAT(GF("ID"), ssid); if (waitResponse() != 1) return exitAndFail(); - sendAT(GF("PK"), pwd); - if (waitResponse() != 1) return exitAndFail(); - if (!writeChanges()) return exitAndFail(); exitCommand();