1
0
mirror of https://github.com/s00500/ESPUI.git synced 2024-11-24 07:20:53 +00:00

Fix littleFS does not exist on esp32

Signed-off-by: Lukas Bachschwell <lukas@lbsfilm.at>
This commit is contained in:
Lukas Bachschwell 2020-09-24 21:56:32 +02:00
parent 313a069d4c
commit 3cf1aa7f49
Signed by: lbsadmin
GPG Key ID: CCC6AA87CC8DF425
2 changed files with 19 additions and 21 deletions

View File

@ -26,7 +26,7 @@ void listDir(const char* dirname, uint8_t levels)
} }
#endif #endif
File root = LittleFS.open(dirname); File root = SPIFFS.open(dirname);
if (!root) if (!root)
{ {
@ -119,11 +119,10 @@ void ESPUIClass::list()
listDir("/", 1); listDir("/", 1);
#if defined(ESP32) #if defined(ESP32)
Serial.println(LittleFS.totalBytes()); Serial.println(SPIFFS.totalBytes());
Serial.println(LittleFS.usedBytes()); Serial.println(SPIFFS.usedBytes());
#else #else FSInfo fs_info;
FSInfo fs_info;
LittleFS.info(fs_info); LittleFS.info(fs_info);
Serial.println(fs_info.totalBytes); Serial.println(fs_info.totalBytes);
@ -263,9 +262,9 @@ void ESPUIClass::prepareFileSystem()
#endif #endif
#if defined(ESP32) #if defined(ESP32)
LittleFS.format(); SPIFFS.format();
if (!LittleFS.begin(true)) if (!SPIFFS.begin(true))
{ {
#if defined(DEBUG_ESPUI) #if defined(DEBUG_ESPUI)
if (this->verbosity) if (this->verbosity)
@ -347,7 +346,11 @@ void ESPUIClass::prepareFileSystem()
#endif #endif
#if defined(ESP32)
SPIFFS.end();
#else
LittleFS.end(); LittleFS.end();
#endif
} }
// Handle Websockets Communication // Handle Websockets Communication
@ -356,8 +359,7 @@ void onWsEvent(
{ {
switch (type) switch (type)
{ {
case WS_EVT_DISCONNECT: case WS_EVT_DISCONNECT: {
{
#if defined(DEBUG_ESPUI) #if defined(DEBUG_ESPUI)
if (ESPUI.verbosity) if (ESPUI.verbosity)
{ {
@ -368,8 +370,7 @@ void onWsEvent(
break; break;
} }
case WS_EVT_PONG: case WS_EVT_PONG: {
{
#if defined(DEBUG_ESPUI) #if defined(DEBUG_ESPUI)
if (ESPUI.verbosity) if (ESPUI.verbosity)
{ {
@ -380,8 +381,7 @@ void onWsEvent(
break; break;
} }
case WS_EVT_ERROR: case WS_EVT_ERROR: {
{
#if defined(DEBUG_ESPUI) #if defined(DEBUG_ESPUI)
if (ESPUI.verbosity) if (ESPUI.verbosity)
{ {
@ -392,8 +392,7 @@ void onWsEvent(
break; break;
} }
case WS_EVT_CONNECT: case WS_EVT_CONNECT: {
{
#if defined(DEBUG_ESPUI) #if defined(DEBUG_ESPUI)
if (ESPUI.verbosity) if (ESPUI.verbosity)
{ {
@ -413,8 +412,7 @@ void onWsEvent(
} }
break; break;
case WS_EVT_DATA: case WS_EVT_DATA: {
{
String msg = ""; String msg = "";
msg.reserve(len + 1); msg.reserve(len + 1);

View File

@ -10,10 +10,10 @@
#include "stdlib_noniso.h" #include "stdlib_noniso.h"
#if defined(ESP32) #if defined(ESP32)
#include <AsyncTCP.h> #include <AsyncTCP.h>
#include <ESPAsyncWebServer.h> #include <ESPAsyncWebServer.h>
#include "FS.h"
#include "LittleFS.h" #include "LittleFS.h"
#include "WiFi.h" #include "WiFi.h"