diff --git a/Cargo.lock b/Cargo.lock index ae92782..a0bfaa0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -692,6 +692,12 @@ version = "1.70.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" +[[package]] +name = "iter" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3b2e3c8e73c68d760d0c421025a2b740727f1e807bd4a3d6de2ceb886c5dcb9" + [[package]] name = "konst" version = "0.2.20" @@ -889,6 +895,7 @@ version = "0.1.0" dependencies = [ "clap", "io", + "iter", "serialport", ] diff --git a/Cargo.toml b/Cargo.toml index 2ecce22..1d1b537 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,5 +6,6 @@ edition = "2024" [dependencies] clap = "4.6.6" io = "0.0.2" +iter = "0.1.0" serialport = "4.10.0" diff --git a/src/main.rs b/src/main.rs index 68e92fa..322b989 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,6 +5,7 @@ use std::io::ErrorKind; use std::io::Write; use std::thread::sleep; use std::time::Duration; +use core::iter::repeat; fn get_smeter(comport: &str) -> String { let mut port = serialport::new(comport, 4800) @@ -58,6 +59,10 @@ fn main() { // Simple test loop to make sure we are getting values each time for _i in 1..101 { let a = get_smeter(port); - println!("{a}"); + //println!("{a}"); + match a.parse::() { + Ok(n) => println!("{} {}", a, "#".repeat(n.try_into().unwrap())), + Err(e) => todo!(), + } } }