Commit Graph
5 Commits
Author SHA1 Message Date
Erwin FitenandClaude Opus 5 ec55d31bfe fix: the debug log announced a healthy BLE link once a second
noteLinkState's guard was inverted. `state.linkQuiet` holds the INVERSE of
the link being up, so the steady state is `linkQuiet !== linkUp` and an edge
is `linkQuiet === linkUp`. The guard returned on the edge and fell through in
the steady state — the exact opposite of both.

Per-second monitorTick therefore wrote "companion link back" on every tick of
a perfectly healthy link, and swallowed the real transition: linkQuiet never
flipped off its `false` initial value, so "companion link down" could never be
reached at all. A field log from this morning shows 157 of 200 buffered lines
spent on the spam, the whole 200-line ring buffer covering 2m36s, and not one
"link down" line — defeating cc710a3, which added the pair so that a dropped
link would stop reading like an app that had crashed.

The edge decision moves to monitor.js as the pure `linkTransition`, next to
the other per-tick monitor helpers, since app.js cannot be imported under
node --test. Five regression tests cover both steady states, both edges, and a
full drop/return cycle driven tick by tick.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-14 09:48:06 +02:00
efitenandClaude Opus 5 cc710a3a11 fix: stop transmitting into a BLE link that is down
The 2026-09-13 log ends with two and a half minutes of "discover send failed: GATT
Server is disconnected" — one sweep every 30 seconds, each a write into a characteristic
that no longer exists — an "rf sample incomplete — discarded" for every sampler round,
and region asks failing the same way. None of it could reach a radio.

discoverDecision takes linkUp and reports 'link-down' ahead of every other state; the
monitor tick returns right after rendering it, the RF sampler reschedules without
sampling, and region asks stop with them. The discover clock is not advanced while down,
so the first tick after the link returns sweeps immediately instead of waiting out an
interval.

The link state is read from the browser's own device object through a new
transport.connected(), not mirrored into a flag of ours. A flag would be stale exactly
when it matters, which is the same failure shape as the duplicated default fixed in
v1.17.1 — one source per fact.

Said once in each direction rather than per tick. A log that just goes quiet is
indistinguishable from a crash, an area with nothing to hear, or a feature switched off.

Capture, queueing and uploading are untouched: receptions already in hand are still
queued and published, and the MQTT link keeps its own reconnect.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HSoyBhrLLtSqLgBMEKMiJV
2026-09-13 13:42:56 +02:00
efitenandClaude Opus 5 8bfadeaac8 feat: pace region discovery by what the radio hears, not by a clock
The scheduler had three limits and four drives showed each one costing answers rather
than protecting anything. All three are gone; what replaces them is bounded by the
repeater firmware's own limiter instead of by a clock of our own invention.

The shared one-ask-per-60s airtime budget. One ask, from wherever, blocked every
repeater heard in the following minute. The 2026-09-11 80 km log has a2cf63b9fd89 asked
at 18:24:55 on rssi -120 and silent, then heard at 18:25:26 on -102 — 18 dB stronger —
and skipped, because the budget had gone on the weaker reception 31 seconds earlier and
that same ask had put it into backoff.

The 5/15/30-minute per-target backoff, counted per session. A repeater asked once from a
bad spot was locked out for the rest of the drive. It is replaced by an encounter: three
unanswered asks at least 30s apart, then left alone until it has been out of earshot for
five minutes, after which the next reception is a new encounter with a fresh run. Three
asks 30s apart is 3 in any 180s window, inside simple_repeater's 4 anon requests per
180s shared across all requesters — the cap is what keeps us there, not the spacing.

The single in-flight slot. It capped the feature at three asks a minute, and at one per
session whenever a request went unanswered. Several requests can now be outstanding, so
replies are attributed on the 4-byte tag the companion echoes back and an unmatched
reply is dropped rather than guessed at: "something is pending" would file one
repeater's declared regions under another and store it as fact.

Measured, not assumed. A build without the three limits sent 15 asks and got 6 answers;
v1.14.0 on a comparable run sent 5 and got 1. That build is the one merged here (the
beta/regions-sprint commits below), with the pacing tightened from 15s/6 asks to
30s/3 asks so one repeater sees strictly less than the firmware allows one client.

Also here: every ask now carries the snr and rssi of the reception that triggered it,
into the reply or into the timeout. Four drives point at a split — every ask at snr
+1.75 dB or better was answered, every one at -1.25 dB or worse was not — that until now
had to be assembled by hand from pairs of log lines the ring buffer rolls out mid-drive.
No signal floor is applied; this is the measurement that would justify one.

Deleted rather than left behind: selectNextTarget's successors (heardAskDecision,
commitAsk, undoAsk, isTargetDue, dueDelayMs, retryBackoffFor, recordCandidate,
applyRegionsReply, pendingExpired) and monitor's regionDiscoverDue/REGION_INTERVAL_MS.
regionreq.js is framing only now; regionsched.js owns the scheduling.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HSoyBhrLLtSqLgBMEKMiJV
2026-09-12 12:59:06 +02:00
efiten 1d6836b3d2 fix: don't let the stationary pause silence region discovery
Region discovery rode the discover clock, and discoverDecision short-circuits on
`paused`, so a parked app never asked a single repeater. That is the wrong
coupling: the pause exists because re-sampling the same spot adds nothing to
coverage or RF data, but a repeater's declared region list is a property of that
repeater, not of where we are standing — and the repeaters that matter most are
often the ones you are parked next to.

Give it its own 60s clock (the same rate the old round-parity scheme produced, so
airtime is unchanged) evaluated independently of dec.fire.

Stamp that clock on every evaluation rather than only on a successful ask: the
tick asks once a second, so an evaluation that finds no candidate would otherwise
re-enter — and re-log "no candidate" — every second instead of every minute.

Field context this came from: the log showed asks stopping dead at "stationary —
capture/upload paused". Separately, a repeater can also stay silent because
simple_repeater rate-limits anon requests to 4 per 180s shared across all types
and all requesters (MyMesh.cpp:861), which is why the busiest node in the mesh
answers least often. Retrying is the only remedy for that, and this change is
what makes retrying possible while parked.
2026-08-18 22:16:01 +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