fixing issue when wifi connects but no connection was requested
This commit is contained in:
parent
11d4e8d7e5
commit
db75db33d8
2 changed files with 5 additions and 0 deletions
|
@ -109,6 +109,8 @@ void wifiHandler::update_status()
|
||||||
|
|
||||||
void wifiHandler::update_credentials()
|
void wifiHandler::update_credentials()
|
||||||
{
|
{
|
||||||
|
// No connection was attempted so don't try to to save the creds
|
||||||
|
if(!this->connect_attempt) return;
|
||||||
#if 0
|
#if 0
|
||||||
if (strcmp(temporary_password, wifiHandler::password) != 0 || strcmp(temporary_ssid, wifiHandler::SSID) != 0)
|
if (strcmp(temporary_password, wifiHandler::password) != 0 || strcmp(temporary_ssid, wifiHandler::SSID) != 0)
|
||||||
{
|
{
|
||||||
|
@ -138,6 +140,7 @@ void wifiHandler::update_credentials()
|
||||||
preferences.end();
|
preferences.end();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
this->connect_attempt = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wifiHandler::scan()
|
void wifiHandler::scan()
|
||||||
|
@ -200,6 +203,7 @@ void wifiHandler::onStatusUpdate(std::function<void (std::shared_ptr<wifiStatus>
|
||||||
|
|
||||||
void wifiHandler::connect(std::shared_ptr<std::string> ssid, std::shared_ptr<std::string> password)
|
void wifiHandler::connect(std::shared_ptr<std::string> ssid, std::shared_ptr<std::string> password)
|
||||||
{
|
{
|
||||||
|
this->connect_attempt = true;
|
||||||
this->temporary_password = password;
|
this->temporary_password = password;
|
||||||
this->temporary_ssid = ssid;
|
this->temporary_ssid = ssid;
|
||||||
WiFi.begin(ssid->c_str(), password->c_str());
|
WiFi.begin(ssid->c_str(), password->c_str());
|
||||||
|
|
|
@ -66,6 +66,7 @@ class wifiHandler: public wifiHandlerInterface {
|
||||||
std::string getIP();
|
std::string getIP();
|
||||||
wifiStatus wifi_status;
|
wifiStatus wifi_status;
|
||||||
static std::shared_ptr<wifiHandler> mInstance;
|
static std::shared_ptr<wifiHandler> mInstance;
|
||||||
|
bool connect_attempt = false;
|
||||||
std::shared_ptr<std::string> temporary_password;
|
std::shared_ptr<std::string> temporary_password;
|
||||||
std::shared_ptr<std::string> temporary_ssid;
|
std::shared_ptr<std::string> temporary_ssid;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue