1
0
mirror of https://github.com/s00500/ESPUI.git synced 2024-11-21 22:50:55 +00:00

Modified to use the ESPUI unified littlefs handle

This commit is contained in:
MartinMueller2003 2024-02-12 09:15:00 -05:00
parent 1ba92a3cd6
commit e9fc63f86d

View File

@ -265,18 +265,11 @@ void setup(void)
ESPUI.beginLITTLEFS("ESPUI Control"); ESPUI.beginLITTLEFS("ESPUI Control");
// create a text file // create a text file
#if defined(ESP32) ESPUI.writeFile("/DisplayFile.txt", "Test Line\n");
#if (ESP_IDF_VERSION_MAJOR == 4 && ESP_IDF_VERSION_MINOR >= 4) || ESP_IDF_VERSION_MAJOR > 4
File testFile = LittleFS.open(String("/") + DisplayTestFileName, "w"); // these files are used by browsers to auto config a connection.
#else ESPUI.writeFile("/wpad.dat", " ");
File testFile = LITTLEFS.open(String("/") + DisplayTestFileName, "w"); ESPUI.writeFile("/connecttest.txt", " ");
#endif
#else
File testFile = LittleFS.open(String("/") + DisplayTestFileName, "w");
#endif
String TestLine = String("Current Time = ") + String(millis()) + "\n";
testFile.write((const uint8_t*)TestLine.c_str(), TestLine.length());
testFile.close();
} }
void loop(void) void loop(void)
@ -296,18 +289,10 @@ void loop(void)
testSwitchState = !testSwitchState; testSwitchState = !testSwitchState;
ESPUI.updateSwitcher(testSwitchId, testSwitchState); ESPUI.updateSwitcher(testSwitchId, testSwitchState);
#if defined(ESP32) // update the file Display file.
#if (ESP_IDF_VERSION_MAJOR == 4 && ESP_IDF_VERSION_MINOR >= 4) || ESP_IDF_VERSION_MAJOR > 4 File testFile = ESPUI.EspuiLittleFS.open(String("/") + DisplayTestFileName, "a");
File testFile = LittleFS.open(String("/") + DisplayTestFileName, "a");
uint32_t filesize = testFile.size(); uint32_t filesize = testFile.size();
#else
File testFile = LITTLEFS.open(String("/") + DisplayTestFileName, "a");
uint32_t filesize = testFile.size();
#endif
#else
File testFile = LittleFS.open(String("/") + DisplayTestFileName, "a");
uint32_t filesize = testFile.fileSize();
#endif
String TestLine = String("Current Time = ") + String(millis()) + "\n"; String TestLine = String("Current Time = ") + String(millis()) + "\n";
if(filesize < 1000) if(filesize < 1000)
{ {