[feat](trx-rds,trx-frontend-http): reset rds on tune changes

Co-authored-by: Codex <codex@openai.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-02-28 11:31:42 +01:00
parent e886f97eb9
commit b0bf9e3ee0
6 changed files with 67 additions and 7 deletions
@@ -149,6 +149,10 @@ impl WfmStereoDecoder {
pub fn rds_data(&self) -> Option<RdsData> {
self.rds_decoder.snapshot()
}
pub fn reset_rds(&mut self) {
self.rds_decoder.reset();
}
}
/// Selects the demodulation algorithm for a channel.
@@ -502,6 +502,12 @@ impl ChannelDsp {
self.wfm_decoder.as_ref().and_then(WfmStereoDecoder::rds_data)
}
pub fn reset_rds(&mut self) {
if let Some(decoder) = &mut self.wfm_decoder {
decoder.reset_rds();
}
}
/// Process a block of raw IQ samples through the full DSP chain.
///
/// 1. **Batch mixer**: compute the full LO signal for the block at once,
@@ -252,6 +252,7 @@ impl RigCat for SoapySdrRig {
) -> Pin<Box<dyn std::future::Future<Output = DynResult<()>> + Send + 'a>> {
Box::pin(async move {
tracing::debug!("SoapySdrRig: set_freq -> {} Hz", freq.hz);
let freq_changed = self.freq.hz != freq.hz;
self.freq = freq;
let half_span_hz = i128::from(self.pipeline.sdr_sample_rate) / 2;
let current_center_hz = i128::from(self.center_hz);
@@ -271,7 +272,11 @@ impl RigCat for SoapySdrRig {
if let Some(dsp_arc) = self.pipeline.channel_dsps.get(self.primary_channel_idx) {
let channel_if_hz = (self.freq.hz as i64 - self.center_hz) as f64;
dsp_arc.lock().unwrap().set_channel_if_hz(channel_if_hz);
let mut dsp = dsp_arc.lock().unwrap();
dsp.set_channel_if_hz(channel_if_hz);
if freq_changed {
dsp.reset_rds();
}
}
Ok(())
})