Show periods per DFT in GUI.

This commit is contained in:
2025-10-07 12:59:28 +02:00
parent e71b02477a
commit 26e9c4dcab
4 changed files with 44 additions and 10 deletions

View File

@@ -47,6 +47,7 @@ pub struct App {
pub data_frequency: Arc<AtomicF32>,
pub single_frequency: Arc<Mutex<u32>>,
pub dft_num: Arc<Mutex<IcdDftNum>>,
pub periods_per_dft: Arc<Mutex<Option<f32>>>,
}
struct TabViewer {
@@ -58,6 +59,7 @@ struct TabViewer {
on: Arc<Mutex<bool>>,
single_frequency: Arc<Mutex<u32>>,
dft_num: Arc<Mutex<IcdDftNum>>,
periods_per_dft: Arc<Mutex<Option<f32>>>,
show_settings: bool,
show_settings_toggle: Option<bool>,
}
@@ -93,6 +95,22 @@ impl TabViewer {
};
});
});
ui.add_enabled_ui(*on, |ui| {
ui.horizontal(|ui| {
ui.label("Periods per DFT:");
match (*on, *self.periods_per_dft.lock().unwrap()) {
(true, Some(periods)) => {
ui.add(Label::new(format!("{:.2}", periods)));
},
(true, None) => {
ui.add(Label::new("N/A"));
},
(false, _) => {
ui.add(Label::new("Start to determine!"));
}
}
});
});
}
});
@@ -337,6 +355,7 @@ impl App {
let bode_plot = Arc::new(Mutex::new(BodePlot::new()));
let single_frequency = Arc::new(Mutex::new(50000));
let dft_num = Arc::new(Mutex::new(IcdDftNum::Num2048));
let periods_per_dft = Arc::new(Mutex::new(None));
let on = Arc::new(Mutex::new(true));
let tab_active = TabActive::Single;
@@ -349,6 +368,7 @@ impl App {
bode_plot: bode_plot.clone(),
single_frequency: single_frequency.clone(),
dft_num: dft_num.clone(),
periods_per_dft: periods_per_dft.clone(),
on: on.clone(),
show_settings: false,
show_settings_toggle: None,
@@ -370,6 +390,7 @@ impl App {
data_frequency: Arc::new(AtomicF32::new(0.0)),
single_frequency,
dft_num,
periods_per_dft,
};
// For testing purposes, populate the Bode plot with a sample low-pass filter response