This commit is contained in:
David McCurley 2023-05-03 11:50:35 -05:00 committed by GitHub
parent 5c92a0231b
commit 758b4ebf72
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 17 additions and 0 deletions

View file

@ -366,6 +366,22 @@ bool WiFiSTAClass::disconnect(bool wifioff, bool eraseap)
return false;
}
/**
* @brief Reset WiFi settings in NVS to default values.
* @return true if erase succeeded
* @note: Resets SSID, password, protocol, mode, etc.
* These settings are maintained by WiFi driver in IDF.
* WiFi driver must be initialized.
*/
bool WiFiSTAClass::eraseAP(void) {
if(WiFi.getMode()==WIFI_MODE_NULL) {
if(!WiFi.enableSTA(true))
return false;
}
return esp_wifi_restore()==ESP_OK;
}
/**
* Change IP configuration settings disabling the dhcp client
* @param local_ip Static ip configuration

View file

@ -53,6 +53,7 @@ public:
bool reconnect();
bool disconnect(bool wifioff = false, bool eraseap = false);
bool eraseAP(void);
bool isConnected();