update node
All checks were successful
Meshtastic Map - See local Meshtastic Nodes / deploy (push) Successful in 1s
All checks were successful
Meshtastic Map - See local Meshtastic Nodes / deploy (push) Successful in 1s
This commit is contained in:
parent
58c350e051
commit
bd1a8e5497
@ -15,13 +15,29 @@
|
||||
var map = L.map('map').setView([0, 0], 2);
|
||||
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png').addTo(map);
|
||||
let myCoords = null;
|
||||
const today = new Date();
|
||||
const now = Date.now() / 1000; // Current time in seconds
|
||||
|
||||
const daysSince = (test) => {
|
||||
if (test) {
|
||||
const diffTime = Math.abs(test.getTime() - today.getTime());
|
||||
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24));
|
||||
return diffDays;
|
||||
let res = ''
|
||||
let diff = Math.floor(now - test);
|
||||
const isFuture = diff < 0;
|
||||
diff = Math.abs(diff); // Get absolute value for breakdown
|
||||
|
||||
const days = Math.floor(diff / (3600 * 24));
|
||||
const hours = Math.floor((diff % (3600 * 24)) / 3600);
|
||||
const minutes = Math.floor((diff % 3600) / 60);
|
||||
const seconds = diff % 60;
|
||||
if (days) {
|
||||
res += `${days} days `
|
||||
}
|
||||
if (hours) {
|
||||
res += `${hours} hours `
|
||||
}
|
||||
if (minutes) {
|
||||
res += `${minutes} minutes `
|
||||
}
|
||||
return res
|
||||
}
|
||||
return "N/A"
|
||||
|
||||
@ -30,7 +46,7 @@
|
||||
const getNodeDesc = (node) => {
|
||||
const deviceMetrics = node?.deviceMetrics
|
||||
const hopsAway = node?.hopsAway ?? 'N/A';
|
||||
const lastHeard = node?.lastHeard ? new Date(node?.lastHeard * 1000) : null
|
||||
const lastHeard = node?.lastHeard
|
||||
const num = node?.num;
|
||||
const position = node?.position;
|
||||
const snr = node?.snr ?? 'N/A';
|
||||
@ -38,10 +54,13 @@
|
||||
const lat = position?.latitude
|
||||
return `
|
||||
${user.id}<br/>
|
||||
${user.shortName}<br/>
|
||||
${user.shortName} - ${user.longName}<br/>
|
||||
${user.hwModel}<br/>
|
||||
${hopsAway} hop<br/>
|
||||
Heard: ${daysSince(lastHeard)} ago<br/>
|
||||
S/N: ${snr} dbM<br/>
|
||||
Last Heard: ${daysSince(lastHeard)} days
|
||||
Channel Util ${Math.round(node?.deviceMetrics?.channelUtilization * 100) / 100}%<br/>
|
||||
Airtime Util ${Math.round(node?.deviceMetrics?.airUtilTx * 100) / 100}%<br/>
|
||||
`
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user