From db155f6bb3dac44a5c58ce58d7a53d2b5bafd186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xose=20P=C3=A9rez?= Date: Sat, 19 Aug 2017 16:58:35 +0200 Subject: [PATCH] Decouple EMBEDDED_WEB from SPIFFS --- code/espurna/config/arduino.h | 1 + code/espurna/config/general.h | 9 +++++++++ code/espurna/espurna.ino | 4 ++-- code/espurna/web.ino | 2 +- 4 files changed, 13 insertions(+), 3 deletions(-) diff --git a/code/espurna/config/arduino.h b/code/espurna/config/arduino.h index 48d10728..11bcea82 100644 --- a/code/espurna/config/arduino.h +++ b/code/espurna/config/arduino.h @@ -57,5 +57,6 @@ //#define ENABLE_NOFUSS 1 //#define ENABLE_RF 1 //#define ENABLE_SERIAL_DEBUG 0 +//#define ENABLE_SPIFFS 1 //#define ENABLE_TERMINAL 0 //#define ENABLE_UDP_DEBUG 1 diff --git a/code/espurna/config/general.h b/code/espurna/config/general.h index 1130b585..4e629f60 100644 --- a/code/espurna/config/general.h +++ b/code/espurna/config/general.h @@ -232,6 +232,15 @@ PROGMEM const char* const custom_reset_string[] = { #define EMBEDDED_WEB 1 #endif +// ----------------------------------------------------------------------------- +// SPIFFS +// ----------------------------------------------------------------------------- + +// Do not add support for SPIFFS by default +#ifndef ENABLE_SPIFFS +#define ENABLE_SPIFFS 0 +#endif + // ----------------------------------------------------------------------------- // OTA & NOFUSS // ----------------------------------------------------------------------------- diff --git a/code/espurna/espurna.ino b/code/espurna/espurna.ino index 23e549a8..1143e031 100644 --- a/code/espurna/espurna.ino +++ b/code/espurna/espurna.ino @@ -130,7 +130,7 @@ void hardwareSetup() { Serial.begin(SERIAL_BAUDRATE); #endif - #if not EMBEDDED_WEB + #if ENABLE_SPIFFS SPIFFS.begin(); #endif @@ -173,7 +173,7 @@ void welcome() { DEBUG_MSG_P(PSTR("Firmware size: %d bytes\n"), ESP.getSketchSize()); DEBUG_MSG_P(PSTR("Free firmware space: %d bytes\n"), ESP.getFreeSketchSpace()); - #if not EMBEDDED_WEB + #if ENABLE_SPIFFS FSInfo fs_info; if (SPIFFS.info(fs_info)) { DEBUG_MSG_P(PSTR("File system total size: %d bytes\n"), fs_info.totalBytes); diff --git a/code/espurna/web.ino b/code/espurna/web.ino index b721bb20..803d46ee 100644 --- a/code/espurna/web.ino +++ b/code/espurna/web.ino @@ -999,7 +999,7 @@ void webSetup() { _server->on("/upgrade", HTTP_POST, _onUpgrade, _onUpgradeData); // Serve static files - #if not EMBEDDED_WEB + #if ENABLE_SPIFFS _server->serveStatic("/", SPIFFS, "/") .setLastModified(_last_modified) .setFilter([](AsyncWebServerRequest *request) -> bool {