From dba4d652f34b19aaceae7f58a0f7444091772104 Mon Sep 17 00:00:00 2001 From: Hubald Verzijl Date: Sun, 17 Aug 2025 19:04:46 +0200 Subject: [PATCH] Add units, change topic name. --- Cargo.lock | 7 +++++++ src/app.rs | 10 ++++------ src/bin/main_cli.rs | 2 +- src/bin/main_gui.rs | 1 + src/communication.rs | 2 +- 5 files changed, 14 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6c68fcc..cd12ccf 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -356,6 +356,12 @@ version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" +[[package]] +name = "atomic_float" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "628d228f918ac3b82fe590352cc719d30664a0c13ca3a60266fe02c7132d480a" + [[package]] name = "atspi" version = "0.25.0" @@ -431,6 +437,7 @@ dependencies = [ name = "bioz-host-rs" version = "0.1.0" dependencies = [ + "atomic_float", "bioz-icd-rs", "defmt", "eframe", diff --git a/src/app.rs b/src/app.rs index 27c9fa9..7caa774 100644 --- a/src/app.rs +++ b/src/app.rs @@ -117,15 +117,14 @@ impl eframe::App for App { egui::vec2(ui.available_width(), half_height), Layout::top_down(egui::Align::Min), |ui| { - // Magnitude and phase + // Magnitude let magnitude = self.magnitude_series.lock().unwrap(); - let phase = self.phase_series.lock().unwrap(); Plot::new("magnitude") .allow_scroll(false) .allow_drag(false) // .center_y_axis(true) .legend(Legend::default().position(Corner::LeftTop)) - .y_axis_label("Value [...]") + .y_axis_label("Magnitude [Ω]") .y_axis_min_width(2.0) .show(ui, |plot_ui| { plot_ui.line( @@ -140,15 +139,14 @@ impl eframe::App for App { egui::vec2(ui.available_width(), half_height), Layout::top_down(egui::Align::Min), |ui| { - // Magnitude and phase - let magnitude = self.magnitude_series.lock().unwrap(); + // Phase let phase = self.phase_series.lock().unwrap(); Plot::new("phase") .allow_scroll(false) .allow_drag(false) // .center_y_axis(true) .legend(Legend::default().position(Corner::LeftTop)) - .y_axis_label("Value [...]") + .y_axis_label("Phase [rad]") .y_axis_min_width(2.0) .show(ui, |plot_ui| { plot_ui.line( diff --git a/src/bin/main_cli.rs b/src/bin/main_cli.rs index 0c8c25e..731e8cf 100644 --- a/src/bin/main_cli.rs +++ b/src/bin/main_cli.rs @@ -75,7 +75,7 @@ async fn main() { let mut sub = client .client - .subscribe_multi::(8) + .subscribe_multi::(8) .await .unwrap(); client.start_impedancemeter(freq).await.unwrap(); diff --git a/src/bin/main_gui.rs b/src/bin/main_gui.rs index 5f96680..c56e024 100644 --- a/src/bin/main_gui.rs +++ b/src/bin/main_gui.rs @@ -29,6 +29,7 @@ fn main() { let magnitude_series_clone = app.magnitude_series.clone(); let phase_series_clone = app.phase_series.clone(); let connected_clone = app.connected.clone(); + let data_frequency_clone = app.data_frequency.clone(); // Execute the runtime in its own thread. diff --git a/src/communication.rs b/src/communication.rs index 969a35e..99d30c1 100644 --- a/src/communication.rs +++ b/src/communication.rs @@ -60,7 +60,7 @@ pub async fn communicate_with_hardware( let mut sub = workbook_client .client - .subscribe_multi::(8) + .subscribe_multi::(8) .await .unwrap();