Snapshot.
This commit is contained in:
+44
@@ -104,6 +104,50 @@ fn get_loc(port: String) -> [f64; 2] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Rig struct
|
||||||
|
struct Rig {
|
||||||
|
name: String,
|
||||||
|
baud_rate: u32,
|
||||||
|
data_bits: DataBits,
|
||||||
|
stop_bits: StopBits,
|
||||||
|
parity: Parity,
|
||||||
|
}
|
||||||
|
|
||||||
|
// Create a rig struct
|
||||||
|
fn build_rig(name: &str, baud_rate: u32, data_bits: u8, stop_bits: u8, parity: &str) -> Rig {
|
||||||
|
Rig {
|
||||||
|
name: name.to_string(),
|
||||||
|
baud_rate,
|
||||||
|
data_bits: match data_bits {
|
||||||
|
5 => DataBits::Five,
|
||||||
|
6 => DataBits::Six,
|
||||||
|
7 => DataBits::Seven,
|
||||||
|
8 => DataBits::Eight,
|
||||||
|
_ => DataBits::Eight
|
||||||
|
},
|
||||||
|
stop_bits: match stop_bits {
|
||||||
|
1 => StopBits::One,
|
||||||
|
2 => StopBits::Two,
|
||||||
|
_ => StopBits::One
|
||||||
|
},
|
||||||
|
parity: match parity {
|
||||||
|
"none" => Parity::None,
|
||||||
|
"odd" => Parity::Odd,
|
||||||
|
"even" => Parity::Even,
|
||||||
|
_ => Parity::None,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get rig connection info
|
||||||
|
// https://kevinlynagh.com/notes/match-vs-lookup/
|
||||||
|
fn get_rig(x: &str) -> Rig {
|
||||||
|
match x {
|
||||||
|
"qmx" => build_rig("qmx", 4800, 8, 2, "none"),
|
||||||
|
_ => build_rig("qmx", 4800, 8, 2, "none"),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Read S-meter
|
// Read S-meter
|
||||||
fn get_smeter(comport: &str) -> String {
|
fn get_smeter(comport: &str) -> String {
|
||||||
let mut port = serialport::new(comport, 4800)
|
let mut port = serialport::new(comport, 4800)
|
||||||
|
|||||||
Reference in New Issue
Block a user