Commit Graph
47 Commits
Author SHA1 Message Date
efiten 770bffdab1 cleanup: dedupe RESP_CODE_STATS, fix stale publisher.js header, document rfSampler
frames.js declared its own copy of RESP_CODE_STATS = 24, but nothing
imports it — rfstats.js has the copy parseStats actually uses. Delete
the dead one so there is exactly one definition of this wire constant.

publisher.js's header named only the /packets topic, understating the
module's contract now that it also publishes RF samples on /rf.

README's config.json section never documented rfSampler at all (it
exists in public/config.example.json and config.js). Add it alongside
fullRfLog, and warn that mqtt.js negotiates MQTT 3.1.1 — whose PUBACK
carries no reason code — so a broker ACL denying the /rf subtopic
still lets the app log "published N record(s)" while the server
receives zero rows.
2026-08-18 12:43:00 +02:00
efiten 125eb356f5 fix: generation guard closes RF sampler timer leak across reconnect
tick() awaits state.queue.add(sample) mid-cycle. If disconnectAll()
runs during that await, stopRfSampler() clears a timer that has
already fired, and the resumed tick then reschedules itself at the
end regardless. If the user reconnects inside that window,
startRfSampler() overwrites state.rfTimer with its new session's
timer, but the stale tick's later reschedule clobbers it again,
leaving a second concurrent tick loop running against its own
closure's orphaned `pending` map.

Each RF sampler session now bumps state.rfGen; a tick only
reschedules itself if the generation it captured at start is still
current, so a superseded tick dies quietly after finishing (and
queuing) whatever sample it was mid-flight on.

No test added: app.js exports nothing and wires DOM/BLE listeners
directly at import time (window.addEventListener('DOMContentLoaded',
...), document.getElementById via els()), with no existing
app.test.mjs or DOM/BLE mocking harness in this repo. Standing up
that infrastructure for this one seam would be a larger change than
the fix itself.

Bump sw.js CACHE per repo convention for any frontend file change.
2026-08-18 12:42:52 +02:00
efiten b4c9194265 feat: route queued records to /packets or /rf by kind
Publisher.topicFor/payloadFor dispatch on rec.kind so the drain loop
can publish both reception records (no kind, /packets, unchanged
buildPayload) and RF environment samples (kind: 'rf', /rf,
buildRfPayload/type RF_SAMPLE) without dropping either. recv_errors
is only included on the RF payload when present on the record, never
defaulted, so its absence still means "unknown" downstream.

Bumps the sw.js cache version since src/publisher.js changed.
2026-08-18 11:14:30 +02:00
efiten 156757a853 feat: RF environment sampler with moving/parked cadence 2026-08-18 11:05:54 +02:00
efiten 8c46a31c50 feat: parse companion radio stats frames 2026-08-18 11:00:45 +02:00
efiten 67f548c858 fix: pass computed fullRfLog flag, correct comment, document flag + cross-repo cost
buildRfLogRecord was called with the literal fullRfLog: true even though
the call is only reached when the computed `logged` is true. That made
the gate's correctness depend on the early `if (!logged) return` three
lines above rather than on the value itself — a future edit moving the
call would silently turn the opt-in into a no-op. Pass `logged` instead,
and hoist the doubled getConfig() call into a local.

The comment above claimed the unattributable-packet path "must move NO
coverage state", but it does assign state.motion and call setPaused() —
intentionally, since updateMotion is a pure function of the latest GPS
fix and applying the idle gate here is the point. Reworded to say the
motion/idle-gate state is deliberately shared, and only the counters,
SNR meter, recently-heard list, beeper and map hexes must not move.

README's config.json example was missing fullRfLog (public/config.example.json
already had it). Documents the flag and that enabling it while the
ingestor's clientRxObservations.enabled is false wastes mobile data on
packets the server decodes and discards with no row and no warning —
mirrored in CoreScope's docs/client-rx-coverage.md.

Bumps sw.js CACHE (v13 -> v14) for the src/app.js change.
2026-08-18 10:50:46 +02:00
efitenandClaude Opus 5 9339b66e6f feat: optional full RF logging of unattributable receptions (v1.5.0)
Adds fullRfLog (default off) so a sysop can opt in to queuing receptions
the capture path cannot attribute to a node — DIRECT routes, 1-byte path
hashes, etc — as a diagnostic RF observation stream. The decision lives
in a new pure src/capture.js so it stays testable without a DOM; an
unattributable reception moves no coverage state (counters, SNR meter,
recently-heard, beeper, map hexes untouched). MQTT payload shape and
Publisher.buildPayload are unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-18 10:17:27 +02:00
efitenandClaude Opus 4.8 0ab4d1d4b5 feat: audio ping when a node is mapped (v1.4.0)
Optional short "bloop" (Web Audio, no asset) on every mapped reception, so
the operator gets feedback without looking at the phone — silence in a stale
area, frequent pings where devices are around, and an audible sign capture is
still alive (issue #7). Off by default; the choice is persisted in
localStorage so a later app start restores it.

Tone generation lives in a DI-injectable createBeeper() (mirrors wakelock.js)
so it is unit-tested without a browser. The AudioContext is unlocked from the
Connect click / toggle change to satisfy the autoplay policy.

Bump SW cache v11->v12.

Closes #7

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 16:29:12 +02:00
efitenandClaude Opus 4.8 a58f17a5c2 fix: resume capture on heard packet after standstill auto-pause (v1.3.3)
After the 5-min standstill auto-pause, capture only resumed when a GPS
watchPosition callback reported movement. On a backgrounded / screen-off
PWA those callbacks stall, so a drive that resumed after a stop logged
nothing until the app was foregrounded — a whole drive silently lost
(reported for BE-BOC-myst, 2026-07-08 near Bree).

Wake-on-packet: a heard packet now also advances the idle gate via the new
pure captureDecision(), so movement resumes capture on the first packet
from a moved position even when the GPS callback cadence dropped. A packet
still at the parked anchor stays paused. Capture stays fully decoupled from
the network (IndexedDB queue), so this is a capture fix, not an upload one.

Bump SW cache v10→v11 for the frontend change.

Closes #9

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 16:22:07 +02:00
efitenandClaude Opus 4.8 bccedfbb84 fix: MQTT connection wedged after one drop, leaving all receptions pending (v1.3.2)
Field report: CoreScope showed disconnected and every reception stayed pending,
starting with today's v1.3.x update. Broker is healthy (auth/ACL/listener all OK),
so the regression is client-side.

Root cause: today's diff lowered MQTT keepalive 60→20 s, which exercises the
reconnect path far more often — and the pre-existing `client.once('error', reject)`
left NO error listener after the first error. mqtt.js is an EventEmitter, so a later
'error' (during a transient reconnect) throws unhandled and wedges the auto-reconnect
loop: the client never reconnects, drain never runs, the queue grows unbounded.

- Revert keepalive to the mqtt.js default (restores v1.2.0 connection behaviour).
- Attach a PERSISTENT 'error' listener; the initial-connect promise removes its own
  listeners once settled so a later error is always handled, never thrown.
- Log every broker transition (connect/reconnect/offline/close/error + reason) to the
  debug log — these were previously invisible, so the drop couldn't be diagnosed.
- "Push pending now" forces a reconnect when the link is down (manual recovery).
- Home upload dot turns red (not idle-grey) on a real disconnect.

SW cache v9→v10.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 18:57:52 +02:00
efitenandClaude Opus 4.8 bbf91c2afc feat: move Connect to Settings, open on Settings until connected, name last reception (v1.3.1)
- Connect/Disconnect (+ progress + status) moves from Home to the Settings tab, so
  the recently-heard list moves up — Home stays a pure monitor.
- The app opens on Settings (where Connect lives) until a companion is connected,
  then jumps to Home; the live monitor is shown only when there's something to watch.
- Last reception shows the resolved node name when available, upgrading from the raw
  ID once names.js resolves it (label derived live each tick).

SW cache v8→v9.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 15:57:37 +02:00
efitenandClaude Opus 4.8 d65b923c10 feat: auto-discover + Settings tab + Home monitor, fix stuck-uploads drain (v1.3.0)
Home becomes a pure monitor and a new Settings tab holds config/diagnostics.

- Discover now runs automatically while connected with a 15 s traffic backoff
  (an overheard 2-byte forwarder/advert means a busy channel — don't poll on top
  of it); standstill still suspends it. The Flood probe is removed entirely.
- New Settings tab: CoreScope broker status + "Push pending now", companion info,
  diagnostics (verbose, debug log, share/mail the log via Web Share API).
- Home enriched: nodes/hex/rx counters, status strip (GPS accuracy, pending,
  upload health + last-upload age, capture rate), last-reception SNR peak-hold
  meter, discover status line.
- Fix the +60-pending-on-WiFi bug: publish() now times out instead of hanging on
  a dead socket, drainLoop re-arms in finally so it can never die, MQTT keepalive
  lowered, and a drain is kicked on broker reconnect / window online.

Pure logic in src/monitor.js + src/sharelog.js with tests. SW cache v7→v8.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-20 15:20:35 +02:00
efitenandClaude Opus 4.8 a321542900 feat: keep screen awake while capturing + iOS/Bluefy notice
Wake lock held for the whole session (native Screen Wake Lock where available,
hidden muted loop video fallback for Bluefy/WKWebView), acquired in the Connect
user-gesture so iOS allows video.play(), released on disconnect. Shows a notice
when Web Bluetooth is missing (iOS Safari → Bluefy). SW cache → v7.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 09:27:02 +02:00
efitenandClaude Opus 4.8 adbb096457 feat(motion): shorten standstill auto-pause dwell from 15 min to 5 min
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-17 09:27:01 +02:00
efitenandClaude Opus 4.8 fe754d54b9 feat(app): auto-pause capture/upload when stationary, resume on movement
Feed each GPS fix into the idle gate; while paused, skip queueing/counting/
mapping new receptions (recent-heard list still updates as liveness) and
suspend the Discover loop. Adds an amber status chip; bumps SW cache to v6.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 20:27:20 +02:00
efitenandClaude Opus 4.8 b3aaf3aa7b feat(motion): pure idle-gate — displacement-anchor moving/stationary detection
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 20:20:57 +02:00
Erwin FitenandClaude Opus 4.8 61f0ab911a chore: rename corescope-rx -> coredrive-rx (CoreDrive RX)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 11:10:18 +02:00
Erwin FitenandClaude Opus 4.8 bba0d860cb feat(map): coarser live grid + bolder hex style for on-the-move visibility
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 11:07:05 +02:00
Erwin FitenandClaude Opus 4.8 6132eb91ef fix(recent): re-find merged row by sameNode so name survives key promotion
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 11:05:35 +02:00
Erwin FitenandClaude Opus 4.8 556dc72f46 fix(recent): one row per node — merge a node's heard-key representations
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 11:00:55 +02:00
Erwin FitenandClaude Opus 4.8 5aa5e6d4a9 refactor(recent): clearer field seeding + document name tie-breaking
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 10:56:49 +02:00
Erwin FitenandClaude Opus 4.8 88b159f288 feat(recent): pure prefix-merge for the heard list (dedupes a node's representations)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 10:52:08 +02:00
efiten c06a84f0b6 feat(app): load runtime config.json; build MQTT from it; genericize UI 2026-06-13 21:18:22 +02:00
efiten a7d451a3ff feat(names): resolve URL from runtime config; skip when unset 2026-06-13 21:12:28 +02:00
efiten 6e80334dc6 fix(config): cache loadConfig, guard array input, test mqttPassword normalization 2026-06-13 21:07:54 +02:00
efiten 2bd69ab30f feat(config): runtime config.json loader + validation 2026-06-13 21:00:16 +02:00
efitenandClaude Opus 4.8 c4c049523a fix(app): only attribute path[last] for FLOOD routes
A direct-routed packet consumes the next hop from the FRONT of the path
(firmware Mesh.cpp removeSelfFromPath), so path[last] is the route's
destination-side end, not the node we physically heard — crediting SNR/RSSI to
the wrong (often far-away) node. Flood forwarders append at the end, so there
path[last] is correct. deriveHeardKey now skips DIRECT (2/3) multi-hop packets
via a new isFloodRoute() guard; the debug log calls them out explicitly. Also
covers TRACE (always DIRECT). bump 0.8.0 -> 0.8.1, sw cache v3 -> v4.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-11 22:18:38 +02:00
efitenandClaude Opus 4.8 02b61df753 feat(app): node-discover + flood probe, debug-log cleanup
- Discover button now sends a zero-hop node-discover request (CONTROL/DISCOVER_REQ,
  cmd 0x37) every 30s with an in-button countdown; meshpacket parses DISCOVER_RESP
  into a heard_key (src=discover). Wire format verified against meshcore_py + firmware docs.
- replace Ping with a one-shot Flood probe (mesh-wide advert, 60s cooldown) that maps
  repeaters beyond direct range via overheard re-broadcasts.
- meshpacket: guard TRACE packets (header path bytes are per-hop SNR, not hop hashes)
  so they can't yield a bogus heard_key.
- debug log: green reserved for captures, orange for our own sends, explicit grey
  notice for 1-byte path-hash packets, and a Verbose toggle for raw 0x88 bytes +
  unattributable frames.
- bump version 0.7.0 -> 0.8.0, sw cache v2 -> v3.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-11 20:46:33 +02:00
efiten 1e49e40e21 feat(app): colour-code the debug log
Green = forwarded/sent (heard/attributed, published, discover/ping sent),
red = held back/failed (not attributable, no GPS, publish/send errors),
grey = status. (No version bump — v0.7.0.)
2026-06-10 20:31:19 +02:00
efiten 9a5b4c5e02 feat(app): auto-set companion to 2-byte path-hash mode on connect
On connect, query DEVICE_INFO (CMD_DEVICE_QUERY) and read path_hash_mode (byte
81, fw v10+). If it's 0 (1-byte, collision-prone → our rule rejects it), set it
to 1 (2-byte) via CMD_SET_PATH_HASH_MODE and report it below the Connect button.
2026-06-10 20:27:46 +02:00
efiten 25b5889a89 feat(app): Discover + Ping buttons (zero-hop self-advert)
Discover sends one zero-hop self-advert (CMD_SEND_SELF_ADVERT=7, byte1=0) to
wake/probe only the directly-surrounding nodes (NOT flood). Ping is a toggle:
the same zero-hop advert every 15s, auto-reset whenever a multibyte packet is
heard. Buttons enabled only while a companion is connected.
2026-06-10 20:15:34 +02:00
efiten c04b8fa9f0 fix(app): align follow button under the zoom control (explicit 10px corner margin) 2026-06-10 16:53:39 +02:00
efiten 8e45167402 fix(app): follow button uses Leaflet's leaflet-bar/<a> markup (matches zoom buttons)
Avoids the app's global button{} styles + native mobile button rendering that
stripped the box; now styled like the +/- control.
2026-06-10 16:50:44 +02:00
efiten c261c5f59f fix(app): follow-button styling + cache-busting so updates land
- 📍 follow button: override the app's global button padding/margin so the icon
  sits centred in the box
- service worker: bump cache name + purge old caches on activate
- (nginx on rx.on8ar.eu now sends no-cache for index.html/sw, immutable for
  hashed assets, so new versions actually reach clients)
2026-06-10 16:46:18 +02:00
efiten 91bbe1a67f fix(app): live GPS marker/follow updates continuously, not only on RX
The map's position marker only moved when a packet arrived, so it appeared to
hang and jump. GPS fixes (watchPosition) now feed the map directly via
setPosition; hexes are still added only on a real RX.
2026-06-10 16:37:22 +02:00
efiten baeed272fc chore: add app version display (semver via Vite inject), set 0.5.0
Shows the running build next to the title. Versioning scheme: patch=fix/tweak,
minor=new backward-compatible feature, major=breaking (e.g. MQTT contract) or
first stable release.
2026-06-10 11:53:44 +02:00
efiten 050652b49a feat(app): send companion self-reported name as MQTT 'origin'
The server uses this to label mobile observers in the leaderboard even when the
companion never advertised (so it isn't in the nodes table).
2026-06-10 11:27:06 +02:00
efiten d01cecf413 feat(app): split into Home/Map views with a bottom tab bar
The live map crowded the capture view, so move it to its own full-screen Map
tab. Bottom bar switches Home (stats/connect/recent/debug) <-> Map; Leaflet is
invalidated on show so tiles size correctly.
2026-06-10 10:49:07 +02:00
efitenandClaude Opus 4.8 9f2ff0b7d9 feat(app): real-time local coverage hex map (follows GPS, keeps zoom)
- src/hexgrid.js: JS port of the server hex grid (same cells as the analyzer)
- src/localmap.js: Leaflet map aggregating this session's receptions into live
  hexes (best SNR colour); follows GPS with zoom preserved, drag to inspect +
  📍 button to re-follow; hexes persist until reload
- wired into the capture flow; Leaflet via CDN

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-10 10:41:43 +02:00
efiten 5f4c3c1eef perf(app): resolve node names on-the-fly per heard node (no bulk list)
Each distinct heard prefix triggers one tiny /api/nodes/resolve request (via
corsproxy), cached in memory for the session — ID shown first, replaced with the
name when it arrives. Drops the full ~node-list download + localStorage cache;
far less traffic and memory, and scales with network size.
2026-06-09 19:32:31 +02:00
efiten d7b50cdb31 feat(app): resolve heard-node names via CoreScope API (corsproxy /cs)
Recent-nodes list now shows node names when a prefix resolves uniquely (full
node list fetched once via corsproxy.on8ar.eu/cs, cached 1h in localStorage;
2-byte prefix collisions fall back to the raw prefix). HTML-escaped.
2026-06-09 19:20:11 +02:00
efiten a39504826d feat(app): recently-heard nodes list (latest SNR, colour-coded) + debug log toggle
Clean list of the last 20 heard nodes with their latest SNR (green→red), hit
count; raw debug log collapsed behind a toggle. Node-name lookup deferred (needs
a CORS allowance for rx.on8ar.eu on the analyzer API + full node-list fetch).
2026-06-09 19:14:56 +02:00
efitenandClaude Opus 4.8 26a6cb429e feat(app): BLE auto-reconnect + PWA (installable); remove Simulate/mock GPS
- transport auto-reconnects on gattserverdisconnected (exponential backoff,
  buffer preserved); onStatus surfaces reconnecting/connected in the UI
- PWA: manifest + service worker (network-first, offline shell) + icons →
  'Add to Home screen' on Android
- removed Simulate RX + mock GPS (field hardware verified); kept debug log

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 19:03:37 +02:00
efitenandClaude Opus 4.8 32072580e2 feat(app): auto companion pubkey via SELF_INFO + single connect/disconnect button
- SELF_INFO (CMD_APP_START 0x01 → PACKET_SELF_INFO 0x05) auto-fills the
  companion pubkey (used as rx_pubkey / clientId / topic); manual field removed
- one Connect button: companion → SELF_INFO → broker, automatically; toggles to
  Disconnect when connected
- stepped progress block: ① companion → ② companion id → ③ ON8AR CoreScope → all connected
- transport supports multiple frame listeners; publisher.end()

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 18:47:24 +02:00
efitenandClaude Opus 4.8 958bd7c2e4 feat: MQTT config from build-time env (creds never shown in UI)
- broker URL + credentials read from VITE_* env (.env.local, gitignored); the
  UI no longer has credential fields — end user only connects the companion
- MQTT clientId = companion pubkey so an EMQX ACL can bind topics to ${clientid}
- .env.example documents the shared publish-only ingest-account model + the wss
  valid-cert requirement

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 17:00:25 +02:00
efitenandClaude Opus 4.8 7867a859e4 feat: on-screen debug log + Simulate RX, payload-layout pipeline test
- debug panel logs every frame in, parsed heard-key, and the exact outgoing MQTT
  payload; Simulate RX pushes a real fixture through the full pipeline (no BLE/GPS
  needed; mock-GPS toggle for desktop)
- test/pipeline.test.mjs asserts + prints the payload layout end-to-end

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 16:53:22 +02:00
efitenandClaude Opus 4.8 db83810878 feat: scaffold corescope-rx capture app (BLE companion → MQTT coverage)
Protocol core implemented + unit-tested (meshpacket: path[last]/advert pubkey,
direct-only rule; frames: 0x88 snr/rssi/raw). Working skeleton for transport
(Web Bluetooth NUS), GPS, IndexedDB queue, MQTT.js publisher and field UI.
Remaining work in docs/plan.md (spikes + harden + verify).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-09 16:47:30 +02:00