Working snapshot.
This commit is contained in:
@@ -1,2 +1,3 @@
|
|||||||
/target
|
/target
|
||||||
/out
|
/out
|
||||||
|
/riglib
|
||||||
+19
-11
@@ -170,7 +170,7 @@ fn get_rig(x: &str) -> Rig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read S-meter
|
// Read S-meter
|
||||||
fn get_smeter(comport: &str, rig_name: &str, frequency: u32) -> String {
|
fn get_smeter(comport: &str, rig_name: &str, frequency: u32) -> i32 {
|
||||||
// Get the serial connection info for the rig name
|
// Get the serial connection info for the rig name
|
||||||
let rig = get_rig(rig_name);
|
let rig = get_rig(rig_name);
|
||||||
|
|
||||||
@@ -222,7 +222,9 @@ fn get_smeter(comport: &str, rig_name: &str, frequency: u32) -> String {
|
|||||||
//let value = data;
|
//let value = data;
|
||||||
// For S-meter, just take the numbers
|
// For S-meter, just take the numbers
|
||||||
let value = &data[2..5];
|
let value = &data[2..5];
|
||||||
return format!("{}", value);
|
let value_i = value.parse::<i32>().unwrap();
|
||||||
|
// return format!("{}", value);
|
||||||
|
return value_i;
|
||||||
// return;
|
// return;
|
||||||
}
|
}
|
||||||
Err(_) => {} // lol that I can just not put a return in?
|
Err(_) => {} // lol that I can just not put a return in?
|
||||||
@@ -339,16 +341,22 @@ fn main() {
|
|||||||
// Get S-meter
|
// Get S-meter
|
||||||
let s_val = get_smeter(&com, &rig, frequency);
|
let s_val = get_smeter(&com, &rig, frequency);
|
||||||
//println!("{a}");
|
//println!("{a}");
|
||||||
match s_val.parse::<i32>() {
|
println!(
|
||||||
// Simple graph as we go. Eventually this will be replaced.
|
"{} {:#03} {}",
|
||||||
Ok(n) => println!(
|
|
||||||
"{} {} {}",
|
|
||||||
date.format("%Y-%m-%d %H:%M:%S").to_string(),
|
date.format("%Y-%m-%d %H:%M:%S").to_string(),
|
||||||
s_val,
|
s_val,
|
||||||
"#".repeat(n.try_into().unwrap())
|
"#".repeat(s_val.try_into().unwrap())
|
||||||
),
|
);
|
||||||
Err(_e) => todo!(),
|
// match s_val {
|
||||||
}
|
// // Simple graph as we go. Eventually this will be replaced.
|
||||||
|
// Ok(n) => println!(
|
||||||
|
// "{} {} {}",
|
||||||
|
// date.format("%Y-%m-%d %H:%M:%S").to_string(),
|
||||||
|
// s_val,
|
||||||
|
// "#".repeat(n.try_into().unwrap())
|
||||||
|
// ),
|
||||||
|
// Err(_e) => todo!(),
|
||||||
|
// }
|
||||||
// If they provided a file name
|
// If they provided a file name
|
||||||
if file_out != "no file" {
|
if file_out != "no file" {
|
||||||
if let Err(err) = write_row(
|
if let Err(err) = write_row(
|
||||||
@@ -358,7 +366,7 @@ fn main() {
|
|||||||
format!("{:09}", frequency),
|
format!("{:09}", frequency),
|
||||||
format!("{:.8}", ll[0]),
|
format!("{:.8}", ll[0]),
|
||||||
format!("{:.8}", ll[1]),
|
format!("{:.8}", ll[1]),
|
||||||
s_val.to_string(),
|
format!("{}", s_val),
|
||||||
],
|
],
|
||||||
&file_out,
|
&file_out,
|
||||||
"csv",
|
"csv",
|
||||||
|
|||||||
Reference in New Issue
Block a user