Zalohovani stare konfigurace

This commit is contained in:
Pavel Brychta 2021-08-24 17:09:21 +02:00
parent 95a15b11dc
commit cbeac02edc
2 changed files with 7 additions and 0 deletions

View File

@ -471,6 +471,10 @@ void WiFiConfig::_handleSetAP(AsyncWebServerRequest *request)
if (str.length() > 0) { if (str.length() > 0) {
uint8_t mode; 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); strEncode(str);
svSetV(F("ssid"), str, F(WIFICFG_FILE)); svSetV(F("ssid"), str, F(WIFICFG_FILE));
str = request->arg(F("_p")); str = request->arg(F("_p"));

View File

@ -44,6 +44,9 @@
#if not defined(WIFICFG_FILE) #if not defined(WIFICFG_FILE)
# define WIFICFG_FILE "/wifi.json" # define WIFICFG_FILE "/wifi.json"
#endif #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 // Parametr, predany uzivatelske callback funkci, urceny pro aplikacni vizualizaci stavu konfigurace a pripojeni
typedef enum { typedef enum {