mirror of
https://github.com/hubaldv/bioz-host-rs.git
synced 2025-12-06 05:11:17 +00:00
Inluded frequency selector at start.
This commit is contained in:
@@ -64,7 +64,7 @@ async fn main() {
|
||||
}
|
||||
|
||||
["imp", "listen", freq, dur] => {
|
||||
let Ok(freq) = freq.parse::<f32>() else {
|
||||
let Ok(freq) = freq.parse::<u32>() else {
|
||||
println!("Bad freq: {freq}");
|
||||
continue;
|
||||
};
|
||||
@@ -81,6 +81,7 @@ async fn main() {
|
||||
client.start_impedancemeter(freq).await.unwrap();
|
||||
println!("Started!");
|
||||
let dur = Duration::from_millis(dur.into());
|
||||
|
||||
let start = Instant::now();
|
||||
while start.elapsed() < dur {
|
||||
let val = sub.recv().await.unwrap();
|
||||
@@ -90,9 +91,10 @@ async fn main() {
|
||||
println!("Stopped!");
|
||||
}
|
||||
["imp", "start", freq] => {
|
||||
let Ok(freq) = freq.parse::<f32>() else {
|
||||
let Ok(freq) = freq.parse::<u32>() else {
|
||||
println!("Bad freq: {freq}");
|
||||
continue;
|
||||
|
||||
};
|
||||
|
||||
match client.start_impedancemeter(freq).await {
|
||||
|
||||
@@ -8,7 +8,7 @@ use bioz_host_rs::communication::communicate_with_hardware;
|
||||
|
||||
use tokio::sync::mpsc::{self};
|
||||
|
||||
use bioz_host_rs::signals::FrequencySignal;
|
||||
use bioz_host_rs::signals::SingleFrequencySignal;
|
||||
|
||||
fn main() {
|
||||
SimpleLogger::new().init().expect("Failed to initialize logger");
|
||||
@@ -20,7 +20,7 @@ fn main() {
|
||||
// Enter the runtime so that `tokio::spawn` is available immediately.
|
||||
// let _enter = rt.enter();
|
||||
|
||||
let (run_impedancemeter_tx, run_impedancemeter_rx) = mpsc::channel::<FrequencySignal>(2);
|
||||
let (run_impedancemeter_tx, run_impedancemeter_rx) = mpsc::channel::<SingleFrequencySignal>(2);
|
||||
let run_impedancemeter_tx_clone = run_impedancemeter_tx.clone();
|
||||
|
||||
let app = App::new(run_impedancemeter_tx);
|
||||
|
||||
Reference in New Issue
Block a user