diff --git a/index.html b/index.html
index 4c90e47..afbcc31 100644
--- a/index.html
+++ b/index.html
@@ -28,7 +28,13 @@
.row button { flex: 1; }
label.inline { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; font-size: 13px; color: #e6e6e6; }
label.inline input { width: auto; }
- #log { background: #0a0c10; border: 1px solid #2a2f3a; border-radius: 6px; padding: 8px; font: 11px/1.4 ui-monospace, monospace; white-space: pre-wrap; word-break: break-all; max-height: 300px; overflow: auto; color: #9fe6b8; }
+ #log { background: #0a0c10; border: 1px solid #2a2f3a; border-radius: 6px; padding: 8px; font: 11px/1.4 ui-monospace, monospace; white-space: pre-wrap; word-break: break-all; max-height: 300px; overflow: auto; color: #9fe6b8; margin-top: 8px; }
+ .recent { display: flex; flex-direction: column; gap: 4px; }
+ .rr { display: flex; align-items: center; gap: 8px; padding: 7px 9px; background: #11141a; border: 1px solid #2a2f3a; border-radius: 6px; font-size: 13px; }
+ .rr .dot { width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto; }
+ .rr .rk { font-family: ui-monospace, monospace; }
+ .rr .rsnr { margin-left: auto; font-weight: 600; }
+ .rr .rc { color: #9aa4b2; font-size: 11px; min-width: 34px; text-align: right; }
@@ -47,9 +53,13 @@
-
-
-
+
+
+
+
+
+
+
diff --git a/src/app.js b/src/app.js
index 08825ec..ce9d316 100644
--- a/src/app.js
+++ b/src/app.js
@@ -12,7 +12,42 @@ import { Queue } from './queue.js';
import { Publisher } from './publisher.js';
const els = (id) => document.getElementById(id);
-const state = { transport: null, gps: new Gps(), queue: new Queue(), publisher: null, heard: 0, companionPubkey: '', connected: false };
+const state = { transport: null, gps: new Gps(), queue: new Queue(), publisher: null, heard: 0, companionPubkey: '', connected: false, recent: [] };
+
+const RECENT_MAX = 20;
+
+// SNR → colour bucket (LoRa-ish). Returns a CSS colour.
+function snrColor(snr) {
+ if (snr == null) return '#95a5a6';
+ if (snr >= 5) return '#2ecc71';
+ if (snr >= -3) return '#f1c40f';
+ if (snr >= -10) return '#e67e22';
+ return '#e74c3c';
+}
+
+// noteHeard upserts a heard node into the recent list (most-recent first).
+function noteHeard(key, keylen, snr, rssi, src) {
+ let e = state.recent.find((x) => x.key === key);
+ if (e) state.recent = state.recent.filter((x) => x !== e);
+ else e = { key, keylen, count: 0, src };
+ e.count++; e.snr = snr; e.rssi = rssi; e.last = Date.now();
+ state.recent.unshift(e);
+ state.recent = state.recent.slice(0, RECENT_MAX);
+ renderRecent();
+}
+
+function renderRecent() {
+ const el = els('recent');
+ if (!state.recent.length) { el.innerHTML = '— nothing yet —
'; return; }
+ el.innerHTML = state.recent.map((e) => {
+ const snr = e.snr != null ? e.snr.toFixed(1) + ' dB' : 'no sig';
+ return '' +
+ '' +
+ '' + e.key + '' +
+ '' + snr + '' +
+ '×' + e.count + '
';
+ }).join('');
+}
// MQTT config from build-time env (Vite); never the UI. Treat as a shared,
// publish-only ingest account (EMQX ACL); not a real secret.
@@ -65,6 +100,7 @@ async function processFrame(dv) {
const hk = deriveHeardKey('rx', pkt);
if (!hk) { dbg(' → not attributable (tx / 1-byte hop / no advert) — skip'); return; }
dbg(' → heard ' + hk.heardKey + ' (' + hk.heardKeyLen + 'B, ' + hk.src + ')');
+ noteHeard(hk.heardKey, hk.heardKeyLen, f.snr, f.rssi, hk.src); // show in the list even without a GPS fix
const fix = currentFix();
if (!fix) { dbg(' → no GPS fix — skip'); return; }
const rec = { rx_at: new Date().toISOString(), raw: rawHex, snr: f.snr, rssi: f.rssi, lat: fix.lat, lon: fix.lon, acc_m: fix.acc_m };
@@ -152,6 +188,13 @@ window.addEventListener('DOMContentLoaded', () => {
setButton();
els('btnConnect').addEventListener('click', () => (state.connected ? disconnectAll() : connectAll()));
els('btnClear').addEventListener('click', () => { els('log').textContent = ''; });
+ els('btnDbg').addEventListener('click', () => {
+ const log = els('log');
+ const show = log.style.display === 'none';
+ log.style.display = show ? 'block' : 'none';
+ els('btnDbg').textContent = show ? 'Hide debug log' : 'Show debug log';
+ });
+ renderRecent();
refreshCounters();
drainLoop();
if ('serviceWorker' in navigator) {