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
This commit is contained in:
Nic Limper
2023-12-30 22:25:04 +01:00
parent b3887b6874
commit e14ec92d48
4 changed files with 93 additions and 26 deletions

View File

@@ -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
}

View File

@@ -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<const uint8_t *>(&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<const uint8_t *>(&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);

View File

@@ -322,8 +322,9 @@
This will probably change in the future.">
<label for="apclock">Lock tag inventory</label>
<select id="apclock">
<option value="1">yes</option>
<option value="0" selected>no</option>
<option value="1">locked: only allows known tags</option>
<option value="2">learning: only add unknown tags that are booting</option>
</select>
</p>
<p title="Wifi transmit power">

View File

@@ -8,31 +8,68 @@
<body>
<h3>demo upload form</h3>
<p>You can use this as an example how to push images to a tag by an external server/script.</p>
<p>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.</p>
<p>
<form method="POST" enctype="multipart/form-data" action="/imgupload">
<form method="POST" enctype="multipart/form-data" action="/imgupload">
<p>
<p>
<label for="mac">Enter a 6 or 8 byte MAC address:</label><br>
<input type="text" id="mac" name="mac">
</p>
</p>
<p>
<label for="dither">Floyd Steinberg dithering (0=off, 1=on)</label><br>
<input type="text" id="dither" name="dither">
</p>
<p>
<label for="image">Select an image to upload. Must have the correct resolution for the tag (rotating is allowed):</label><br>
<p>
<label for="image">Select an image to upload. Must have the correct resolution for the tag (rotating is
allowed):</label><br>
<input type="file" id="image" name="file">
</p>
</p>
<p>
<p>
<label for="dither">optional: Floyd Steinberg dithering (0=off, 1=on). Default: on</label><br>
<input type="text" id="dither" name="dither">
</p>
<!--
<p>
Only use the options below in special cases:
</p>
<p>
<label for="previewtype">optional: Preload type to send to tag, for later recall, or special use</label><br>
<input type="text" id="previewtype" name="previewtype">
</p>
<p>
<label for="previewlut">optional: Triggered preload images will display with this LUT</label><br>
<input type="text" id="previewlut" name="previewlut">
</p>
-->
<p>
<input type="submit" value="Upload">
</p>
</p>
</form>
<!--
previewtype:
"0": Normal,
"1": UI: Splash Screen,
"2": UI: Lost connection,
"3": UI: AP Found,
"4": UI: No AP Found,
"5": UI: Long Term Sleep,
"15": Slideshow image,
"16": Wake: Button 1,
"17": Wake: Button 2,
"29": Wake: GPIO,
"30": Wake: NFC
previewlut:
"0": Default,
"1": No Repeats,
"2": Fast No Reds,
"3": Fast
-->
</form>
</p>
</body>
</html>
</html>