From bde9f526a5651877cb059a4a009303a5de417ec4 Mon Sep 17 00:00:00 2001 From: Tyler Anderson Date: Wed, 6 Jan 2016 12:09:37 -0800 Subject: [PATCH] Revise M999 error reporting --- .../PrinterConnectionAndCommunication.cs | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/PrinterCommunication/PrinterConnectionAndCommunication.cs b/PrinterCommunication/PrinterConnectionAndCommunication.cs index 546d20489..1266461d7 100644 --- a/PrinterCommunication/PrinterConnectionAndCommunication.cs +++ b/PrinterCommunication/PrinterConnectionAndCommunication.cs @@ -269,11 +269,14 @@ namespace MatterHackers.MatterControl.PrinterCommunication #region hardware failure callbacks // smoothie temperature failures - ReadLineContainsCallBacks.AddCallbackToKey("T:Inf", PrinterReportsError); - ReadLineContainsCallBacks.AddCallbackToKey("B:Inf", PrinterReportsError); + ReadLineContainsCallBacks.AddCallbackToKey("T:inf", PrinterReportsError); + ReadLineContainsCallBacks.AddCallbackToKey("B:inf", PrinterReportsError); + // marlin temperature failures ReadLineContainsCallBacks.AddCallbackToKey("MINTEMP", PrinterReportsError); ReadLineContainsCallBacks.AddCallbackToKey("MAXTEMP", PrinterReportsError); + ReadLineContainsCallBacks.AddCallbackToKey("M999", PrinterReportsError); + // repatier temperature failures ReadLineContainsCallBacks.AddCallbackToKey("dry run mode", PrinterReportsError); #endregion @@ -1458,19 +1461,24 @@ namespace MatterHackers.MatterControl.PrinterCommunication } } + bool reportedError = false; public void PrinterReportsError(object sender, EventArgs e) { - FoundStringEventArgs foundStringEventArgs = e as FoundStringEventArgs; - if (foundStringEventArgs != null) + if(!reportedError) { - string message = "Your printer is reporting a hardware Error. This may prevent your printer from functioning properly.".Localize() - + "\n" - + "\n" - + "Error Reported".Localize() + ":" - + $" \"{foundStringEventArgs.LineToCheck}\"."; - UiThread.RunOnIdle(() => - StyledMessageBox.ShowMessageBox(null, message, "Printer Hardware Error".Localize()) - ); + reportedError = true; + FoundStringEventArgs foundStringEventArgs = e as FoundStringEventArgs; + if (foundStringEventArgs != null) + { + string message = "Your printer is reporting a hardware Error. This may prevent your printer from functioning properly.".Localize() + + "\n" + + "\n" + + "Error Reported".Localize() + ":" + + $" \"{foundStringEventArgs.LineToCheck}\"."; + UiThread.RunOnIdle(() => + StyledMessageBox.ShowMessageBox(null, message, "Printer Hardware Error".Localize()) + ); + } } } @@ -3090,4 +3098,4 @@ namespace MatterHackers.MatterControl.PrinterCommunication get { return temperature; } } } -} \ No newline at end of file +}