diff --git a/src/decoders/trx-wefax/src/tone_detect.rs b/src/decoders/trx-wefax/src/tone_detect.rs index affd0525..32744b4c 100644 --- a/src/decoders/trx-wefax/src/tone_detect.rs +++ b/src/decoders/trx-wefax/src/tone_detect.rs @@ -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; diff --git a/src/trx-client/trx-frontend/trx-frontend-http/examples/generate_typescript.rs b/src/trx-client/trx-frontend/trx-frontend-http/examples/generate_typescript.rs index 48b04a6c..963992c2 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/examples/generate_typescript.rs +++ b/src/trx-client/trx-frontend/trx-frontend-http/examples/generate_typescript.rs @@ -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; diff --git a/src/trx-core/src/lib.rs b/src/trx-core/src/lib.rs index 8c28709b..493aef1d 100644 --- a/src/trx-core/src/lib.rs +++ b/src/trx-core/src/lib.rs @@ -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; diff --git a/src/trx-core/src/rig/command.rs b/src/trx-core/src/rig/command.rs index 8b38d59c..84c299d8 100644 --- a/src/trx-core/src/rig/command.rs +++ b/src/trx-core/src/rig/command.rs @@ -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), diff --git a/src/trx-core/src/rig/state.rs b/src/trx-core/src/rig/state.rs index 4f71eb00..9a4af172 100644 --- a/src/trx-core/src/rig/state.rs +++ b/src/trx-core/src/rig/state.rs @@ -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); } } diff --git a/src/trx-server/src/rig_task.rs b/src/trx-server/src/rig_task.rs index 5bfb8690..c220d587 100644 --- a/src/trx-server/src/rig_task.rs +++ b/src/trx-server/src/rig_task.rs @@ -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")); diff --git a/src/trx-server/trx-backend/trx-backend-soapysdr/src/lib.rs b/src/trx-server/trx-backend/trx-backend-soapysdr/src/lib.rs index c3fe2774..6d3b1bd0 100644 --- a/src/trx-server/trx-backend/trx-backend-soapysdr/src/lib.rs +++ b/src/trx-server/trx-backend/trx-backend-soapysdr/src/lib.rs @@ -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. {