From 23f35a76eadf9ce71cc844e5569bf4220d0150fe Mon Sep 17 00:00:00 2001 From: Christian Schwinne Date: Tue, 19 Mar 2024 22:39:33 +0100 Subject: [PATCH 01/33] Update pio version --- requirements.txt | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 1c0644f98e..337fc330f5 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,11 +1,9 @@ # -# This file is autogenerated by pip-compile with Python 3.12 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # pip-compile # -aiofiles==22.1.0 - # via platformio ajsonrpc==1.2.0 # via platformio anyio==3.6.2 @@ -36,7 +34,7 @@ marshmallow==3.19.0 # via platformio packaging==23.1 # via marshmallow -platformio==6.1.6 +platformio==6.1.11 # via -r requirements.in pyelftools==0.29 # via platformio From 95b25ce5269a5e495c571e4aeaf7ba7f093158e1 Mon Sep 17 00:00:00 2001 From: Christian Schwinne Date: Tue, 19 Mar 2024 22:53:43 +0100 Subject: [PATCH 02/33] Include gif library for all esp32 variants --- platformio.ini | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/platformio.ini b/platformio.ini index 9a77b71402..2ea08fcd84 100644 --- a/platformio.ini +++ b/platformio.ini @@ -205,6 +205,12 @@ lib_deps = ESPAsyncUDP ${env.lib_deps} +[esp32_all_variants] +lib_deps = + https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 + bitbank2/AnimatedGIF@^1.4.7 + https://github.com/Aircoookie/GifDecoder#bc3af18 + [esp32] #platform = https://github.com/tasmota/platform-espressif32/releases/download/v2.0.2.3/platform-espressif32-2.0.2.3.zip platform = espressif32@3.5.0 @@ -219,9 +225,7 @@ build_flags = -g default_partitions = tools/WLED_ESP32_4MB_1MB_FS.csv lib_deps = https://github.com/lorol/LITTLEFS.git - https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 - bitbank2/AnimatedGIF@^1.4.7 - https://github.com/Aircoookie/GifDecoder#bc3af18 + ${esp32_all_variants.lib_deps} ${env.lib_deps} # additional build flags for audioreactive AR_build_flags = -D USERMOD_AUDIOREACTIVE @@ -243,7 +247,7 @@ build_flags = -g -DARDUINO_USB_CDC_ON_BOOT=0 ;; this flag is mandatory for "classic ESP32" when building with arduino-esp32 >=2.0.3 default_partitions = tools/WLED_ESP32_4MB_1MB_FS.csv lib_deps = - https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 + ${esp32_all_variants.lib_deps} ${env.lib_deps} [esp32s2] @@ -262,7 +266,7 @@ build_flags = -g ;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry: ;; ARDUINO_USB_CDC_ON_BOOT lib_deps = - https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 + ${esp32_all_variants.lib_deps} ${env.lib_deps} [esp32c3] @@ -279,7 +283,7 @@ build_flags = -g ;; please make sure that the following flags are properly set (to 0 or 1) by your board.json, or included in your custom platformio_override.ini entry: ;; ARDUINO_USB_CDC_ON_BOOT lib_deps = - https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 + ${esp32_all_variants.lib_deps} ${env.lib_deps} [esp32s3] @@ -298,7 +302,7 @@ build_flags = -g ;; ARDUINO_USB_MODE, ARDUINO_USB_CDC_ON_BOOT lib_deps = - https://github.com/pbolduc/AsyncTCP.git @ 1.2.0 + ${esp32_all_variants.lib_deps} ${env.lib_deps} From 028b77d3f79a1fb9d8a2a96c8ff57574c61ba12d Mon Sep 17 00:00:00 2001 From: Christian Schwinne Date: Sat, 13 Apr 2024 20:06:33 +0200 Subject: [PATCH 03/33] Proper debug statements --- wled00/image_loader.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wled00/image_loader.cpp b/wled00/image_loader.cpp index 7569a18c5b..31a84e6601 100644 --- a/wled00/image_loader.cpp +++ b/wled00/image_loader.cpp @@ -101,9 +101,9 @@ byte renderImageToSegment(Segment &seg) { decoder.setFileReadBlockCallback(fileReadBlockCallback); decoder.setFileSizeCallback(fileSizeCallback); decoder.alloc(); - Serial.println("Starting decoding"); + DEBUG_PRINTLN(F("Starting decoding")); if(decoder.startDecoding() < 0) { gifDecodeFailed = true; return IMAGE_ERROR_GIF_DECODE; } - Serial.println("Decoding started"); + DEBUG_PRINTLN(F("Decoding started")); } if (gifDecodeFailed) return IMAGE_ERROR_PREV; @@ -131,14 +131,14 @@ byte renderImageToSegment(Segment &seg) { } void endImagePlayback(Segment *seg) { - Serial.println("Image playback end called"); + DEBUG_PRINTLN(F("Image playback end called")); if (!activeSeg || activeSeg != seg) return; if (file) file.close(); decoder.dealloc(); gifDecodeFailed = false; activeSeg = nullptr; lastFilename[1] = '\0'; - Serial.println("Image playback ended"); + DEBUG_PRINTLN(F("Image playback ended")); } #endif \ No newline at end of file From 79790e88b9950d9c4fb6925b3cf9ac50bf3aa919 Mon Sep 17 00:00:00 2001 From: Manuel Piroch Date: Sun, 21 Apr 2024 06:16:27 -0300 Subject: [PATCH 04/33] add gifplayer.htm --- tools/cdata.js | 3 +- wled00/data/gifplayer/gifplayer.htm | 1132 +++++++++++++++++++++++++++ wled00/wled_server.cpp | 10 + 3 files changed, 1144 insertions(+), 1 deletion(-) create mode 100644 wled00/data/gifplayer/gifplayer.htm diff --git a/tools/cdata.js b/tools/cdata.js index 12dda1cbe0..45a16b2e0d 100644 --- a/tools/cdata.js +++ b/tools/cdata.js @@ -26,7 +26,7 @@ const packageJson = require("../package.json"); // Export functions for testing module.exports = { isFileNewerThan, isAnyFileInFolderNewerThan }; -const output = ["wled00/html_ui.h", "wled00/html_pixart.h", "wled00/html_cpal.h", "wled00/html_pxmagic.h", "wled00/html_settings.h", "wled00/html_other.h"] +const output = ["wled00/html_ui.h", "wled00/html_pixart.h", "wled00/html_cpal.h", "wled00/html_pxmagic.h", "wled00/html_gifplayer.h", "wled00/html_settings.h", "wled00/html_other.h"] // \x1b[34m is blue, \x1b[36m is cyan, \x1b[0m is reset const wledBanner = ` @@ -239,6 +239,7 @@ writeHtmlGzipped("wled00/data/index.htm", "wled00/html_ui.h", 'index'); writeHtmlGzipped("wled00/data/pixart/pixart.htm", "wled00/html_pixart.h", 'pixart'); writeHtmlGzipped("wled00/data/cpal/cpal.htm", "wled00/html_cpal.h", 'cpal'); writeHtmlGzipped("wled00/data/pxmagic/pxmagic.htm", "wled00/html_pxmagic.h", 'pxmagic'); +writeHtmlGzipped("wled00/data/gifplayer/gifplayer.htm", "wled00/html_gifplayer.h", 'gifplayer'); writeChunks( "wled00/data", diff --git a/wled00/data/gifplayer/gifplayer.htm b/wled00/data/gifplayer/gifplayer.htm new file mode 100644 index 0000000000..4c011698e9 --- /dev/null +++ b/wled00/data/gifplayer/gifplayer.htm @@ -0,0 +1,1132 @@ + + + + + + GIF Player + + + + +
+
+
+ GIFPLAYER +
+
+
+
+
+ +
+
+ +
+
+ +
+
+
+ + +
+
+ +

+ +
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ + + diff --git a/wled00/wled_server.cpp b/wled00/wled_server.cpp index d184e98789..632047f7f0 100644 --- a/wled00/wled_server.cpp +++ b/wled00/wled_server.cpp @@ -9,6 +9,9 @@ #ifndef WLED_DISABLE_PXMAGIC #include "html_pxmagic.h" #endif +#ifndef WLED_DISABLE_GIFPLAYER + #include "html_gifplayer.h" +#endif #include "html_cpal.h" // define flash strings once (saves flash memory) @@ -455,6 +458,13 @@ void initServer() }); #endif +#ifndef WLED_DISABLE_GIFPLAYER + static const char _gifplayer_htm[] PROGMEM = "/gifplayer.htm"; + server.on(_gifplayer_htm, HTTP_GET, [](AsyncWebServerRequest *request) { + handleStaticContent(request, FPSTR(_gifplayer_htm), 200, FPSTR(CONTENT_TYPE_HTML), PAGE_gifplayer, PAGE_gifplayer_L); + }); +#endif + static const char _cpal_htm[] PROGMEM = "/cpal.htm"; server.on(_cpal_htm, HTTP_GET, [](AsyncWebServerRequest *request) { handleStaticContent(request, FPSTR(_cpal_htm), 200, FPSTR(CONTENT_TYPE_HTML), PAGE_cpal, PAGE_cpal_L); From c3869db6b0c5e363ae25abe49b9e9318d499fd8d Mon Sep 17 00:00:00 2001 From: Manuel Piroch Date: Sun, 21 Apr 2024 14:16:09 -0300 Subject: [PATCH 05/33] add GIF button in palettes pane --- wled00/data/index.htm | 1 + 1 file changed, 1 insertion(+) diff --git a/wled00/data/index.htm b/wled00/data/index.htm index 4a532abb7a..f96a20ae8b 100644 --- a/wled00/data/index.htm +++ b/wled00/data/index.htm @@ -126,6 +126,7 @@
+ From a7dc69e5684c37205584d066a2fc804b7c1486dc Mon Sep 17 00:00:00 2001 From: Manuel Piroch Date: Sun, 21 Apr 2024 14:33:10 -0300 Subject: [PATCH 06/33] small fixes - loading spinner now showing on upload - hostname value now trimmed and checked for change before refresh - remove invisible upload button --- wled00/data/gifplayer/gifplayer.htm | 35 ++++++++--------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/wled00/data/gifplayer/gifplayer.htm b/wled00/data/gifplayer/gifplayer.htm index 4c011698e9..6e7e4039ad 100644 --- a/wled00/data/gifplayer/gifplayer.htm +++ b/wled00/data/gifplayer/gifplayer.htm @@ -574,18 +574,6 @@ style="display: none" />
-
-
- -
@@ -952,24 +940,30 @@

method: "POST", body: formData, }; + showLoading(); try { const response = await fetch(url, options); if (!response.ok) { throw new Error(response.status); } toast(`${file.name} successfully uploaded`, "success"); - images(); - storage(); } catch (error) { const msg = `Error uploading image: ${error}`; console.error(msg); toast(msg, "error"); + } finally { + await images(); + await storage(); + hideLoading(); } } // reload all info on change of hostname input hostname.addEventListener("blur", async () => { - WLED_URL = `${protocol}//${hostname.value}`; + hostname.value = hostname.value.trim(); + newWledUrl = `${protocol}//${hostname.value}`; + if (WLED_URL == newWledUrl) { return; } + WLED_URL = newWledUrl // replace url in browser var url = window.location.protocol + @@ -1000,8 +994,6 @@

false ); - gId("btnUpload").addEventListener("click", upload, false); - gId("dropzone").addEventListener("dragover", (e) => { e.preventDefault(); }); @@ -1015,8 +1007,6 @@

source.files = e.dataTransfer.files; const { name } = source.files[0]; - // gId("dropzoneLabel").textContent = `Image ${name} selected!`; - btnUpload.removeAttribute("disabled"); upload(); }); @@ -1033,14 +1023,7 @@

return; } const { name } = e.target.files[0]; - // dropzoneLabel.textContent = `Image ${name} selected!`; - btnUpload.removeAttribute("disabled"); - console.log("test"); upload(); - } else { - // dropzoneLabel.textContent = - // "Drag and drop a file here or click to select a file"; - btnUpload.setAttribute("disabled", ""); } }); From d45409c9b193ada067d62caccffd2e3d71c5744f Mon Sep 17 00:00:00 2001 From: Manuel Piroch Date: Sun, 21 Apr 2024 16:55:15 -0300 Subject: [PATCH 07/33] show ID of saved preset --- wled00/data/gifplayer/gifplayer.htm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wled00/data/gifplayer/gifplayer.htm b/wled00/data/gifplayer/gifplayer.htm index 6e7e4039ad..831c47d7ec 100644 --- a/wled00/data/gifplayer/gifplayer.htm +++ b/wled00/data/gifplayer/gifplayer.htm @@ -915,7 +915,7 @@

const { success } = await response.json(); if (success) { - toast("Request sent successfully"); + toast(`Saved as preset with ID ${id}`); window.parent.postMessage("loadPresets", WLED_URL); } } catch (error) { From 9747e61cc618bfdfc4508445d5c393377adb7934 Mon Sep 17 00:00:00 2001 From: Manuel Piroch Date: Wed, 24 Apr 2024 11:08:40 -0300 Subject: [PATCH 08/33] turn hostname red on error, reduce connection timeouts --- wled00/data/gifplayer/gifplayer.htm | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/wled00/data/gifplayer/gifplayer.htm b/wled00/data/gifplayer/gifplayer.htm index 831c47d7ec..a2da51325b 100644 --- a/wled00/data/gifplayer/gifplayer.htm +++ b/wled00/data/gifplayer/gifplayer.htm @@ -221,6 +221,10 @@ text-align: center; } + #hostname.error { + color: var(--error-light); + } + .dropzone { border: 1px dashed var(--gray-light); background-color: var(--gray-dark); @@ -574,7 +578,6 @@ style="display: none" /> - @@ -718,50 +725,6 @@

- -
-

Settings

- -
-
- - -
-
-
-
- -
-
- -
-
- -
-
-
-