From 893f8ddd97dac0db375175f34eb5b108df34b7d7 Mon Sep 17 00:00:00 2001 From: Federico Lolli <federico.lolli@skywarder.eu> Date: Sun, 13 Apr 2025 19:14:14 +0200 Subject: [PATCH] fixed reception_led widget flickering --- src/message_broker.rs | 2 +- src/ui/widgets/reception_led.rs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/message_broker.rs b/src/message_broker.rs index ddf1c17..4ee02ca 100644 --- a/src/message_broker.rs +++ b/src/message_broker.rs @@ -23,7 +23,7 @@ use crate::{ mavlink::{MavFrame, MavHeader, MavMessage, MavlinkVersion, TimedMessage}, }; -const RECEPTION_QUEUE_INTERVAL: Duration = Duration::from_secs(1); +const RECEPTION_QUEUE_INTERVAL: Duration = Duration::from_secs(3); const SEGS_SYSTEM_ID: u8 = 1; const SEGS_COMPONENT_ID: u8 = 1; diff --git a/src/ui/widgets/reception_led.rs b/src/ui/widgets/reception_led.rs index 4c064ea..6e30c0d 100644 --- a/src/ui/widgets/reception_led.rs +++ b/src/ui/widgets/reception_led.rs @@ -38,12 +38,12 @@ impl ReceptionLed { } fn show_label(&self, ui: &mut Ui) -> Response { - if self.active { - let text = format!("{} Hz", self.frequency); - ui.label(text) + let text = if self.frequency > 0.0 { + format!("{:.2} msgs/s", self.frequency) } else { - ui.label("N/A") - } + "N/A".to_owned() + }; + ui.label(text) } } -- GitLab