support WiFi S6B no passwd

This commit is contained in:
neil hancock
2018-11-05 11:55:08 -08:00
parent f0ae66b4a5
commit 82b7457ace

View File

@@ -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();