From 0e8e1d1b9d015dc650c4c8240d40d77698b08b30 Mon Sep 17 00:00:00 2001 From: Daniel Peter Chokola Date: Sun, 8 Nov 2026 20:45:20 -0500 Subject: [PATCH] libchirpmodem: no failure report for a sync on the tail of a decoded frame A strong frame's last pilot is an up-chirp. The detector and sync can lock onto it again within a symbol of the frame's end, the time shift showing as a large frequency offset; nothing follows, so the header fails and a "preamble found, header fail" was reported. Seen once in SDRangel at +17 dB (sync 55 chips before the end, offset -22.8 kHz) and reproduced from the recording at 150 kS/s: two such reports, syncs at -55 and +341 chips from the frame end. The existing check only dropped syncs more than M/2 before the end. A failed candidate whose sync starts before one symbol after the end of the frame just decoded is now a false alarm: not counted, not reported. Candidates there are still tried, so a real frame starting back to back is delivered as before. Decoded frames are identical on all captures; back-to-back frames (gap 0, SF9 and SF7 coherent, clean to -8 dB) decode 6/6 with old and new. make test and tools/check_c.py pass. Co-Authored-By: Claude Opus 5.5 --- c/src/cm_stream.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/c/src/cm_stream.c b/c/src/cm_stream.c index 6878bf8..b33923c 100644 --- a/c/src/cm_stream.c +++ b/c/src/cm_stream.c @@ -480,6 +480,13 @@ static void service(stream_t *s) s->busy_until = (long)start + r.frame_chips; deliver(s, &r, t); } else { + /* A strong frame's last pilot (an up-chirp) can sync again just + * around its end, the time shift showing as a frequency offset. + * Nothing follows it, so its header fails. A real frame starting + * there, back to back, is still tried above and delivered if it + * decodes; only the failure is treated as the false alarm it is. */ + if (s->n_ok > 0 && start < s->busy_until + M) + continue; s->n_fail++; if (s->cfg.report_failures) deliver(s, &r, t);