mirror of
https://github.com/hubaldv/bioz-host-rs.git
synced 2025-12-06 05:11:17 +00:00
Added log and automatic reconnect.
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user