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

@@ -25,6 +25,7 @@ pub async fn communicate_with_hardware(
bode_series: Arc<Mutex<BodePlot>>,
connected: Arc<AtomicBool>,
data_frequency: Arc<AtomicF32>,
periods_per_dft: Arc<Mutex<Option<f32>>>,
) {
let data_counter = Arc::new(AtomicU32::new(0));
let data_counter_clone = data_counter.clone();
@@ -113,13 +114,22 @@ pub async fn communicate_with_hardware(
loop {
select! {
Some(frequency) = run_impedancemeter_rx.recv() => {
match frequency {
match frequency {
StartStopSignal::StartSingle(freq, dft_num) => {
if let Err(e) = workbook_client.start_impedancemeter_single(freq, dft_num).await {
error!("Failed to start impedancemeter: {:?}", e);
} else {
settings.frequency = Some(StartStopSignal::StartSingle(freq, dft_num));
info!("Impedancemeter started at frequency: {}", freq);
match workbook_client.start_impedancemeter_single(freq, dft_num).await {
Ok(Ok(periods)) => {
info!("Impedance meter started at frequency: {} with periods per DFT: {}", freq, periods);
settings.frequency = Some(StartStopSignal::StartSingle(freq, dft_num));
*periods_per_dft.lock().unwrap() = Some(periods);
},
Ok(Err(e)) => {
error!("Failed to init on hardware: {:?}", e);
*periods_per_dft.lock().unwrap() = None;
},
Err(e) => {
error!("Communication error when starting impedancemeter: {:?}", e);
*periods_per_dft.lock().unwrap() = None;
}
}
},
StartStopSignal::StartMulti(dft_num, num_points) => {