[refactor](trx-server): remove fir_taps from SDR config and rig_task
Drop fir_taps field from SdrChannelConfig and its default. Remove the SetFirTaps dispatch arm from rig_task. The DSP layer now auto-calculates tap count from audio_bandwidth_hz. Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Signed-off-by: Stanislaw Grams <stanislawgrams@gmail.com>
This commit is contained in:
@@ -382,8 +382,6 @@ pub struct SdrChannelConfig {
|
|||||||
pub mode: String,
|
pub mode: String,
|
||||||
/// One-sided bandwidth of the post-demod audio BPF (Hz).
|
/// One-sided bandwidth of the post-demod audio BPF (Hz).
|
||||||
pub audio_bandwidth_hz: u32,
|
pub audio_bandwidth_hz: u32,
|
||||||
/// FIR filter tap count. Higher = sharper roll-off. Default 64.
|
|
||||||
pub fir_taps: usize,
|
|
||||||
/// CW tone centre frequency in the audio domain (Hz). Default 700.
|
/// CW tone centre frequency in the audio domain (Hz). Default 700.
|
||||||
pub cw_center_hz: u32,
|
pub cw_center_hz: u32,
|
||||||
/// Pre-demod bandwidth for WFM only (Hz). Default 75000.
|
/// Pre-demod bandwidth for WFM only (Hz). Default 75000.
|
||||||
@@ -403,7 +401,6 @@ impl Default for SdrChannelConfig {
|
|||||||
offset_hz: 0,
|
offset_hz: 0,
|
||||||
mode: "auto".to_string(),
|
mode: "auto".to_string(),
|
||||||
audio_bandwidth_hz: 3000,
|
audio_bandwidth_hz: 3000,
|
||||||
fir_taps: 64,
|
|
||||||
cw_center_hz: 700,
|
cw_center_hz: 700,
|
||||||
wfm_bandwidth_hz: 75_000,
|
wfm_bandwidth_hz: 75_000,
|
||||||
decoders: Vec::new(),
|
decoders: Vec::new(),
|
||||||
|
|||||||
@@ -297,14 +297,14 @@ fn build_sdr_rig_from_instance(rig_cfg: &RigInstanceConfig) -> SdrRigBuildResult
|
|||||||
use trx_core::rig::AudioSource;
|
use trx_core::rig::AudioSource;
|
||||||
|
|
||||||
let args = rig_cfg.rig.access.args.as_deref().unwrap_or("");
|
let args = rig_cfg.rig.access.args.as_deref().unwrap_or("");
|
||||||
let mut channels: Vec<(f64, trx_core::rig::state::RigMode, u32, usize)> = rig_cfg
|
let mut channels: Vec<(f64, trx_core::rig::state::RigMode, u32)> = rig_cfg
|
||||||
.sdr
|
.sdr
|
||||||
.channels
|
.channels
|
||||||
.iter()
|
.iter()
|
||||||
.map(|ch| {
|
.map(|ch| {
|
||||||
let if_hz = (rig_cfg.sdr.center_offset_hz + ch.offset_hz) as f64;
|
let if_hz = (rig_cfg.sdr.center_offset_hz + ch.offset_hz) as f64;
|
||||||
let mode = parse_rig_mode(&ch.mode, &rig_cfg.rig.initial_mode);
|
let mode = parse_rig_mode(&ch.mode, &rig_cfg.rig.initial_mode);
|
||||||
(if_hz, mode, ch.audio_bandwidth_hz, ch.fir_taps)
|
(if_hz, mode, ch.audio_bandwidth_hz)
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
@@ -320,7 +320,6 @@ fn build_sdr_rig_from_instance(rig_cfg: &RigInstanceConfig) -> SdrRigBuildResult
|
|||||||
rig_cfg.sdr.center_offset_hz as f64,
|
rig_cfg.sdr.center_offset_hz as f64,
|
||||||
rig_cfg.rig.initial_mode.clone(),
|
rig_cfg.rig.initial_mode.clone(),
|
||||||
default_bw,
|
default_bw,
|
||||||
64,
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
let ais_channel_base_idx = channels.len();
|
let ais_channel_base_idx = channels.len();
|
||||||
@@ -359,7 +358,7 @@ fn build_sdr_rig_from_instance(rig_cfg: &RigInstanceConfig) -> SdrRigBuildResult
|
|||||||
// explicit VDES channel has been configured.
|
// explicit VDES channel has been configured.
|
||||||
let vdes_channel_idx = channels
|
let vdes_channel_idx = channels
|
||||||
.iter()
|
.iter()
|
||||||
.position(|(_, mode, _, _)| matches!(mode, trx_core::rig::state::RigMode::VDES))
|
.position(|(_, mode, _)| matches!(mode, trx_core::rig::state::RigMode::VDES))
|
||||||
.unwrap_or(0);
|
.unwrap_or(0);
|
||||||
let vdes_iq = sdr_rig.subscribe_iq_channel(vdes_channel_idx);
|
let vdes_iq = sdr_rig.subscribe_iq_channel(vdes_channel_idx);
|
||||||
// Extract the virtual channel manager before the rig is consumed by Box.
|
// Extract the virtual channel manager before the rig is consumed by Box.
|
||||||
|
|||||||
@@ -545,16 +545,6 @@ async fn process_command(
|
|||||||
let _ = ctx.state_tx.send(ctx.state.clone());
|
let _ = ctx.state_tx.send(ctx.state.clone());
|
||||||
return snapshot_from(ctx.state);
|
return snapshot_from(ctx.state);
|
||||||
}
|
}
|
||||||
RigCommand::SetFirTaps(taps) => {
|
|
||||||
if let Err(e) = ctx.rig.set_fir_taps(taps).await {
|
|
||||||
return Err(RigError::communication(format!("set_fir_taps: {e}")));
|
|
||||||
}
|
|
||||||
if let Some(f) = ctx.state.filter.as_mut() {
|
|
||||||
f.fir_taps = taps;
|
|
||||||
}
|
|
||||||
let _ = ctx.state_tx.send(ctx.state.clone());
|
|
||||||
return snapshot_from(ctx.state);
|
|
||||||
}
|
|
||||||
RigCommand::SetSdrGain(gain_db) => {
|
RigCommand::SetSdrGain(gain_db) => {
|
||||||
if let Err(e) = ctx.rig.set_sdr_gain(gain_db).await {
|
if let Err(e) = ctx.rig.set_sdr_gain(gain_db).await {
|
||||||
return Err(RigError::communication(format!("set_sdr_gain: {e}")));
|
return Err(RigError::communication(format!("set_sdr_gain: {e}")));
|
||||||
|
|||||||
Reference in New Issue
Block a user