removed hex::decode

This commit is contained in:
John Goerzen 2020-09-20 22:12:01 -05:00
parent cce5c9e243
commit 6513636bbb
2 changed files with 4 additions and 4 deletions

View File

@ -79,7 +79,7 @@ fn main() {
match opt.cmd {
Command::Ping{dest} => {
let dest_u64 = u64::from_be_bytes(hex::decode(dest).unwrap().as_slice().try_into().unwrap());
let dest_u64:u64 = u64::from_str_radix(&dest, 16).expect("Invalid destination");
thread::spawn(move || ping::genpings(dest_u64, xbeesender).expect("Failure in genpings"));
xbreframer.discardframes(&xb.ser);
},

View File

@ -108,18 +108,18 @@ impl XB {
// Get our own MAC address
ser.writeln("ATSH").unwrap();
let serialhigh = ser.readln().unwrap().unwrap();
let serialhighu64 = u64::from(u32::from_be_bytes(hex::decode(serialhigh).unwrap().as_slice().try_into().unwrap()));
let serialhighu64 = u64::from_str_radix(&serialhigh, 16).unwrap();
ser.writeln("ATSL").unwrap();
let seriallow = ser.readln().unwrap().unwrap();
let seriallowu64 = u64::from(u32::from_be_bytes(hex::decode(seriallow).unwrap().as_slice().try_into().unwrap()));
let seriallowu64 = u64::from_str_radix(&seriallow, 16).unwrap();
let mymac = serialhighu64 << 32 | seriallowu64;
// Get maximum packet size
ser.writeln("ATNP").unwrap();
let maxpacket = ser.readln().unwrap().unwrap();
let maxpacketsize = usize::from(u16::from_be_bytes(hex::decode(maxpacket).unwrap().as_slice().try_into().unwrap()));
let maxpacketsize = usize::from(u16::from_str_radix(&maxpacket, 16).unwrap());
// Exit command mode