React to serial port write issues

This commit is contained in:
Frederik Menke 2023-11-20 22:31:43 +01:00
parent 8d74ff0942
commit d676be5d73

View file

@ -3,7 +3,6 @@ pub mod gcode;
use bytes::BytesMut; use bytes::BytesMut;
use futures::sink::SinkExt; use futures::sink::SinkExt;
use futures::stream::StreamExt; use futures::stream::StreamExt;
use futures::TryStreamExt;
use std::time::Duration; use std::time::Duration;
use std::{fmt::Write, io, rc::Rc, str}; use std::{fmt::Write, io, rc::Rc, str};
use tokio; use tokio;
@ -91,7 +90,10 @@ impl Printer {
"Reading from serial port timed out. Printer might already be initialized." "Reading from serial port timed out. Printer might already be initialized."
); );
println!("Sending G91 command"); println!("Sending G91 command");
serial_tx.send(G91Command.command() + "\n").await; serial_tx
.send(G91Command.command() + "\n")
.await
.expect("Could not write to serial port!");
} }
} }