From 96beae275e5189255926e2570cb7d484515c6b86 Mon Sep 17 00:00:00 2001 From: mattbk Date: Sat, 12 Sep 2026 18:08:30 -0500 Subject: [PATCH] Working snapshot with modified local riglib. --- .gitignore | 1 + Cargo.lock | 9 --------- Cargo.toml | 3 ++- src/main.rs | 32 +++++++++++++++++++++++--------- 4 files changed, 26 insertions(+), 19 deletions(-) diff --git a/.gitignore b/.gitignore index 0a25f36..618d5c2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /target /out +/riglib \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 702acde..7e75193 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1269,7 +1269,6 @@ dependencies = [ [[package]] name = "riglib" version = "0.1.0" -source = "git+https://github.com/chadsbrown/riglib.git#b8adc13dc715652470509ae5ec6965ab8a2b8aa9" dependencies = [ "riglib-core", "riglib-elecraft", @@ -1283,7 +1282,6 @@ dependencies = [ [[package]] name = "riglib-core" version = "0.1.0" -source = "git+https://github.com/chadsbrown/riglib.git#b8adc13dc715652470509ae5ec6965ab8a2b8aa9" dependencies = [ "async-trait", "thiserror", @@ -1293,7 +1291,6 @@ dependencies = [ [[package]] name = "riglib-elecraft" version = "0.1.0" -source = "git+https://github.com/chadsbrown/riglib.git#b8adc13dc715652470509ae5ec6965ab8a2b8aa9" dependencies = [ "async-trait", "bytes", @@ -1308,7 +1305,6 @@ dependencies = [ [[package]] name = "riglib-flex" version = "0.1.0" -source = "git+https://github.com/chadsbrown/riglib.git#b8adc13dc715652470509ae5ec6965ab8a2b8aa9" dependencies = [ "async-trait", "bytes", @@ -1322,7 +1318,6 @@ dependencies = [ [[package]] name = "riglib-icom" version = "0.1.0" -source = "git+https://github.com/chadsbrown/riglib.git#b8adc13dc715652470509ae5ec6965ab8a2b8aa9" dependencies = [ "async-trait", "bytes", @@ -1337,7 +1332,6 @@ dependencies = [ [[package]] name = "riglib-kenwood" version = "0.1.0" -source = "git+https://github.com/chadsbrown/riglib.git#b8adc13dc715652470509ae5ec6965ab8a2b8aa9" dependencies = [ "async-trait", "bytes", @@ -1352,7 +1346,6 @@ dependencies = [ [[package]] name = "riglib-text-io" version = "0.1.0" -source = "git+https://github.com/chadsbrown/riglib.git#b8adc13dc715652470509ae5ec6965ab8a2b8aa9" dependencies = [ "riglib-core", "tokio", @@ -1363,7 +1356,6 @@ dependencies = [ [[package]] name = "riglib-transport" version = "0.1.0" -source = "git+https://github.com/chadsbrown/riglib.git#b8adc13dc715652470509ae5ec6965ab8a2b8aa9" dependencies = [ "async-trait", "riglib-core", @@ -1376,7 +1368,6 @@ dependencies = [ [[package]] name = "riglib-yaesu" version = "0.1.0" -source = "git+https://github.com/chadsbrown/riglib.git#b8adc13dc715652470509ae5ec6965ab8a2b8aa9" dependencies = [ "async-trait", "bytes", diff --git a/Cargo.toml b/Cargo.toml index d487dcc..4685884 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,7 +11,8 @@ io = "0.0.2" iter = "0.1.0" nmea = "0.8.0" serialport = "4.10.0" -riglib = { git = "https://github.com/chadsbrown/riglib.git" } +#riglib = { git = "https://github.com/chadsbrown/riglib.git" } +riglib = {path = "riglib/crates/riglib"} tokio = { version = "1", features = ["full"] } anyhow = "1.0.104" diff --git a/src/main.rs b/src/main.rs index 68a4c17..444729c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,9 +11,10 @@ use std::io::ErrorKind; use std::io::Write; use std::thread::sleep; use std::time::Duration; -use riglib::{Rig as Rig_riglib, ReceiverId, RigEvent}; +use riglib::{Rig as Rig_riglib, ReceiverId}; use riglib::kenwood::KenwoodBuilder; -use riglib::kenwood::models::ts_590s; +use riglib::kenwood::models::ts_890s; +use riglib::s_units_from_dbm; /// Command-line arguments using Clap. #[derive(Parser, Debug)] @@ -333,7 +334,7 @@ async fn main() -> anyhow::Result<()> { println!("Press Ctrl + C to quit"); - let rig1 = KenwoodBuilder::new(ts_590s()) + let rig1 = KenwoodBuilder::new(ts_890s()) .serial_port(&com) .build() .await?; @@ -341,6 +342,12 @@ async fn main() -> anyhow::Result<()> { let info = rig1.info(); println!("Connected: {} {}\n", info.manufacturer, info.model_name); let rx = ReceiverId::VFO_A; + dbg!(rx); + let freq = rig1.get_frequency(ReceiverId::VFO_A).await?; + println!("VFO-A: {} Hz", freq); + //rig1.set_frequency(ReceiverId::VFO_A,).await?; + // let s_val = rig1.get_s_meter(rx).await?; + // println!("{s_val}"); // Simple test loop to make sure we are getting values each time //for _i in 1..11 { @@ -351,14 +358,21 @@ async fn main() -> anyhow::Result<()> { let date = Local::now(); // Get S-meter //let s_val = get_smeter(&com, &rig_name, frequency); - let s_val = rig1.get_s_meter(rx).await?; + let s_val = rig1.get_s_meter(rx).await?; // this is failing on the QMX using TS-890 unless I mess with source + let s_units = s_units_from_dbm(s_val); //println!("{a}"); - let n = s_val as i32; + let s_val_i = s_val as i32; + // dbg!(n); println!( - "{} {} {}", + "{} {:04} {} {}", date.format("%Y-%m-%d %H:%M:%S").to_string(), - s_val, - "#".repeat(n.try_into().unwrap()) + s_val_i, + if s_val_i > 0 { + "#".repeat(s_val_i.try_into().unwrap()) + } else { + "".to_string() + }, + s_units ); // match s_val { // // Simple graph as we go. Eventually this will be replaced. @@ -379,7 +393,7 @@ async fn main() -> anyhow::Result<()> { format!("{:09}", frequency), format!("{:.8}", ll[0]), format!("{:.8}", ll[1]), - s_val.to_string(), + s_val_i.to_string(), ], &file_out, "csv",