[fix](trx-rs): add EMA smoothing to signal strength and fix freq input clobbering
EMA (α=0.4) smooths the carrier power estimate across DSP blocks. Custom PartialEq on VchanRdsEntry excludes signal_db so rapidly-changing levels do not trigger main state SSE updates that overwrite the frequency input. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> Signed-off-by: Stan Grams <sjg@haxx.space>
This commit is contained in:
@@ -430,7 +430,11 @@ pub struct RdsData {
|
||||
}
|
||||
|
||||
/// RDS metadata snapshot for a virtual channel.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
///
|
||||
/// `PartialEq` intentionally ignores `signal_db` so that rapidly-changing
|
||||
/// signal levels do not cause the main state snapshot to diff on every poll
|
||||
/// cycle (signal_db flows through the spectrum SSE instead).
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct VchanRdsEntry {
|
||||
/// Virtual channel UUID.
|
||||
pub id: Uuid,
|
||||
@@ -442,6 +446,12 @@ pub struct VchanRdsEntry {
|
||||
pub signal_db: Option<f32>,
|
||||
}
|
||||
|
||||
impl PartialEq for VchanRdsEntry {
|
||||
fn eq(&self, other: &Self) -> bool {
|
||||
self.id == other.id && self.rds == other.rds
|
||||
}
|
||||
}
|
||||
|
||||
/// Read-only projection of state shared with clients.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
|
||||
pub struct RigSnapshot {
|
||||
|
||||
Reference in New Issue
Block a user