diff --git a/Code/fw/firmware.bin b/Code/fw/firmware.bin index a93f292c..d9859b92 100644 Binary files a/Code/fw/firmware.bin and b/Code/fw/firmware.bin differ diff --git a/Code/fw/version.txt b/Code/fw/version.txt index dab7b4c0..273787f5 100644 --- a/Code/fw/version.txt +++ b/Code/fw/version.txt @@ -1 +1 @@ -2023-05-02-1000 \ No newline at end of file +2023-05-08-1052 \ No newline at end of file diff --git a/Code/src/config.h b/Code/src/config.h index 99fab7dd..9f41c00e 100644 --- a/Code/src/config.h +++ b/Code/src/config.h @@ -5,7 +5,7 @@ #include #endif #define DEVICE_NAME "layzspa" -#define FW_VERSION "2023-05-02-1000" +#define FW_VERSION "2023-05-08-1052" #define HA_PREFIX "homeassistant" #define PROM_NAMESPACE "layzspa" diff --git a/Code/src/main.cpp b/Code/src/main.cpp index 1c923c5f..195955d2 100644 --- a/Code/src/main.cpp +++ b/Code/src/main.cpp @@ -680,13 +680,13 @@ void handleNotFound() String getContentType(const String& filename) { - if (filename.endsWith(".html")) return "text/html"; - else if (filename.endsWith(".css")) return "text/css"; - else if (filename.endsWith(".js")) return "application/javascript"; - else if (filename.endsWith(".ico")) return "image/x-icon"; - else if (filename.endsWith(".gz")) return "application/x-gzip"; - else if (filename.endsWith(".json")) return "application/json"; - return "text/plain"; + if (filename.endsWith(".html")) return F("text/html"); + else if (filename.endsWith(".css")) return F("text/css"); + else if (filename.endsWith(".js")) return F("application/javascript"); + else if (filename.endsWith(".ico")) return F("image/x-icon"); + else if (filename.endsWith(".gz")) return F("application/x-gzip"); + else if (filename.endsWith(".json")) return F("application/json"); + return F("text/plain"); } /** @@ -712,12 +712,14 @@ bool handleFileRead(String path) String pathWithGz = path + ".gz"; if (LittleFS.exists(pathWithGz) || LittleFS.exists(path)) { // If the file exists, either as a compressed archive, or normal if (LittleFS.exists(pathWithGz)) // If there's a compressed version available - path += ".gz"; // Use the compressed version + path += ".gz"; // Use the compressed version File file = LittleFS.open(path, "r"); // Open the file - // size_t sent = server.streamFile(file, contentType); // Send it to the client - server.streamFile(file, contentType); // Send it to the client + size_t fsize = file.size(); + size_t sent = server.streamFile(file, contentType); // Send it to the client + // server.streamFile(file, contentType); // Send it to the client file.close(); // Close the file again - // Serial.println("HTTP > file sent: " + path + " (" + sent + " bytes)"); + Serial.println(F("File size: ") + String(fsize)); + Serial.println(F("HTTP > file sent: ") + path + F(" (") + sent + F(" bytes)")); return true; } // Serial.println("HTTP > file not found: " + path); // If the file doesn't exist, return false