Dont hard error
This commit is contained in:
parent
20b31be19e
commit
f302bb4c20
1 changed files with 13 additions and 8 deletions
|
@ -63,7 +63,8 @@ fn main() {
|
|||
|
||||
if let Some(port) = &mut *port_lock {
|
||||
// handle incoming message
|
||||
match port.read().unwrap() {
|
||||
match port.read() {
|
||||
Ok(port_read) => match port_read {
|
||||
SerialReadResult::Message(msg) => {
|
||||
if !msg.is_empty() {
|
||||
tx.send(msg).unwrap();
|
||||
|
@ -71,6 +72,8 @@ fn main() {
|
|||
}
|
||||
SerialReadResult::UtfConversion(err) => println!("{:?}", err),
|
||||
SerialReadResult::Timeout => (),
|
||||
},
|
||||
Err(err) => println!("{err}"),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -124,7 +127,9 @@ fn main() {
|
|||
let mut port_lock = PORT.lock().unwrap();
|
||||
|
||||
if let Some(port) = &mut *port_lock {
|
||||
port.write("reset").unwrap();
|
||||
if let Err(err) = port.write("reset") {
|
||||
println!("{err}");
|
||||
}
|
||||
}
|
||||
|
||||
*port_lock = None;
|
||||
|
|
Loading…
Reference in a new issue