[style](trx-rs): cargo fmt
Apply rustfmt to the wefax and DIG-sideband changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01UiK871ht2uPFBHtMbxy3wD Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -77,11 +77,11 @@ pub struct ToneDetector {
|
||||
|
||||
impl ToneDetector {
|
||||
pub fn new(sample_rate: u32) -> Self {
|
||||
let window_size = (sample_rate / 2) as usize; // ~0.5 s window
|
||||
// APT start/stop tones are transmitted for ~5 s (WMO), so requiring a
|
||||
// 2 s sustain costs no real detection latency while sharply cutting
|
||||
// false positives from busy image content that momentarily produces a
|
||||
// 300/450/675-transitions-per-second rate.
|
||||
let window_size = (sample_rate / 2) as usize; // ~0.5 s window
|
||||
let min_sustain_s = 2.0;
|
||||
let window_duration_s = window_size as f32 / sample_rate as f32;
|
||||
let min_sustain_windows = (min_sustain_s / window_duration_s).ceil() as u32;
|
||||
|
||||
@@ -13,7 +13,8 @@ use trx_core::rig::{
|
||||
RigVfoEntry,
|
||||
};
|
||||
use trx_core::{
|
||||
DecoderConfig, DigSidebandPolicy, RdsData, RigFilterState, RigMode, RigSnapshot, WfmDenoiseLevel,
|
||||
DecoderConfig, DigSidebandPolicy, RdsData, RigFilterState, RigMode, RigSnapshot,
|
||||
WfmDenoiseLevel,
|
||||
};
|
||||
use trx_frontend_http::server::api::rig::{RigListItem, RigListResponse};
|
||||
use trx_frontend_http::server::api::FrontendMeta;
|
||||
|
||||
@@ -16,7 +16,7 @@ pub use rig::command::RigCommand;
|
||||
pub use rig::request::RigRequest;
|
||||
pub use rig::response::{RigError, RigResult};
|
||||
pub use rig::state::{
|
||||
DecoderConfig, DecoderResetSeqs, RdsData, RigFilterState, RigMode, RigSnapshot, RigState,
|
||||
DigSidebandPolicy, WfmDenoiseLevel,
|
||||
DecoderConfig, DecoderResetSeqs, DigSidebandPolicy, RdsData, RigFilterState, RigMode,
|
||||
RigSnapshot, RigState, WfmDenoiseLevel,
|
||||
};
|
||||
pub use rig::AudioSource;
|
||||
|
||||
@@ -48,8 +48,14 @@ pub enum RigCommand {
|
||||
SetSdrGain(f64),
|
||||
SetSdrLnaGain(f64),
|
||||
SetSdrAgc(bool),
|
||||
SetSdrSquelch { enabled: bool, threshold_db: f64 },
|
||||
SetSdrNoiseBlanker { enabled: bool, threshold: f64 },
|
||||
SetSdrSquelch {
|
||||
enabled: bool,
|
||||
threshold_db: f64,
|
||||
},
|
||||
SetSdrNoiseBlanker {
|
||||
enabled: bool,
|
||||
threshold: f64,
|
||||
},
|
||||
/// Set how the SDR backend resolves DIG mode to a sideband (SDR only).
|
||||
SetSdrDigSideband(DigSidebandPolicy),
|
||||
SetWfmDeemphasis(u32),
|
||||
|
||||
@@ -646,8 +646,14 @@ mod dig_sideband_tests {
|
||||
assert_eq!(DigSidebandPolicy::from_u8(p.to_u8()), p);
|
||||
}
|
||||
assert_eq!(DigSidebandPolicy::from_u8(200), DigSidebandPolicy::Auto);
|
||||
assert_eq!(DigSidebandPolicy::parse("USB"), Some(DigSidebandPolicy::Usb));
|
||||
assert_eq!(DigSidebandPolicy::parse(" lsb "), Some(DigSidebandPolicy::Lsb));
|
||||
assert_eq!(
|
||||
DigSidebandPolicy::parse("USB"),
|
||||
Some(DigSidebandPolicy::Usb)
|
||||
);
|
||||
assert_eq!(
|
||||
DigSidebandPolicy::parse(" lsb "),
|
||||
Some(DigSidebandPolicy::Lsb)
|
||||
);
|
||||
assert_eq!(DigSidebandPolicy::parse("nonsense"), None);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -777,7 +777,9 @@ async fn process_command(
|
||||
RigCommand::SetSdrDigSideband(policy) => {
|
||||
if let Some(sdr) = ctx.rig.as_sdr() {
|
||||
if let Err(e) = sdr.set_sdr_dig_sideband(policy).await {
|
||||
return Err(RigError::communication(format!("set_sdr_dig_sideband: {e}")));
|
||||
return Err(RigError::communication(format!(
|
||||
"set_sdr_dig_sideband: {e}"
|
||||
)));
|
||||
}
|
||||
} else {
|
||||
return Err(RigError::not_supported("set_sdr_dig_sideband"));
|
||||
|
||||
@@ -382,7 +382,8 @@ impl SoapySdrRig {
|
||||
// Concrete demod mode the primary channel starts in. For DIG this
|
||||
// resolves the configured sideband policy against the initial dial
|
||||
// frequency so the very first image/audio uses the right sideband.
|
||||
let initial_primary_mode = effective_demod_mode(&initial_mode, dig_sideband, initial_freq.hz);
|
||||
let initial_primary_mode =
|
||||
effective_demod_mode(&initial_mode, dig_sideband, initial_freq.hz);
|
||||
let initial_is_dig = initial_mode == RigMode::DIG;
|
||||
|
||||
let rig = Self {
|
||||
@@ -680,7 +681,8 @@ impl RigCat for SoapySdrRig {
|
||||
// DIG carries no inherent sideband: resolve it to a concrete
|
||||
// USB/LSB demodulator from the policy + dial frequency. The logical
|
||||
// DIG mode is kept in `self.mode` (and RigState) for display.
|
||||
let effective = effective_demod_mode(&self.mode, self.channel_manager.dig_policy(), self.freq.hz);
|
||||
let effective =
|
||||
effective_demod_mode(&self.mode, self.channel_manager.dig_policy(), self.freq.hz);
|
||||
self.applied_primary_mode = effective.clone();
|
||||
// Update the primary channel's demodulator in the live pipeline.
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user