Snapshot.

This commit is contained in:
mattbk
2026-09-12 11:27:01 -05:00
parent 8337ed478d
commit 66eeceb728
2 changed files with 10 additions and 8 deletions
+8 -6
View File
@@ -115,10 +115,11 @@ struct Rig {
data_bits: DataBits,
stop_bits: StopBits,
parity: Parity,
s_meter_cat: String
}
// Create a rig struct
fn build_rig(name: &str, baud_rate: u32, data_bits: u8, stop_bits: u8, parity: &str) -> Rig {
fn build_rig(name: &str, baud_rate: u32, data_bits: u8, stop_bits: u8, parity: &str, s_meter_cat: &str) -> Rig {
Rig {
name: name.to_string(),
baud_rate,
@@ -139,7 +140,8 @@ fn build_rig(name: &str, baud_rate: u32, data_bits: u8, stop_bits: u8, parity: &
"odd" => Parity::Odd,
"even" => Parity::Even,
_ => Parity::None,
}
},
s_meter_cat: s_meter_cat.to_string()
}
}
@@ -147,12 +149,12 @@ fn build_rig(name: &str, baud_rate: u32, data_bits: u8, stop_bits: u8, parity: &
// https://kevinlynagh.com/notes/match-vs-lookup/
fn get_rig(x: &str) -> Rig {
match x {
"qmx" => build_rig("qmx", 4800, 8, 2, "none"),
"ic-7300" => build_rig("ic-7300", 115200, 8, 1, "none"),
"qmx" => build_rig("qmx", 9600, 8, 2, "none", "SM"),
"ic-7300" => build_rig("ic-7300", 115200, 8, 1, "none", "1502"),
_ => {
// This prints a message every loop but that's OK.
println!("Rig '{x}' in rig list. Using default connection values.");
build_rig("qmx", 4800, 8, 2, "none")
build_rig("qmx", 4800, 8, 2, "none", "SM")
},
}
}
@@ -175,7 +177,7 @@ fn get_smeter(comport: &str, rig_name: &str) -> String {
// Duh, you need the ";" on the end!
// let output = "FA14075000;"; // set VFO A frequency
// let output = "FA;"; // ask for VFO A frequency
let output = "SM;"; // ask for S-meter reading
let output = format!("{};", rig.s_meter_cat);//"SM;"; // ask for S-meter reading
// What are we actually sending?
//dbg!(output.as_bytes());