Skip to content
This repository was archived by the owner on Feb 4, 2023. It is now read-only.

Commit fc884a0

Browse files
committed
Merge branch 'dev_hmueller01' of https://github.com/hmueller01/ESP_WiFiManager_Lite into dev_hmueller01
2 parents 0cc570d + 0843634 commit fc884a0

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

src/ESP_WiFiManager_Lite.h

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1278,6 +1278,47 @@ class ESP_WiFiManager_Lite
12781278

12791279
//////////////////////////////////////
12801280

1281+
#if USE_DYNAMIC_PARAMETERS
1282+
1283+
bool extLoadDynamicData()
1284+
{
1285+
#if ESP8266
1286+
// SPIFFS and LittleFS do auto-format if not yet
1287+
if (!FileFS.begin())
1288+
#else
1289+
// Format SPIFFS if not yet
1290+
if (!FileFS.begin(true))
1291+
#endif
1292+
{
1293+
ESP_WML_LOGERROR(F("SPIFFS/LittleFS failed!"));
1294+
return false;
1295+
}
1296+
1297+
return loadDynamicData();
1298+
}
1299+
1300+
//////////////////////////////////////////////
1301+
1302+
void extSaveDynamicData()
1303+
{
1304+
#if ESP8266
1305+
// SPIFFS and LittleFS do auto-format if not yet
1306+
if (!FileFS.begin())
1307+
#else
1308+
// Format SPIFFS if not yet
1309+
if (!FileFS.begin(true))
1310+
#endif
1311+
{
1312+
ESP_WML_LOGERROR(F("SPIFFS/LittleFS failed!"));
1313+
return;
1314+
}
1315+
1316+
saveDynamicData();
1317+
}
1318+
1319+
#endif
1320+
1321+
//////////////////////////////////////
12811322

12821323
private:
12831324
String ipAddress = "0.0.0.0";
@@ -1297,6 +1338,7 @@ class ESP_WiFiManager_Lite
12971338

12981339
unsigned long configTimeout;
12991340
bool hadConfigData = false;
1341+
bool hadDynamicData = false;
13001342

13011343
bool isForcedConfigPortal = false;
13021344
bool persForcedConfigPortal = false;
@@ -1682,6 +1724,11 @@ class ESP_WiFiManager_Lite
16821724

16831725
bool loadDynamicData()
16841726
{
1727+
if (hadDynamicData)
1728+
{
1729+
return true;
1730+
}
1731+
16851732
int checkSum = 0;
16861733
int readCheckSum;
16871734
totalDataSize = sizeof(ESP_WM_LITE_config) + sizeof(readCheckSum);
@@ -1734,6 +1781,7 @@ class ESP_WiFiManager_Lite
17341781
return false;
17351782
}
17361783

1784+
hadDynamicData = true;
17371785
return true;
17381786
}
17391787

0 commit comments

Comments
 (0)