feat(repeater/analyzer): multi-path join key + prefer direct 0-hop path

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>
This commit is contained in:
tthandClaude Opus 4.8 committed 2026-07-12 18:47:44 +02:00
1 parent d882f6c4bd
commit dd2642dc0e
2 files changed
+61 -24

No files matched your search

+8 -1
View File
@@ -99,6 +99,9 @@ struct NeighbourInfo {
#ifndef ANALYZER_PATH_LEN
#define ANALYZER_PATH_LEN 16 // max hop-hash bytes kept per record
#endif
#ifndef HEARD_DIRECT_TTL_SECS
#define HEARD_DIRECT_TTL_SECS 3600 // keep showing a node as direct (0-hop) this long after last hearing it direct
#endif
#if MAX_HEARD_NODES
struct HeardNode {
@@ -107,10 +110,14 @@ struct HeardNode {
int32_t lat, lon; // degrees x 1e6, 0 = unknown
uint32_t heard_timestamp; // epoch when last heard (0 = empty slot)
uint32_t advert_timestamp; // advert's own timestamp (newest wins)
uint32_t pkt_hash; // FNV of the latest advert (type||payload) -- JOIN KEY:
// group rxlog records by this to get every path the
// advert arrived by (rxlog logs all copies pre-dedup)
uint32_t direct_heard; // epoch we last heard this node 0-hop (0 = never)
int8_t snr; // x4
int8_t rssi; // dBm
uint8_t type; // ADV_TYPE_*
uint8_t path_len; // bit-packed (hash size|count) as heard
uint8_t path_len; // bit-packed (hash size|count); representative/best path
uint8_t path[ANALYZER_PATH_LEN];
};
#endif