diff --git a/html/accesspoint.html b/data/accesspoint.html similarity index 100% rename from html/accesspoint.html rename to data/accesspoint.html diff --git a/html/accesspoint_EN.html b/data/accesspoint_EN.html similarity index 100% rename from html/accesspoint_EN.html rename to data/accesspoint_EN.html diff --git a/html/management.html b/data/management.html similarity index 100% rename from html/management.html rename to data/management.html diff --git a/html/management_EN.html b/data/management_EN.html similarity index 100% rename from html/management_EN.html rename to data/management_EN.html diff --git a/src/HTMLaccesspoint.h b/src/HTMLaccesspoint.h deleted file mode 100644 index b3a5b4eb..00000000 --- a/src/HTMLaccesspoint.h +++ /dev/null @@ -1,64 +0,0 @@ -static const char accesspoint_HTML[] PROGMEM = "\ -\ - \ - WLAN-Einrichtung\ - \ - \ - \ -
\ -

WLAN-Einrichtung

\ -
\ -
\ -
\ -
\ -
\ -

\ - \ -
\ -
\ -

Fertig?

\ - \ -
\ - \ -"; \ No newline at end of file diff --git a/src/HTMLaccesspoint_EN.h b/src/HTMLaccesspoint_EN.h deleted file mode 100644 index 3b91c1da..00000000 --- a/src/HTMLaccesspoint_EN.h +++ /dev/null @@ -1,64 +0,0 @@ -static const char accesspoint_HTML[] PROGMEM = "\ -\ - \ - WiFi-configuration\ - \ - \ - \ -
\ -

WiFi-configuration

\ -
\ -
\ -
\ -
\ -
\ -

\ - \ -
\ -
\ -

Ready to go?

\ - \ -
\ - \ -"; \ No newline at end of file diff --git a/src/HTMLmanagement.h b/src/HTMLmanagement.h deleted file mode 100644 index 31266203..00000000 --- a/src/HTMLmanagement.h +++ /dev/null @@ -1,1138 +0,0 @@ -static const char management_HTML[] PROGMEM = "\ -\ -\ - ESPuino-Konfiguration\ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ -\ -\ -\ -
\ - \ -
\ -
\ -
\ -
\ -
\ -
\ -\ -
\ - \ -
\ -
\ - \ -
\ -\ -
\ -
\ -
\ -
\ -
\ -
\ -
\ - \ - \ -
\ - Bitte SSID des WLANs eintragen.\ -
\ - \ - \ - \ - \ -
\ -
\ -
\ - \ - \ -
\ -
\ -
\ -
\ -
\ -
\ -
\ - RFID-Zuweisungen\ -
\ -
\ - \ - \ - \ - \ -
\ -
\ -
\ -
\ - Dateiliste aktualisieren\ -
\ -
\ -
\ -
\ -


Der Prozess kann mehrere Minuten dauern...
\ -
\ -
\ -
\ -
\ - \ - \ -
\ -
\ -
\ - \ - \ -
\ -
\ -
\ -
\ -\ -
\ -
\ -
\ -
\ - RFID-Modifkationen\ -
\ -
\ - \ - \ -
\ - Bitte eine 12-stellige Zahl eingeben.\ -
\ - \ - \ -
\ -
\ -
\ - \ - \ -
\ -
\ -
\ -
\ -
\ -
\ -
\ -\ -
\ -
\ - \ - \ -
\ -
\ - \ - \ - \ - \ - \ - \ -
\ -
\ -
\ - \ - \ -
\ -
\ -
\ -
\ -
\ -
\ -\ -
\ -
\ - \ - \ - \ - \ -
\ -
\ -
\ - \ - \ -
\ -
\ -
\ -
\ -\ -
\ -
\ -\ -
\ -
\ -
\ - Lautstärke\ - \ -
\ -
\ -
\ - \ -
\ - \ -
\ -
\ - \ -
\ - \ -
\ -
\ -
\ -
\ -
\ -
\ - Neopixel (Helligkeit)\ - \ -
\ - \ - \ -
\ -\ - \ -
\ - \ -
\ -
\ -
\ -
\ -
\ -
\ - Deep Sleep\ -\ - \ -
\ -
\ -
\ -
\ -\ -
\ -
\ - Batterie\ -
Status über Neopixel anzeigen
\ -
\ - \ -
\ - \ -
\ -
\ - \ -
\ - \ -
\ -
\ - \ -\ -
\ - \ -
\ -\ -
\ - \ -
\ - \ -
\ -\ -
\ -
\ -
\ -
\ - \ - \ -
\ -
\ -
\ -
\ -
\ -
\ -

NVS-Importer

\ -
\ -
\ - \ - \ -
\ -
\ -
\ - \ -
\ -
\ -
\ -
\ -
\ -\ -\ -\ -"; \ No newline at end of file diff --git a/src/HTMLmanagement_EN.h b/src/HTMLmanagement_EN.h deleted file mode 100644 index 2fe7933c..00000000 --- a/src/HTMLmanagement_EN.h +++ /dev/null @@ -1,728 +0,0 @@ -static const char management_HTML[] PROGMEM = "\ -\ -\ - ESPuino-configuration\ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ - \ -\ -\ -\ -
\ - \ -
\ -
\ -
\ -
\ -
\ -
\ - \ - \ -
\ - Please enter WiFi's SSID.\ -
\ - \ - \ - \ - \ -
\ -
\ -
\ - \ - \ -
\ -
\ -
\ -
\ -
\ -
\ -
\ - RFID-assignments\ -
\ -
\ - \ - \ - \ - \ -
\ -
\ -
\ -
\ - Refresh indexfile\ -
\ -
\ -
\ -
\ -


This could take while...
\ -
\ -
\ -
\ -
\ - \ - \ -
\ -
\ -
\ - \ - \ -
\ -
\ -
\ -
\ -\ -
\ -
\ -
\ -
\ - RFID-modifications\ -
\ -
\ - \ - \ -
\ - Please enter 12-digits-number.\ -
\ - \ - \ -
\ -
\ -
\ - \ - \ -
\ -
\ -
\ -
\ -
\ -
\ -
\ -\ -
\ -
\ - \ - \ -
\ -
\ - \ - \ - \ - \ - \ - \ -
\ -
\ -
\ - \ - \ -
\ -
\ -
\ -
\ -
\ -
\ -\ -
\ -
\ - \ - \ - \ - \ -
\ -
\ -
\ - \ - \ -
\ -
\ -
\ -
\ -\ -
\ -
\ -\ -
\ -
\ -
\ - Volume\ - \ -
\ -
\ -
\ - \ -
\ - \ -
\ -
\ - \ -
\ - \ -
\ -
\ -
\ -
\ -
\ -
\ - Neopixel (brightness)\ - \ -
\ - \ - \ -
\ -\ - \ -
\ - \ -
\ -
\ -
\ -
\ -
\ -
\ - Deep Sleep\ -\ - \ -
\ -
\ -
\ -
\ -\ -
\ -
\ - Battery\ -
Status via Neopixel
\ -
\ - \ -
\ - \ -
\ -
\ - \ -
\ - \ -
\ -
\ - \ -\ -
\ - \ -
\ -\ -
\ - \ -
\ - \ -
\ -\ -
\ -
\ -
\ -
\ - \ - \ -
\ -
\ -
\ -
\ -
\ -
\ -

NVS-Importer

\ -
\ -
\ - \ - \ -
\ -
\ -
\ - \ -
\ -
\ -
\ -
\ -
\ -\ -\ -\ -"; \ No newline at end of file diff --git a/src/logmessages.h b/src/logmessages.h index f11357fd..f6e93c73 100644 --- a/src/logmessages.h +++ b/src/logmessages.h @@ -172,4 +172,6 @@ static const char freeHeapAfterSetup[] PROGMEM = "Freier Heap-Speicher nach Setu static const char tryStaticIpConfig[] PROGMEM = "Statische IP-Konfiguration wird durchgeführt..."; static const char staticIPConfigFailed[] PROGMEM = "Statische IP-Konfiguration fehlgeschlagen"; static const char wakeUpRfidNoIso14443[] PROGMEM = "ESP32 wurde vom Kartenleser aus dem Deepsleep aufgeweckt. Allerdings wurde keine ISO-14443-Karte gefunden. Gehe zurück in den Deepsleep..."; -static const char lowPowerCardSuccess[] PROGMEM = "Kartenerkennung via 'low power' erfolgreich durchgeführt"; \ No newline at end of file +static const char lowPowerCardSuccess[] PROGMEM = "Kartenerkennung via 'low power' erfolgreich durchgeführt"; + +static const char HTML_NOT_FOUND_ERROR[] PROGMEM = "Fehler: Kann HTML Dateien nicht finden. Vielleicht wurde \"Upload Filesystem Image\" vergessen?"; \ No newline at end of file diff --git a/src/logmessages_EN.h b/src/logmessages_EN.h index 691481bb..82500bfd 100644 --- a/src/logmessages_EN.h +++ b/src/logmessages_EN.h @@ -172,4 +172,6 @@ static const char freeHeapAfterSetup[] PROGMEM = "Free heap after setup"; static const char tryStaticIpConfig[] PROGMEM = "Performing static IP-configuration..."; static const char staticIPConfigFailed[] PROGMEM = "Static IP-configuration failed"; static const char wakeUpRfidNoIso14443[] PROGMEM = "Wakeup caused by low power card-detection. RF-field changed but no ISO-14443 card on reader was found. So I'll return back to sleep now..."; -static const char lowPowerCardSuccess[] PROGMEM = "Switch to low power card-detection: success"; \ No newline at end of file +static const char lowPowerCardSuccess[] PROGMEM = "Switch to low power card-detection: success"; + +static const char HTML_NOT_FOUND_ERROR[] PROGMEM = "ERROR: Could not find HTML files in SPIFFS. Maybe you forgot to \"Upload Filesystem Image\"."; \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 6ce4bfb8..ac9945ca 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -59,20 +59,20 @@ #if (LANGUAGE == 1) #include "logmessages.h" - #include "HTMLmanagement.h" - #include "HTMLaccesspoint.h" + #define MANAGEMENT_HTML_PATH "/management.html" + #define ACCESSPOINT_HTML_PATH "/accesspoint.html" #endif #if (LANGUAGE == 2) #include "logmessages_EN.h" - #include "HTMLmanagement_EN.h" - #include "HTMLaccesspoint_EN.h" + #define MANAGEMENT_HTML_PATH "/management_EN.html" + #define ACCESSPOINT_HTML_PATH "/accesspoint_EN.html" #endif #include #include #include #include - +#include #include "freertos/ringbuf.h" @@ -3125,7 +3125,11 @@ void accessPointStart(const char *SSID, IPAddress ip, IPAddress netmask) { loggerNl(logBuf, LOGLEVEL_NOTICE); wServer.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ - request->send_P(200, "text/html", accesspoint_HTML); + if (SPIFFS.exists(ACCESSPOINT_HTML_PATH)) { + request->send(SPIFFS, ACCESSPOINT_HTML_PATH, "text/html"); + } else { + request->send(200, "text/plain", HTML_NOT_FOUND_ERROR); + } }); wServer.on("/init", HTTP_POST, [] (AsyncWebServerRequest *request) { @@ -3137,7 +3141,12 @@ void accessPointStart(const char *SSID, IPAddress ip, IPAddress netmask) { prefsSettings.putString("Password", request->getParam("pwd", true)->value()); prefsSettings.putString("Hostname", request->getParam("hostname", true)->value()); } - request->send_P(200, "text/html", accesspoint_HTML); + if (SPIFFS.exists(ACCESSPOINT_HTML_PATH)) { + request->send(SPIFFS, ACCESSPOINT_HTML_PATH, "text/html"); + } else { + request->send(200, "text/plain", HTML_NOT_FOUND_ERROR); + } + }); wServer.on("/restart", HTTP_GET, [] (AsyncWebServerRequest *request) { @@ -3654,7 +3663,11 @@ void webserverStart(void) { // Default wServer.on("/", HTTP_GET, [](AsyncWebServerRequest *request) { - request->send_P(200, "text/html", management_HTML, templateProcessor); + if (SPIFFS.exists(MANAGEMENT_HTML_PATH)) { + request->send(SPIFFS, MANAGEMENT_HTML_PATH, "text/html", false, templateProcessor); + } else { + request->send(200, "text/plain", HTML_NOT_FOUND_ERROR); + } }); // NVS-backup-upload @@ -4655,6 +4668,11 @@ void setup() { createFile(FSystem,DIRECTORY_INDEX_FILE,"[]"); esp_deep_sleep_start(); } + + if (!SPIFFS.begin()) { + Serial.println("Error mounting SPIFFS, please upload filesystem!"); + } + bootComplete = true; snprintf(logBuf, serialLoglength, "%s: %u", (char *) FPSTR(freeHeapAfterSetup), ESP.getFreeHeap());