Skip to content

Commit

Permalink
Fix littleFS does not exist on esp32
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Bachschwell <[email protected]>
  • Loading branch information
s00500 committed Oct 16, 2020
1 parent 313a069 commit 3cf1aa7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 21 deletions.
36 changes: 17 additions & 19 deletions src/ESPUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void listDir(const char* dirname, uint8_t levels)
}
#endif

File root = LittleFS.open(dirname);
File root = SPIFFS.open(dirname);

if (!root)
{
Expand Down Expand Up @@ -119,11 +119,10 @@ void ESPUIClass::list()
listDir("/", 1);
#if defined(ESP32)

Serial.println(LittleFS.totalBytes());
Serial.println(LittleFS.usedBytes());
Serial.println(SPIFFS.totalBytes());
Serial.println(SPIFFS.usedBytes());

#else
FSInfo fs_info;
#else FSInfo fs_info;
LittleFS.info(fs_info);

Serial.println(fs_info.totalBytes);
Expand Down Expand Up @@ -263,9 +262,9 @@ void ESPUIClass::prepareFileSystem()
#endif

#if defined(ESP32)
LittleFS.format();
SPIFFS.format();

if (!LittleFS.begin(true))
if (!SPIFFS.begin(true))
{
#if defined(DEBUG_ESPUI)
if (this->verbosity)
Expand Down Expand Up @@ -347,7 +346,11 @@ void ESPUIClass::prepareFileSystem()

#endif

#if defined(ESP32)
SPIFFS.end();
#else
LittleFS.end();
#endif
}

// Handle Websockets Communication
Expand All @@ -356,8 +359,7 @@ void onWsEvent(
{
switch (type)
{
case WS_EVT_DISCONNECT:
{
case WS_EVT_DISCONNECT: {
#if defined(DEBUG_ESPUI)
if (ESPUI.verbosity)
{
Expand All @@ -368,8 +370,7 @@ void onWsEvent(
break;
}

case WS_EVT_PONG:
{
case WS_EVT_PONG: {
#if defined(DEBUG_ESPUI)
if (ESPUI.verbosity)
{
Expand All @@ -380,8 +381,7 @@ void onWsEvent(
break;
}

case WS_EVT_ERROR:
{
case WS_EVT_ERROR: {
#if defined(DEBUG_ESPUI)
if (ESPUI.verbosity)
{
Expand All @@ -392,8 +392,7 @@ void onWsEvent(
break;
}

case WS_EVT_CONNECT:
{
case WS_EVT_CONNECT: {
#if defined(DEBUG_ESPUI)
if (ESPUI.verbosity)
{
Expand All @@ -413,8 +412,7 @@ void onWsEvent(
}
break;

case WS_EVT_DATA:
{
case WS_EVT_DATA: {
String msg = "";
msg.reserve(len + 1);

Expand Down Expand Up @@ -544,7 +542,7 @@ void onWsEvent(
else if (msg.startsWith("tabvalue:"))
{
c->callback(c, client->id());
}
}
else if (msg.startsWith(F("svalue:")))
{
c->value = msg.substring(msg.indexOf(':') + 1, msg.lastIndexOf(':'));
Expand Down Expand Up @@ -864,7 +862,7 @@ void ESPUIClass::updateGauge(uint16_t id, int number, int clientId)
updateControlValue(id, String(number), clientId);
}

void ESPUIClass::clearGraph(uint16_t id, int clientId) {}
void ESPUIClass::clearGraph(uint16_t id, int clientId) { }

void ESPUIClass::addGraphPoint(uint16_t id, int nValue, int clientId)
{
Expand Down
4 changes: 2 additions & 2 deletions src/ESPUI.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
#include "stdlib_noniso.h"

#if defined(ESP32)

#include <AsyncTCP.h>
#include <ESPAsyncWebServer.h>

#include "FS.h"
#include "LittleFS.h"
#include "WiFi.h"

Expand Down Expand Up @@ -163,7 +163,7 @@ class Control
color(control.color),
parentControl(control.parentControl),
next(control.next)
{}
{ }

private:
static uint16_t idCounter;
Expand Down

0 comments on commit 3cf1aa7

Please sign in to comment.