From ef1fabece8aa82a15afdafd4f46f79436309baf1 Mon Sep 17 00:00:00 2001 From: Stan Grams Date: Mon, 3 Aug 2026 22:56:46 +0200 Subject: [PATCH] [chore](trx-rs): apply cargo fmt Signed-off-by: Stan Grams --- .../trx-frontend/trx-frontend-http/src/auth.rs | 5 ++++- .../trx-backend-soapysdr/src/dsp/channel.rs | 15 ++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/trx-client/trx-frontend/trx-frontend-http/src/auth.rs b/src/trx-client/trx-frontend/trx-frontend-http/src/auth.rs index b486c8ce..784f4df1 100644 --- a/src/trx-client/trx-frontend/trx-frontend-http/src/auth.rs +++ b/src/trx-client/trx-frontend/trx-frontend-http/src/auth.rs @@ -705,7 +705,10 @@ mod tests { assert_eq!(RouteAccess::from_path("/app.js"), RouteAccess::Public); // Static reference data, served to every role: ".json" is not in the // asset suffix list, so this one has to be named. - assert_eq!(RouteAccess::from_path("/bandplan.json"), RouteAccess::Public); + assert_eq!( + RouteAccess::from_path("/bandplan.json"), + RouteAccess::Public + ); } #[test] diff --git a/src/trx-server/trx-backend/trx-backend-soapysdr/src/dsp/channel.rs b/src/trx-server/trx-backend/trx-backend-soapysdr/src/dsp/channel.rs index fd23fedc..c8fe489e 100644 --- a/src/trx-server/trx-backend/trx-backend-soapysdr/src/dsp/channel.rs +++ b/src/trx-server/trx-backend/trx-backend-soapysdr/src/dsp/channel.rs @@ -837,12 +837,6 @@ impl ChannelDsp { } } - let signal_power = decimated - .iter() - .map(|s| s.re * s.re + s.im * s.im) - .sum::() - / decimated.len() as f32; - let signal_db = 10.0 * signal_power.max(1e-12).log10(); const WFM_OUTPUT_GAIN: f32 = 0.50; let mut audio = if let Some(decoder) = self.wfm_decoder.as_mut() { let mut out = decoder.process_iq(decimated); @@ -884,7 +878,14 @@ impl ChannelDsp { raw } }; - if !self.squelch.update(&self.mode, signal_db) { + // Against the meter reading, not the block level after the IQ AGC. + // The threshold arrives in the scale the operator sets it from — the + // S-meter and the spectrum — while the level measured here had been + // through the AGC, whose whole job is to hold it at a setpoint. For + // every mode that has one (FM, PKT, AIS, AM, SAM) the squelch was + // therefore comparing against a near-constant, and for the rest it was + // still off by the decimation correction the meter applies. + if !self.squelch.update(&self.mode, self.last_signal_db) { audio.fill(0.0); }