Fixed a bug with pause resume gcode
Made a new test. added test layouts.txt and master.txt and porperties.json added paus_gcode and resume_gcode to settingskey
This commit is contained in:
parent
835f2efd88
commit
357a497505
10 changed files with 3543 additions and 33 deletions
|
|
@ -97,12 +97,14 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
public void DoPause()
|
||||
{
|
||||
// Add the pause_gcode to the loadedGCode.GCodeCommandQueue
|
||||
string pauseGCode = ActiveSliceSettings.Instance.GetValue("pause_gcode");
|
||||
string pauseGCode = ActiveSliceSettings.Instance.GetValue(SettingsKey.pause_gcode);
|
||||
|
||||
// put in the gcode for pausing (if any)
|
||||
InjectPauseGCode(pauseGCode);
|
||||
|
||||
// inject a marker to tell when we are done with the inserted pause code
|
||||
InjectPauseGCode("M114");
|
||||
|
||||
InjectPauseGCode("MH_PAUSE");
|
||||
}
|
||||
|
||||
|
|
@ -110,12 +112,13 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
{
|
||||
// first go back to where we were after executing the pause code
|
||||
Vector3 positionBeforeActualPause = moveLocationAtEndOfPauseCode.position;
|
||||
InjectPauseGCode("G92 E{0:0.00000}".FormatWith(moveLocationAtEndOfPauseCode.extrusion));
|
||||
InjectPauseGCode("G92 E{0:0.###}".FormatWith(moveLocationAtEndOfPauseCode.extrusion));
|
||||
Vector3 ensureAllAxisAreSent = positionBeforeActualPause + new Vector3(.01, .01, .01);
|
||||
InjectPauseGCode("G0 X{0:0.000} Y{1:0.000} Z{2:0.000} F{3}".FormatWith(ensureAllAxisAreSent.x, ensureAllAxisAreSent.y, ensureAllAxisAreSent.z, moveLocationAtEndOfPauseCode.feedRate + 1));
|
||||
InjectPauseGCode("G0 X{0:0.000} Y{1:0.000} Z{2:0.000} F{3}".FormatWith(positionBeforeActualPause.x, positionBeforeActualPause.y, positionBeforeActualPause.z, moveLocationAtEndOfPauseCode.feedRate));
|
||||
var feedRates = ActiveSliceSettings.Instance.Helpers.ManualMovementSpeeds();
|
||||
InjectPauseGCode("G1 X{0:0.###} Y{1:0.###} Z{2:0.###} F{3}".FormatWith(ensureAllAxisAreSent.x, ensureAllAxisAreSent.y, ensureAllAxisAreSent.z, feedRates.x + 1));
|
||||
InjectPauseGCode("G1 X{0:0.###} Y{1:0.###} Z{2:0.###} F{3}".FormatWith(positionBeforeActualPause.x, positionBeforeActualPause.y, positionBeforeActualPause.z, feedRates));
|
||||
|
||||
string resumeGCode = ActiveSliceSettings.Instance.GetValue("resume_gcode");
|
||||
string resumeGCode = ActiveSliceSettings.Instance.GetValue(SettingsKey.resume_gcode);
|
||||
InjectPauseGCode(resumeGCode);
|
||||
InjectPauseGCode("M114"); // make sure we know where we are after this resume code
|
||||
}
|
||||
|
|
@ -153,14 +156,15 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
else if (lineToSend.StartsWith("M226") || lineToSend.StartsWith("@pause"))
|
||||
{
|
||||
DoPause();
|
||||
lineToSend = "";
|
||||
}
|
||||
else if (lineToSend == "MH_PAUSE")
|
||||
{
|
||||
moveLocationAtEndOfPauseCode = LastDestination;
|
||||
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
||||
{
|
||||
// remember where we were after we ran the pause gcode
|
||||
moveLocationAtEndOfPauseCode = LastDestination;
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationState = PrinterConnectionAndCommunication.CommunicationStates.Paused;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue