From 42b7dcaa4266380d241b80566ad21d4d03090954 Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Fri, 27 Mar 2026 00:01:04 +0100 Subject: [PATCH] [fix](trx-rds): improve weak-signal sensitivity - Add single-bit flip fallback in search mode (push_bit_soft) so Block A can be acquired with one bit error, matching locked-mode OSD(1) behaviour - Lower MIN_PUBLISH_QUALITY 0.38 -> 0.20 for earlier publish on noisy signals Co-Authored-By: Claude Sonnet 4.6 Signed-off-by: Stan Grams --- src/decoders/trx-rds/src/lib.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/decoders/trx-rds/src/lib.rs b/src/decoders/trx-rds/src/lib.rs index dbe0d24..fb3e1db 100644 --- a/src/decoders/trx-rds/src/lib.rs +++ b/src/decoders/trx-rds/src/lib.rs @@ -17,7 +17,7 @@ const SEARCH_REG_MASK: u32 = (1 << 26) - 1; const PHASE_CANDIDATES: usize = 8; const BIPHASE_CLOCK_WINDOW: usize = 128; /// Minimum quality score to publish RDS state to the outer decoder. -const MIN_PUBLISH_QUALITY: f32 = 0.38; +const MIN_PUBLISH_QUALITY: f32 = 0.20; /// Tech 6: number of Block A observations before using accumulated PI. const PI_ACC_THRESHOLD: u8 = 3; /// Tech 5 — Costas loop proportional gain (per sample). @@ -394,7 +394,11 @@ impl Candidate { return None; } - let (data, kind) = decode_block(self.search_reg)?; + // Hard decode first; fall back to single-bit flip so we can acquire + // Block A on weak signals the same way locked-mode blocks are corrected. + let (data, kind) = decode_block(self.search_reg).or_else(|| { + (0..26usize).find_map(|k| decode_block(self.search_reg ^ (1 << (25 - k)))) + })?; if kind != BlockKind::A { return None; }