added support for @pause and M226 (user requested pause)
This commit is contained in:
parent
c907b98560
commit
4d96053446
1 changed files with 12 additions and 3 deletions
|
|
@ -1878,6 +1878,10 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
{
|
||||
pauseRequested = true;
|
||||
}
|
||||
else if(lineToWrite == "M226" || lineToWrite == "@pause")
|
||||
{
|
||||
RequestPause(printerCommandQueueIndex+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
WriteChecksumLineToPrinter(lineToWrite);
|
||||
|
|
@ -1924,8 +1928,13 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
}
|
||||
}
|
||||
|
||||
public void RequestPause()
|
||||
public void RequestPause(int injectionStartIndex = 0)
|
||||
{
|
||||
if (injectionStartIndex == 0)
|
||||
{
|
||||
injectionStartIndex = printerCommandQueueIndex;
|
||||
}
|
||||
|
||||
if (PrinterIsPrinting)
|
||||
{
|
||||
if (CommunicationState == CommunicationStates.PrintingFromSd)
|
||||
|
|
@ -1945,8 +1954,8 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
{
|
||||
using (TimedLock.Lock(this, "RequestPause"))
|
||||
{
|
||||
double currentFeedRate = loadedGCode.Instruction(printerCommandQueueIndex).FeedRate;
|
||||
int lastIndexAdded = InjectGCode(pauseGCode, printerCommandQueueIndex);
|
||||
double currentFeedRate = loadedGCode.Instruction(injectionStartIndex).FeedRate;
|
||||
int lastIndexAdded = InjectGCode(pauseGCode, injectionStartIndex);
|
||||
|
||||
// inject a marker to tell when we are done with the inserted pause code
|
||||
lastIndexAdded = InjectGCode("MH_PAUSE", lastIndexAdded);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue