Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions src/AutoConnect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ bool AutoConnect::begin(const char* ssid, const char* passphrase, unsigned long

if (cs) {
// Advance configuration for STA mode. Restore previous configuration of STA.
_loadAvailCredential(reinterpret_cast<const char*>(current.ssid));
bool available_cred = _loadAvailCredential(reinterpret_cast<const char*>(current.ssid));
if (!_configSTA(_apConfig.staip, _apConfig.staGateway, _apConfig.staNetmask, _apConfig.dns1, _apConfig.dns2))
return false;

Expand All @@ -135,8 +135,13 @@ bool AutoConnect::begin(const char* ssid, const char* passphrase, unsigned long
_disconnectWiFi(false);
WiFi.begin(c_ssid, c_password);
}
AC_DBG("WiFi.begin(%s%s%s)\n", c_ssid == nullptr ? "" : c_ssid, c_password == nullptr ? "" : ",", c_password == nullptr ? "" : c_password);
cs = _waitForConnect(_connectTimeout) == WL_CONNECTED;
if(c_ssid == nullptr && c_password == nullptr && available_cred == false){
cs = false;
}
else{
AC_DBG("WiFi.begin(%s%s%s)\n", c_ssid == nullptr ? "" : c_ssid, c_password == nullptr ? "" : ",", c_password == nullptr ? "" : c_password);
cs = _waitForConnect(_connectTimeout) == WL_CONNECTED;
}
}
}

Expand Down