From e9fc63f86d32ea01d4bea71e02fa2c3075887714 Mon Sep 17 00:00:00 2001 From: MartinMueller2003 Date: Mon, 12 Feb 2024 09:15:00 -0500 Subject: [PATCH] Modified to use the ESPUI unified littlefs handle --- pio_examples/gui/src/gui.ino | 31 ++++++++----------------------- 1 file changed, 8 insertions(+), 23 deletions(-) diff --git a/pio_examples/gui/src/gui.ino b/pio_examples/gui/src/gui.ino index 1c88058..8953a0d 100644 --- a/pio_examples/gui/src/gui.ino +++ b/pio_examples/gui/src/gui.ino @@ -265,18 +265,11 @@ void setup(void) ESPUI.beginLITTLEFS("ESPUI Control"); // create a text file - #if defined(ESP32) -#if (ESP_IDF_VERSION_MAJOR == 4 && ESP_IDF_VERSION_MINOR >= 4) || ESP_IDF_VERSION_MAJOR > 4 - File testFile = LittleFS.open(String("/") + DisplayTestFileName, "w"); -#else - File testFile = LITTLEFS.open(String("/") + DisplayTestFileName, "w"); -#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(); + ESPUI.writeFile("/DisplayFile.txt", "Test Line\n"); + + // these files are used by browsers to auto config a connection. + ESPUI.writeFile("/wpad.dat", " "); + ESPUI.writeFile("/connecttest.txt", " "); } void loop(void) @@ -296,18 +289,10 @@ void loop(void) testSwitchState = !testSwitchState; ESPUI.updateSwitcher(testSwitchId, testSwitchState); - #if defined(ESP32) -#if (ESP_IDF_VERSION_MAJOR == 4 && ESP_IDF_VERSION_MINOR >= 4) || ESP_IDF_VERSION_MAJOR > 4 - File testFile = LittleFS.open(String("/") + DisplayTestFileName, "a"); + // update the file Display file. + File testFile = ESPUI.EspuiLittleFS.open(String("/") + DisplayTestFileName, "a"); 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"; if(filesize < 1000) {