UX improvements

- add buttons for PixelForge and PixelArt (settings page, below "file system" button
- abort build when PixelForge requested but GIF support missing
- "support" PixelMagic with error message - known issues with bigger images
This commit is contained in:
Frank
2025-12-20 23:55:59 +01:00
parent 855e6737be
commit 37764ec3b9
3 changed files with 33 additions and 4 deletions

View File

@@ -99,6 +99,11 @@
<button type="submit" onclick="window.location='./settings/sync'">Sync Interfaces</button>
<button type="submit" onclick="window.location='./settings/time'">Time &amp; Macros</button>
<button type="submit" onclick="window.location='./settings/sec'">Security &amp; Updates</button>
<br>
<button type="submit" onclick="window.location='./edit'">File System ☾</button> <!--WLEDMM-->
</body>
<button id="pixbtn" style="display:none;" type="submit" onclick="window.location='./pixart.htm'">Pixel Art Converter ☾</button>
<button id="pxmbtn" style="display:none;" type="submit" onclick="window.location='./pxmagic.htm'">Pixel Magic Tool</button>
<button id="forgebtn" style="display:none;" type="submit" onclick="window.location='./pixelforge.htm'">WLED Pixel Forge</button>
<br>
</body>
</html>

View File

@@ -6,14 +6,27 @@
#endif
#include "html_settings.h"
#include "html_other.h"
#ifdef WLED_ENABLE_PIXART
#include "html_pixart.h"
#endif
#ifdef WLED_ENABLE_PIXELFORGE
#ifdef WLED_ENABLE_PXMAGIC
//#include "html_pxmagic.h"
#if !defined(WLED_ENABLE_PIXART)
#error "PIXEL MAGIC Tool is not supported in WLED-MM. Please use Pixel Art Converter instead: add -D WLED_ENABLE_PIXART to your build_flags"
// PIXEL MAGIC has known problems when creating image presets for larger images.
// if you still want to use it, upload pxmagic.htm to your device (<WLED-IP>/edit) and then start <WLED-IP>/pxmagic.htm
#endif
#endif
#if defined(WLED_ENABLE_PIXELFORGE) && !defined(WLED_DISABLE_PIXELFORGE) // WLEDMM uses WLED_ENABLE_PIXELFORGE, upstream has WLED_DISABLE_PIXELFORGE
#include "html_pixelforge.h"
static const char _pixelforge_htm[] PROGMEM = "/pixelforge.htm";
static const char _common_js[] PROGMEM = "/common.js";
#if !defined(WLED_ENABLE_GIF)
#error "GIF image support is missing. Please add -D WLED_ENABLE_GIF to your build flags."
#endif
#endif
#include "html_cpal.h"
// define flash strings once (saves flash memory)
@@ -454,7 +467,7 @@ void initServer()
});
#endif
#ifdef WLED_ENABLE_PIXELFORGE
#if defined(WLED_ENABLE_PIXELFORGE) && !defined(WLED_DISABLE_PIXELFORGE)
server.on(_pixelforge_htm, HTTP_GET, [](AsyncWebServerRequest *request) {
//handleStaticContent(request, FPSTR(_pixelforge_htm), 200, FPSTR(CONTENT_TYPE_HTML), PAGE_pixelforge, PAGE_pixelforge_length);
if (handleFileRead(request, FPSTR(_pixelforge_htm))) return;
@@ -621,7 +634,7 @@ void serveSettingsJS(AsyncWebServerRequest* request)
char buf[SETTINGS_STACK_BUF_SIZE+37] = { '\0' }; // WLEDMM ensure buffer is cleared initially
buf[0] = 0;
#ifdef WLED_ENABLE_PIXELFORGE
#if defined(WLED_ENABLE_PIXELFORGE) && !defined(WLED_DISABLE_PIXELFORGE)
// serve common.js if requested by subPage = 254 (.js)
if (request->url().indexOf(FPSTR(_common_js)) > 0) {
AsyncWebServerResponse *response = request->beginResponse_P(200, FPSTR(CONTENT_TYPE_JAVASCRIPT), JS_common, JS_common_length);

View File

@@ -308,6 +308,17 @@ void getSettingsJS(AsyncWebServerRequest* request, byte subPage, char* dest) //W
#ifdef WLED_ENABLE_DMX // include only if DMX is enabled
oappend(PSTR("gId('dmxbtn').style.display='';"));
#endif
#ifdef WLED_ENABLE_PIXART // include only if PixelArt tool is enabled
oappend(PSTR("gId('pixbtn').style.display='';"));
#endif
#if defined(WLED_ENABLE_PXMAGIC) && !defined(WLED_ENABLE_PIXART) // include only if PixelMagic tool is enabled - only when PixelArt is not enabled
oappend(PSTR("gId('pxmbtn').style.display='';"));
#endif
#if defined(WLED_ENABLE_PIXELFORGE) && !defined(WLED_DISABLE_PIXELFORGE) // include only if PixelForge is enabled
oappend(PSTR("gId('forgebtn').style.display='';"));
#endif
}
if (subPage == 1)