This commit is contained in:
e2002
2022-08-29 10:23:53 +03:00
parent de9753058d
commit b574b4ab8d
15 changed files with 435 additions and 680 deletions

View File

@@ -443,7 +443,7 @@ bool Config::parseSsid(const char* line, char* ssid, char* pass) {
return true;
}
bool Config::saveWifi(const char* post) {
bool Config::saveWifiFromNextion(const char* post){
File file = SPIFFS.open(SSIDS_PATH, "w");
if (!file) {
return false;
@@ -455,6 +455,14 @@ bool Config::saveWifi(const char* post) {
}
}
bool Config::saveWifi() {
if (!SPIFFS.exists(TMP_PATH)) return false;
SPIFFS.remove(SSIDS_PATH);
SPIFFS.rename(TMP_PATH, SSIDS_PATH);
ESP.restart();
return true;
}
bool Config::initNetwork() {
File file = SPIFFS.open(SSIDS_PATH, "r");
if (!file || file.isDirectory()) {