[fix](trx-rs): show signal strength with decimal precision

Change RigRxStatus.sig from i32 to f64 and add get_signal_strength_db
to RigCat trait so SDR backends can bypass the coarse 0..15 quantisation.
Compensate for decimation processing gain so the meter matches the
spectrum peak. Display with one decimal place in all units.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
2026-03-27 20:06:36 +01:00
parent d468a96448
commit 0efdb5e360
6 changed files with 44 additions and 13 deletions
+1 -1
View File
@@ -307,7 +307,7 @@ impl RigMachineState {
tx_en: true,
vfo: data.vfo.clone(),
tx: data.tx.clone(),
rx: Some(RigRxStatus { sig: Some(0) }),
rx: Some(RigRxStatus { sig: Some(0.0) }),
lock: Some(data.locked),
}),
_ => None,
+11 -2
View File
@@ -125,6 +125,15 @@ pub trait RigCat: Rig + Send {
&'a mut self,
) -> Pin<Box<dyn Future<Output = DynResult<u8>> + Send + 'a>>;
/// Return precise signal strength in dBm/dBFS as a float.
/// Backends with continuous measurements (e.g. SDR) override this
/// to bypass the coarse 0..15 quantisation of `get_signal_strength`.
fn get_signal_strength_db<'a>(
&'a mut self,
) -> Pin<Box<dyn Future<Output = Option<f64>> + Send + 'a>> {
Box::pin(std::future::ready(None))
}
fn get_tx_power<'a>(&'a mut self) -> Pin<Box<dyn Future<Output = DynResult<u8>> + Send + 'a>>;
fn get_tx_limit<'a>(&'a mut self) -> Pin<Box<dyn Future<Output = DynResult<u8>> + Send + 'a>>;
@@ -343,9 +352,9 @@ pub struct RigTxStatus {
pub alc: Option<u8>,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
pub struct RigRxStatus {
pub sig: Option<i32>,
pub sig: Option<f64>,
}
/// Configurable control settings that can be pushed to the rig.