mirror of
https://github.com/hubaldv/bioz-host-rs.git
synced 2025-12-06 05:11:17 +00:00
Show periods per DFT in GUI.
This commit is contained in:
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user