mirror of
https://github.com/OpenEPaperLink/OpenEPaperLink.git
synced 2026-03-21 10:06:07 +01:00
'flash led' command in context menu of webinterface
This commit is contained in:
@@ -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" ],
|
||||
|
||||
@@ -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"],
|
||||
|
||||
@@ -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" ],
|
||||
|
||||
@@ -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" ],
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
"red": [255, 0, 0],
|
||||
"gray": [150, 150, 150]
|
||||
},
|
||||
"capabilities": ["button", "customlut"],
|
||||
"shortlut": 0,
|
||||
"options": ["button"],
|
||||
"usetemplate": 1
|
||||
}
|
||||
|
||||
@@ -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"],
|
||||
|
||||
@@ -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"],
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
"bpp": 1,
|
||||
"colors": 0,
|
||||
"colortable": {},
|
||||
"capabilities": [],
|
||||
"shortlut": 0,
|
||||
"options": [],
|
||||
"template": {
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<const uint8_t *>(&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<const uint8_t *>(&flashData);
|
||||
sendTagCommand(mac, CMD_DO_LEDFLASH, !taginfo->isExternal, payload);
|
||||
}
|
||||
request->send(200, "text/plain", "Ok, done");
|
||||
} else {
|
||||
|
||||
@@ -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' }
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user