From e14ec92d488573daed00d20675515775ad870deb Mon Sep 17 00:00:00 2001
From: Nic Limper
Date: Sat, 30 Dec 2023 22:25:04 +0100
Subject: [PATCH] optional previewtype and previewlut parameters for /imgupload
call
- optional previewtype and previewlut parameters for /imgupload call
- new 35.json for M3 6.0" (no template yet; coming up next)
- updated upload-demo.html
---
ESP32_AP-Flasher/data/tagtypes/35.json | 16 ++++++
ESP32_AP-Flasher/src/web.cpp | 31 +++++++---
ESP32_AP-Flasher/wwwroot/index.html | 3 +-
ESP32_AP-Flasher/wwwroot/upload-demo.html | 69 +++++++++++++++++------
4 files changed, 93 insertions(+), 26 deletions(-)
create mode 100644 ESP32_AP-Flasher/data/tagtypes/35.json
diff --git a/ESP32_AP-Flasher/data/tagtypes/35.json b/ESP32_AP-Flasher/data/tagtypes/35.json
new file mode 100644
index 00000000..97bdd96c
--- /dev/null
+++ b/ESP32_AP-Flasher/data/tagtypes/35.json
@@ -0,0 +1,16 @@
+{
+ "name": "EL060H3WRA 6.0\"",
+ "width": 600,
+ "height": 448,
+ "rotatebuffer": 0,
+ "bpp": 2,
+ "colors": 3,
+ "colortable": {
+ "white": [255, 255, 255],
+ "black": [0, 0, 0],
+ "red": [255, 0, 0],
+ "gray": [150, 150, 150]
+ },
+ "contentids": [ 0, 1, 2, 3, 4, 8, 16, 9, 7, 19, 10, 11, 21 ],
+ "usetemplate": 1
+}
diff --git a/ESP32_AP-Flasher/src/web.cpp b/ESP32_AP-Flasher/src/web.cpp
index cc22fe19..6b06aa5a 100644
--- a/ESP32_AP-Flasher/src/web.cpp
+++ b/ESP32_AP-Flasher/src/web.cpp
@@ -354,12 +354,15 @@ void init_web() {
flashData.color1 = 0x3C; // green
flashData.color2 = 0xE4; // red
flashData.color3 = 0x03; // blue
- flashData.flashCount1 = 1;
- flashData.flashCount2 = 1;
- flashData.flashCount3 = 1;
+ flashData.flashCount1 = 3;
+ flashData.flashCount2 = 3;
+ flashData.flashCount3 = 3;
flashData.delay1 = 10;
flashData.delay2 = 10;
flashData.delay3 = 10;
+ flashData.flashSpeed1 = 1;
+ flashData.flashSpeed2 = 5;
+ flashData.flashSpeed3 = 10;
flashData.repeats = 2;
const uint8_t *payload = reinterpret_cast(&flashData);
sendTagCommand(mac, CMD_DO_LEDFLASH, !taginfo->isExternal, payload);
@@ -367,12 +370,12 @@ void init_web() {
if (strcmp(cmdValue, "ledflash_long") == 0) {
struct ledFlash flashData = {0};
flashData.mode = 1;
- flashData.flashDuration = 15;
+ flashData.flashDuration = 1;
flashData.color1 = 0xE4; // red
- flashData.flashCount1 = 5;
- flashData.delay1 = 5;
- flashData.delay3 = 15;
- flashData.repeats = 10;
+ flashData.flashCount1 = 3;
+ flashData.flashSpeed1 = 3;
+ flashData.delay1 = 50;
+ flashData.repeats = 60;
const uint8_t *payload = reinterpret_cast(&flashData);
sendTagCommand(mac, CMD_DO_LEDFLASH, !taginfo->isExternal, payload);
}
@@ -711,7 +714,17 @@ void doImageUpload(AsyncWebServerRequest *request, String filename, size_t index
if (request->hasParam("ttl", true)) {
ttl = request->getParam("ttl", true)->value().toInt();
}
- taginfo->modeConfigJson = "{\"filename\":\"" + dst + ".jpg\",\"timetolive\":\"" + String(ttl) + "\",\"dither\":\"" + String(dither) + "\",\"delete\":\"1\"}";
+ uint8_t preload = 0;
+ uint8_t preloadlut = 0;
+ uint8_t preloadtype = 0;
+ if (request->hasParam("preloadtype", true)) {
+ preload = 1;
+ preloadtype = request->getParam("preloadtype", true)->value().toInt();
+ if (request->hasParam("preloadlut", true)) {
+ preloadlut = request->getParam("preloadlut", true)->value().toInt();
+ }
+ }
+ taginfo->modeConfigJson = "{\"filename\":\"" + dst + ".jpg\",\"timetolive\":\"" + String(ttl) + "\",\"dither\":\"" + String(dither) + "\",\"delete\":\"1\", \"preload\":\"" + String(preload) + "\", \"preload_lut\":\"" + String(preloadlut) + "\", \"preload_type\":\"" + String(preloadtype) + "\"}";
taginfo->contentMode = 0;
taginfo->nextupdate = 0;
wsSendTaginfo(mac, SYNC_USERCFG);
diff --git a/ESP32_AP-Flasher/wwwroot/index.html b/ESP32_AP-Flasher/wwwroot/index.html
index c5306387..23d4fc8b 100644
--- a/ESP32_AP-Flasher/wwwroot/index.html
+++ b/ESP32_AP-Flasher/wwwroot/index.html
@@ -322,8 +322,9 @@
This will probably change in the future.">
diff --git a/ESP32_AP-Flasher/wwwroot/upload-demo.html b/ESP32_AP-Flasher/wwwroot/upload-demo.html
index 8e45ec2b..33ce9b21 100644
--- a/ESP32_AP-Flasher/wwwroot/upload-demo.html
+++ b/ESP32_AP-Flasher/wwwroot/upload-demo.html
@@ -8,31 +8,68 @@
demo upload form
- You can use this as an example how to push images to a tag by an external server/script.
+ You can use this as an example how to push images to a tag by an external server/script. Look at the html source of this page for parameters.
-
+
+
+
-