mirror of
https://github.com/hubaldv/bioz-host-rs.git
synced 2026-03-10 01:20:31 +00:00
Show periods per DFT in GUI.
This commit is contained in:
21
src/app.rs
21
src/app.rs
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user