From 2d377cfd552872baff2f50d2b9418befb6fb8288 Mon Sep 17 00:00:00 2001 From: LarsBrubaker Date: Mon, 11 Mar 2019 09:40:29 -0700 Subject: [PATCH] Increase wait time for M109 M190 and if multiple sends --- .../PrinterCommunication/PrinterConnection.cs | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/MatterControlLib/PrinterCommunication/PrinterConnection.cs b/MatterControlLib/PrinterCommunication/PrinterConnection.cs index 38c225184..7539ed714 100644 --- a/MatterControlLib/PrinterCommunication/PrinterConnection.cs +++ b/MatterControlLib/PrinterCommunication/PrinterConnection.cs @@ -2325,13 +2325,22 @@ You will then need to logout and log back in to the computer for the changes to private int ExpectedWaitSeconds(string lastInstruction) { - if (lastInstruction.Contains("G0 ") || lastInstruction.Contains("G1 ")) + var timeMultiple = noOkResendCount + 1; + if (lastInstruction.StartsWith("G0 ") + || lastInstruction.Contains("G1 ")) { // for moves we wait only as much as 2 seconds - return 2; + return 2 * timeMultiple; + } + else if(lastInstruction.StartsWith("M109 ") + || lastInstruction.StartsWith("M190 ")) + { + // heat and wait will allow a long wait time for ok + return 60; } - return 10; + // any other move we allow up to 10 seconds for response + return 10 * timeMultiple; } private void TryWriteNextLineFromGCodeFile() @@ -2360,6 +2369,7 @@ You will then need to logout and log back in to the computer for the changes to // The theory is that we may have received a transmission error (like 'OP' rather than 'OK') // and in that event we don't want the print to just stop and wait forever. currentLineIndexToSend = Math.Max(0, currentLineIndexToSend--); // we are going to resend the last command + noOkResendCount++; } else { @@ -2369,6 +2379,10 @@ You will then need to logout and log back in to the computer for the changes to } } } + else + { + noOkResendCount = 0; + } lock (locker) { @@ -2741,6 +2755,7 @@ You will then need to logout and log back in to the computer for the changes to internal int currentReadThreadIndex = 0; private Vector3 _homingPosition = Vector3.NegativeInfinity; + private int noOkResendCount; public class ReadThread {