diff --git a/src/WiFiConfig.cpp b/src/WiFiConfig.cpp index d2c78c4..f3c8342 100644 --- a/src/WiFiConfig.cpp +++ b/src/WiFiConfig.cpp @@ -471,6 +471,10 @@ void WiFiConfig::_handleSetAP(AsyncWebServerRequest *request) if (str.length() > 0) { uint8_t mode; + if (USEDFS.exists(F(WIFICFG_OLD_FILE))) { + USEDFS.remove(F(WIFICFG_OLD_FILE)); + } + USEDFS.rename(F(WIFICFG_FILE), F(WIFICFG_OLD_FILE)); strEncode(str); svSetV(F("ssid"), str, F(WIFICFG_FILE)); str = request->arg(F("_p")); diff --git a/src/WiFiConfig.h b/src/WiFiConfig.h index 2c623b6..76fa89f 100644 --- a/src/WiFiConfig.h +++ b/src/WiFiConfig.h @@ -44,6 +44,9 @@ #if not defined(WIFICFG_FILE) # define WIFICFG_FILE "/wifi.json" #endif +#if not defined(WIFICFG_OLD_FILE) +# define WIFICFG_OLD_FILE "/wifi.old" +#endif // Parametr, predany uzivatelske callback funkci, urceny pro aplikacni vizualizaci stavu konfigurace a pripojeni typedef enum {