The path field emitted raw hex, but the hop-hash width (1/2/3 B, top 2 bits of
path_len) wasn't visible in it -- the bridge couldn't tell "A31FC2" from three
1-byte hops vs one-and-a-half 2-byte hops. Emit hops colon-separated instead
("A3:1F:C2" vs "A31F:C204"): each token is one hop, its width is len/2. Field
order/count is unchanged (path stays the same column), so the bridge only
changes how it splits that one token. Shared helper analyzer_path_hex() used by
both nodes and rxlog. (`HEX` had to be a local name other than the Arduino
Print.h `HEX` macro.)
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Two related improvements to how heard nodes are represented:
1. Multi-path. A node's advert reaches us via several paths at once, but the
mesh dedups by payload hash (path not hashed) so onAdvertRecv sees only the
first copy -> `nodes` kept one path. rxlog, however, is fed pre-dedup and
logs every copy with its own path+SNR. Add the advert's FNV id (`pkt_hash`)
to each `nodes` row as a JOIN KEY: the bridge groups rxlog by pkt_hash and
joins to nodes to reconstruct every route a named node arrived by. New
`nodes` field: N,...,<age>,<pkthash>,<path>,<name> (name now after 10th comma).
2. Prefer direct. onAdvertRecv often processes a relayed copy first (stronger),
so the direct 0-hop link was being overwritten by a relayed path -- the
direct neighbours only showed up via the old `neighbors` path. Track
`direct_heard`; keep the direct (empty) path + its SNR for
HEARD_DIRECT_TTL_SECS after last hearing the node 0-hop.
Shared FNV helper (analyzer_frame_id) now used by both captureRx and
putHeardNode so nodes.pkt_hash == the rxlog copies' pkt_hash exactly.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
btmon shows the disconnects are HCI reason 0x3E (Connection Failed to be
Established / lost sync), not supervision timeout -- so widening the timeout
didn't help. The mast link is weak (RSSI -75..-90) and the node is busy with
LoRa; with slave latency 4 the peripheral may skip connection events, so the
central loses sync and reports 0x3E. Respond on every event (latency 0) to
maximise sync on a weak/busy link.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
6 s cut the reconnect churn from every 15-30 s to every ~60 s but didn't
eliminate it: under the bridge's real polling load the node shows a
periodic multi-second stall (advert TX airtime / SoftDevice-LoRa
coexistence) that occasionally exceeds 6 s. Widen the supervision timeout
to 16 s so those stalls are tolerated; a genuine freeze is still caught by
the 20 s hardware watchdog (16 s < 20 s).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The BLE console link dropped every ~15-30 s and the bridge kept
reconnecting. Root cause: Bluefruit's default supervision timeout is only
2 s, and this repeater relays heavy LoRa flood traffic, so main-loop /
radio coexistence stalls past 2 s and the central tears down the link.
Mirror the companion's proven approach (explicit sd_ble_gap_conn_param_update
on 'secured', since some centrals ignore the advertised PPCP) but widen the
supervision timeout to 6 s (a repeater is far busier than a client), with a
15-30 ms interval and slave latency 4. PPCP is also set before advertising.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
captureRx() ran calculatePacketHash() (SHA-256) on every received frame in
the logRx hot path. The mesh core already computes that SHA once per frame
in hasSeen() during routing, so the analyzer was doubling the crypto load
on the radio-shared main loop for no benefit.
Replace pkt_hash with a cheap FNV-1a over (type||payload): same purpose
(dedup / correlation across nodes running this FW), a fraction of the CPU.
RAM-only, no flash writes, still main-loop (not ISR) -- so this does not by
itself explain BLE link drops (those match the known SoftDevice/LoRa
coexistence instability the BLE watchdog already guards), but it removes
the one real RX-path cost the analyzer added.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Two RAM-only, opt-in tables fed from the normal RX path and pulled out
over the text console (serial / BLE) for a BLE bridge + map to consume.
Both are compiled out unless the build sets a non-zero size; enabled on
SenseCap_Solar_repeater_ble (-D MAX_HEARD_NODES=48 -D RXLOG_SIZE=96,
~6 KB RAM).
nodes [offset] -- registry of heard REPEATERS and ROOM SERVERS (chat
clients are deliberately skipped: personal/mobile devices, privacy).
Per node: pubkey prefix, name, type, lat/lon, last SNR/RSSI, seconds
since heard, and the path the advert arrived by. Fed from onAdvertRecv
(adverts are signature-verified upstream). -> map dots + topology
edges + link quality.
rxlog [cursor] -- circular firehose of EVERY parsed frame heard, fed
from logRx() (synchronous, so SNR/RSSI belong to that frame). Per
record: monotonic seq (paging cursor), time, packet hash, header
(route|type), SNR/RSSI, hop path. -> live traffic / analyzer view.
Both replies are paged to stay within the ~160 B console reply cap and
carry a trailer (next cursor + totals) so the bridge can drain and detect
if it fell behind the ring. Reachable over serial, the PIN-paired BLE
console and the admin mesh CLI, same as `neighbors`.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Repeater can be queried over BLE Nordic-UART (advert/neighbours/stats) without USB. Fix SoftDevice-protected TEMP peripheral access (sd_temp_get) that crashed BLE repeater telemetry, add USB-connected detection to ArduinoSerialInterface, and adjust the nRF52 ldscript/extra FS.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Backport of PR #1779 (BLE companion usable over USB while BLE disconnected), plus: track the active transport (secure-transport gating), and stop BLE advertising while a USB host is connected (docked) so the node stays quiet on 2.4 GHz; resume advertising when undocked. An active BLE link is never force-disconnected.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Add virtual BaseSerialInterface::isConnectionSecure() (default true). On the dual interface it is true only for MITM-paired BLE. Gate CMD_EXPORT_PRIVATE_KEY and CMD_SET_DEVICE_PIN, and hide the BLE PIN in CMD_DEVICE_QUERY, when the frame arrived over unauthenticated USB.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Before this commit, there was no way to set a different max hop count
for unscoped messages.
Now with this change, by defaul it tracks the flood.max setting, until
a user provides a flood.max.unscoped value, which tax precidence for
packets if ROUTE_TYPE_FLOOD is true.
AUTO_OFF_MILLIS is a power-save feature aimed at battery use. When the
board reports isExternalPowered() == true (USB or other DC source),
blanking the screen serves no purpose — there's nothing to conserve.
But OLEDs are vulnerable to burn-in with static content, so this
behaviour is gated behind a new build flag KEEP_DISPLAY_ON_USB. Default
is unchanged from upstream — the display blanks after AUTO_OFF_MILLIS
on USB or battery. Variants that ship with an LCD instead of an OLED
(e.g. heltec_t096) can opt in by adding -D KEEP_DISPLAY_ON_USB to
their env, gaining always-on-while-powered without exposing OLED users
to burn-in risk.
When the flag is enabled, the implementation refreshes _auto_off every
loop iteration while externally powered, so the timer naturally counts
a fresh AUTO_OFF_MILLIS window from the moment power is removed —
no instantaneous-blank-on-unplug.
Applied to all three companion_radio UI flavours (ui-new, ui-tiny,
ui-orig). Boards without an isExternalPowered() override use the
base-class default in MeshCore.h (returns false), so battery-powered
behaviour is unchanged everywhere.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Framework for upcoming variant-specific PRs that add LED feedback during boot. The hook gives users visual cues that the device is busy and
shouldn't be interacted with until startup completes.