diff --git a/meshview/templates/packet.html b/meshview/templates/packet.html index 9b9a3b7..578e266 100644 --- a/meshview/templates/packet.html +++ b/meshview/templates/packet.html @@ -439,6 +439,10 @@ seenTableBody.innerHTML = Object.keys(hopGroups) const rlat = node.last_lat/1e7; const rlon = node.last_long/1e7; allBounds.push([rlat, rlon]); + let distanceKm = null; + if (srcLat && srcLon) { + distanceKm = haversine(srcLat, srcLon, rlat, rlon); + } const color = hopColor(hopKey); @@ -465,20 +469,27 @@ seenTableBody.innerHTML = Object.keys(hopGroups) }).addTo(map); marker.bindPopup(` -
- ${label}
- Node ID: - ${s.node_id}
- HW: ${node?.hw_model ?? "—"}
- Channel: ${s.channel ?? "—"}

+
+ ${label}
+ Node ID: + ${s.node_id}
+ HW: ${node?.hw_model ?? "—"}
+ Channel: ${s.channel ?? "—"}
+ ${ + distanceKm !== null + ? `Distance: ${distanceKm.toFixed(1)} km
` + : "" + } +
- Signal
- RSSI: ${s.rx_rssi ?? "—"}
- SNR: ${s.rx_snr ?? "—"}

+ Signal
+ RSSI: ${s.rx_rssi ?? "—"}
+ SNR: ${s.rx_snr ?? "—"}

+ + Hops: ${hopKey} +
+ `); - Hops: ${hopKey} -
- `); } return `