Fix M114 throughput issues
We must wait for Marlin to boot before sending any commands. Otherwise it doesn't reply anymore.
This commit is contained in:
parent
c937432d25
commit
1bc575d06c
|
@ -1 +1 @@
|
||||||
Subproject commit 076afd2c617110c8f2e7df062329e32bd0f0269b
|
Subproject commit b58bbb57e5ca2a5e6d7af0ade2c191b2e89f6081
|
|
@ -3,5 +3,5 @@ build:
|
||||||
|
|
||||||
rrun:
|
rrun:
|
||||||
#scp -r ./src olimex@muele.local:red/
|
#scp -r ./src olimex@muele.local:red/
|
||||||
rsync -rv --filter=':- .gitignore' ../red olimex@muele.local:
|
rsync -rvu --filter=':- .gitignore' ../red olimex@muele.local:
|
||||||
ssh olimex@muele.local "cd red; /home/olimex/.cargo/bin/cargo run"
|
ssh olimex@muele.local "cd red; /home/olimex/.cargo/bin/cargo run;"
|
|
@ -57,21 +57,20 @@ async fn main() -> tokio_serial::Result<()> {
|
||||||
let (mut writer, mut reader) = LineCodec.framed(port).split();
|
let (mut writer, mut reader) = LineCodec.framed(port).split();
|
||||||
println!("Starting read.");
|
println!("Starting read.");
|
||||||
let reader_task = async move {
|
let reader_task = async move {
|
||||||
|
let mut counter = 0;
|
||||||
while let Some(line_result) = reader.next().await {
|
while let Some(line_result) = reader.next().await {
|
||||||
let line = line_result.expect("Failed to read line");
|
let line = line_result.expect("Failed to read line");
|
||||||
println!("{}", line);
|
if line.contains("ok") || line.contains("Loaded") {
|
||||||
}
|
|
||||||
};
|
|
||||||
let writer_task = async move {
|
|
||||||
loop {
|
|
||||||
if let Err(e) = writer.send("M114\n".into()).await {
|
if let Err(e) = writer.send("M114\n".into()).await {
|
||||||
println!("{:?}", e);
|
println!("{:?}", e);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
tokio::time::sleep(std::time::Duration::from_secs(1)).await;
|
}
|
||||||
|
counter += 1;
|
||||||
|
println!("updates received: {}", counter);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
tokio::join!(writer_task, reader_task);
|
reader_task.await;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
Loading…
Reference in a new issue