diff --git a/ESP32_AP-Flasher/data/tagtypes/00.json b/ESP32_AP-Flasher/data/tagtypes/00.json index 27035fcc..06ac5999 100644 --- a/ESP32_AP-Flasher/data/tagtypes/00.json +++ b/ESP32_AP-Flasher/data/tagtypes/00.json @@ -11,7 +11,8 @@ "red": [255, 0, 0], "gray": [150, 150, 150] }, - "capabilities": ["button", "customlut"], + "shortlut": 2, + "options": ["button", "customlut"], "template": { "1": { "weekday": [ 76, 10, "fonts/calibrib30" ], diff --git a/ESP32_AP-Flasher/data/tagtypes/01.json b/ESP32_AP-Flasher/data/tagtypes/01.json index a6c64715..b6458ea1 100644 --- a/ESP32_AP-Flasher/data/tagtypes/01.json +++ b/ESP32_AP-Flasher/data/tagtypes/01.json @@ -11,7 +11,8 @@ "red": [255, 0, 0], "gray": [150, 150, 150] }, - "capabilities": ["button", "customlut"], + "shortlut": 2, + "options": ["button", "customlut"], "template": { "1": { "weekday": [148, 10, "fonts/calibrib60"], diff --git a/ESP32_AP-Flasher/data/tagtypes/02.json b/ESP32_AP-Flasher/data/tagtypes/02.json index 422b65d2..787c55d6 100644 --- a/ESP32_AP-Flasher/data/tagtypes/02.json +++ b/ESP32_AP-Flasher/data/tagtypes/02.json @@ -11,7 +11,8 @@ "red": [255, 0, 0], "gray": [150, 150, 150] }, - "capabilities": ["button", "customlut"], + "shortlut": 1, + "options": ["button"], "template": { "1": { "weekday": [ 200, 25, "fonts/calibrib60" ], diff --git a/ESP32_AP-Flasher/data/tagtypes/05.json b/ESP32_AP-Flasher/data/tagtypes/05.json index 68ceea38..68178797 100644 --- a/ESP32_AP-Flasher/data/tagtypes/05.json +++ b/ESP32_AP-Flasher/data/tagtypes/05.json @@ -11,7 +11,8 @@ "red": [255, 0, 0], "gray": [150, 150, 150] }, - "capabilities": ["button", "customlut"], + "shortlut": 1, + "options": [], "template": { "1": { "weekday": [ 200, 25, "fonts/calibrib60" ], diff --git a/ESP32_AP-Flasher/data/tagtypes/11.json b/ESP32_AP-Flasher/data/tagtypes/11.json index 3d9f72e7..95b6c0ea 100644 --- a/ESP32_AP-Flasher/data/tagtypes/11.json +++ b/ESP32_AP-Flasher/data/tagtypes/11.json @@ -11,6 +11,7 @@ "red": [255, 0, 0], "gray": [150, 150, 150] }, - "capabilities": ["button", "customlut"], + "shortlut": 0, + "options": ["button"], "usetemplate": 1 } diff --git a/ESP32_AP-Flasher/data/tagtypes/31.json b/ESP32_AP-Flasher/data/tagtypes/31.json index 74d5eda0..82501cc0 100644 --- a/ESP32_AP-Flasher/data/tagtypes/31.json +++ b/ESP32_AP-Flasher/data/tagtypes/31.json @@ -11,7 +11,8 @@ "red": [255, 0, 0], "gray": [150, 150, 150] }, - "capabilities": ["button", "customlut"], + "shortlut": 0, + "options": ["button", "led"], "template": { "1": { "weekday": [148, 10, "fonts/calibrib60"], diff --git a/ESP32_AP-Flasher/data/tagtypes/33.json b/ESP32_AP-Flasher/data/tagtypes/33.json index d25551c8..90ba4d9e 100644 --- a/ESP32_AP-Flasher/data/tagtypes/33.json +++ b/ESP32_AP-Flasher/data/tagtypes/33.json @@ -11,7 +11,8 @@ "red": [255, 0, 0], "gray": [150, 150, 150] }, - "capabilities": ["button", "customlut"], + "shortlut": 0, + "options": ["button", "led"], "template": { "1": { "weekday": [148, 10, "fonts/calibrib60"], diff --git a/ESP32_AP-Flasher/data/tagtypes/E0.json b/ESP32_AP-Flasher/data/tagtypes/E0.json index d9481fff..a53b2a48 100644 --- a/ESP32_AP-Flasher/data/tagtypes/E0.json +++ b/ESP32_AP-Flasher/data/tagtypes/E0.json @@ -11,7 +11,8 @@ "red": [ 255, 0, 0 ], "gray": [ 150, 150, 150 ] }, - "capabilities": [ ], + "shortlut": 0, + "options": [], "contentids": [ 0, 1, 2, 3, 4, 8, 16, 9, 7, 19, 10, 11, 21 ], "usetemplate": 1, "template": { diff --git a/ESP32_AP-Flasher/data/tagtypes/F0.json b/ESP32_AP-Flasher/data/tagtypes/F0.json index 53e31550..17c55713 100644 --- a/ESP32_AP-Flasher/data/tagtypes/F0.json +++ b/ESP32_AP-Flasher/data/tagtypes/F0.json @@ -6,7 +6,8 @@ "bpp": 1, "colors": 0, "colortable": {}, - "capabilities": [], + "shortlut": 0, + "options": [], "template": { } } diff --git a/ESP32_AP-Flasher/src/web.cpp b/ESP32_AP-Flasher/src/web.cpp index 8158a835..ee845054 100644 --- a/ESP32_AP-Flasher/src/web.cpp +++ b/ESP32_AP-Flasher/src/web.cpp @@ -321,6 +321,31 @@ void init_web() { sendTagCommand(mac, CMD_DO_DEEPSLEEP, !taginfo->isExternal); } if (strcmp(cmdValue, "ledflash") == 0) { + struct ledFlash flashData = {0}; + flashData.flashDuration = 8; + flashData.color1 = 0x3C; // green + flashData.color2 = 0xE4; // red + flashData.color3 = 0x03; // blue + flashData.flashCount1 = 1; + flashData.flashCount2 = 1; + flashData.flashCount3 = 1; + flashData.delay1 = 10; + flashData.delay2 = 10; + flashData.delay3 = 10; + flashData.repeats = 2; + const uint8_t *payload = reinterpret_cast(&flashData); + sendTagCommand(mac, CMD_DO_LEDFLASH, !taginfo->isExternal, payload); + } + if (strcmp(cmdValue, "ledflash_long") == 0) { + struct ledFlash flashData = {0}; + flashData.flashDuration = 15; + flashData.color1 = 0xE4; // red + flashData.flashCount1 = 5; + flashData.delay1 = 5; + flashData.delay3 = 15; + flashData.repeats = 10; + const uint8_t *payload = reinterpret_cast(&flashData); + sendTagCommand(mac, CMD_DO_LEDFLASH, !taginfo->isExternal, payload); } request->send(200, "text/plain", "Ok, done"); } else { diff --git a/ESP32_AP-Flasher/wwwroot/main.js b/ESP32_AP-Flasher/wwwroot/main.js index 192782d9..6f2d6395 100644 --- a/ESP32_AP-Flasher/wwwroot/main.js +++ b/ESP32_AP-Flasher/wwwroot/main.js @@ -940,6 +940,7 @@ async function getTagtype(hwtype) { rotatebuffer: jsonData.rotatebuffer, colortable: Object.values(jsonData.colortable), contentids: Object.values(jsonData.contentids ?? []), + options: Object.values(jsonData.options ?? []), busy: false }; tagTypes[hwtype] = data; @@ -1079,7 +1080,7 @@ $('#taglist').addEventListener('contextmenu', (e) => { const clickedGridItem = e.target.closest('.tagcard'); if (clickedGridItem) { let mac = clickedGridItem.dataset.mac; - console.log("tagcard"); + const hwtype = clickedGridItem.dataset.hwtype; let contextMenuOptions = [ { id: 'refresh', label: 'Force refresh' }, { id: 'clear', label: 'Clear pending status' } @@ -1090,6 +1091,12 @@ $('#taglist').addEventListener('contextmenu', (e) => { { id: 'reboot', label: 'Reboot tag' }, ); }; + if (tagTypes[hwtype].options?.includes("led")) { + contextMenuOptions.push( + { id: 'ledflash', label: 'Flash the LED' }, + { id: 'ledflash_long', label: 'Flash the LED (long)' } + ); + } contextMenuOptions.push( { id: 'del', label: 'Delete tag from list' } );