Added log and automatic reconnect.

This commit is contained in:
2025-08-12 11:59:10 +02:00
parent 0b55cdf8b8
commit 961e6cc34a
7 changed files with 193 additions and 84 deletions

View File

@@ -8,7 +8,13 @@ use bioz_host_rs::{client::WorkbookClient, icd, read_line};
#[tokio::main]
async fn main() {
println!("Connecting to USB device...");
let client = WorkbookClient::new();
let client = match WorkbookClient::new() {
Ok(client) => client,
Err(e) => {
eprintln!("Failed to connect to USB device: {}", e);
return;
}
};
for i in 0..10 {

View File

@@ -1,3 +1,5 @@
use simple_logger::SimpleLogger;
use log::info;
use tokio::runtime::Runtime;
use bioz_host_rs::app::App;
@@ -7,7 +9,10 @@ use bioz_host_rs::communication::communicate_with_hardware;
use tokio::sync::mpsc::{self};
fn main() {
SimpleLogger::new().init().expect("Failed to initialize logger");
log::set_max_level(log::LevelFilter::Info);
info!("Starting Bioz Impedance Visualizer...");
let rt = Runtime::new().expect("Unable to create Runtime");
// Enter the runtime so that `tokio::spawn` is available immediately.