mirror of
https://github.com/HendrikRauh/dmx-interface.git
synced 2025-05-19 10:32:56 +00:00
refactored MAC address formatting
This commit is contained in:
parent
a82934eb72
commit
3723cb81a8
1 changed files with 6 additions and 1 deletions
|
@ -28,7 +28,7 @@ async function loadStatus() {
|
||||||
|
|
||||||
function setStatus(status) {
|
function setStatus(status) {
|
||||||
setValue("model", status.chip.model);
|
setValue("model", status.chip.model);
|
||||||
setValue("mac", status.chip.mac.toString(16).toUpperCase());
|
setValue("mac", formatMac(status.chip.mac));
|
||||||
setValue("sdk-version", status.sdkVersion);
|
setValue("sdk-version", status.sdkVersion);
|
||||||
|
|
||||||
setValue("rssi", status.connection.signalStrength);
|
setValue("rssi", status.connection.signalStrength);
|
||||||
|
@ -92,6 +92,11 @@ function formatBytes(bytes) {
|
||||||
return `${Math.round(value * 10) / 10} ${units[index]}`;
|
return `${Math.round(value * 10) / 10} ${units[index]}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatMac(decimalMac) {
|
||||||
|
const octets = decimalMac.toString(16).toUpperCase().match(/../g) || [];
|
||||||
|
return octets.reverse().join(":");
|
||||||
|
}
|
||||||
|
|
||||||
function selectConnectionIcon(signalStrength) {
|
function selectConnectionIcon(signalStrength) {
|
||||||
// access point
|
// access point
|
||||||
if (data.connection == 1) {
|
if (data.connection == 1) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue