From f7208f84c7009024934c7bc2630f74e01201ef84 Mon Sep 17 00:00:00 2001 From: Skip Hansen Date: Sat, 18 May 2024 01:33:49 -0700 Subject: [PATCH] Default tag alias to tag serial number rather than MAC for Chroma tags (#318) --- ESP32_AP-Flasher/wwwroot/main.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ESP32_AP-Flasher/wwwroot/main.js b/ESP32_AP-Flasher/wwwroot/main.js index c82fa149..0a67aad6 100644 --- a/ESP32_AP-Flasher/wwwroot/main.js +++ b/ESP32_AP-Flasher/wwwroot/main.js @@ -285,7 +285,18 @@ function processTags(tagArray) { $('#tag' + tagmac + ' .mac').innerHTML = tagmac; } let alias = element.alias; - if (!alias) alias = tagmac.replace(/^0{1,4}/, ''); + if (!alias) { + alias = tagmac.replace(/^0{1,4}/, ''); + if (alias.match(/^4467/)) { + let macdigit = Number.parseInt(alias.substr(4,2),16) & 0x1f; + let model = String.fromCharCode(macdigit + 65); + if (model == 'J' || model == 'M') { + macdigit = Number.parseInt(alias.substr(6,2),16) & 0x1f; + model += String.fromCharCode(macdigit + 65); + alias = model + alias.substr(8,8) + 'x' + } + } + } if ($('#tag' + tagmac + ' .alias').innerHTML != alias) { $('#tag' + tagmac + ' .alias').innerHTML = alias; }