diff --git a/templates/map.html b/templates/map.html
index 891a5dc..bc5a563 100644
--- a/templates/map.html
+++ b/templates/map.html
@@ -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}
- ${user.shortName}
+ ${user.shortName} - ${user.longName}
+ ${user.hwModel}
${hopsAway} hop
+ Heard: ${daysSince(lastHeard)} ago
S/N: ${snr} dbM
- Last Heard: ${daysSince(lastHeard)} days
+ Channel Util ${Math.round(node?.deviceMetrics?.channelUtilization * 100) / 100}%
+ Airtime Util ${Math.round(node?.deviceMetrics?.airUtilTx * 100) / 100}%
`
}