Merge pull request #508 from jlewin/master

Revise M999 error reporting
This commit is contained in:
johnlewin 2016-01-06 12:12:51 -08:00
commit 4b92f67322

View file

@ -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; }
}
}
}
}