[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 <noreply@anthropic.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-03-27 00:01:04 +01:00
parent d1703f6b0a
commit 42b7dcaa42
+6 -2
View File
@@ -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;
}