diff --git a/Platformio/HAL/Targets/ESP32/wifiHandler/wifihandler.cpp b/Platformio/HAL/Targets/ESP32/wifiHandler/wifihandler.cpp index 66884ed..9aee168 100644 --- a/Platformio/HAL/Targets/ESP32/wifiHandler/wifihandler.cpp +++ b/Platformio/HAL/Targets/ESP32/wifiHandler/wifihandler.cpp @@ -109,6 +109,8 @@ void wifiHandler::update_status() 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 (strcmp(temporary_password, wifiHandler::password) != 0 || strcmp(temporary_ssid, wifiHandler::SSID) != 0) { @@ -138,6 +140,7 @@ void wifiHandler::update_credentials() preferences.end(); } #endif +this->connect_attempt = false; } void wifiHandler::scan() @@ -200,6 +203,7 @@ void wifiHandler::onStatusUpdate(std::function void wifiHandler::connect(std::shared_ptr ssid, std::shared_ptr password) { + this->connect_attempt = true; this->temporary_password = password; this->temporary_ssid = ssid; WiFi.begin(ssid->c_str(), password->c_str()); diff --git a/Platformio/HAL/Targets/ESP32/wifiHandler/wifihandler.hpp b/Platformio/HAL/Targets/ESP32/wifiHandler/wifihandler.hpp index d44735b..b9a855f 100644 --- a/Platformio/HAL/Targets/ESP32/wifiHandler/wifihandler.hpp +++ b/Platformio/HAL/Targets/ESP32/wifiHandler/wifihandler.hpp @@ -66,6 +66,7 @@ class wifiHandler: public wifiHandlerInterface { std::string getIP(); wifiStatus wifi_status; static std::shared_ptr mInstance; + bool connect_attempt = false; std::shared_ptr temporary_password; std::shared_ptr temporary_ssid;