Added in a pause gcode script object, fixed gcode injection timing

This commit is contained in:
LarsBrubaker 2022-11-27 09:11:49 -08:00
parent 677a1a9b12
commit e63f95ddad
5 changed files with 20 additions and 6 deletions

View file

@ -118,14 +118,17 @@ namespace MatterHackers.MatterControl.DesignTools
&& lineToWrite.StartsWith("; LAYER_HEIGHT:"))
{
double layerHeight = 0;
// this gives us the layer height we will be at AFTER this layer is done printing
if (GCodeFile.GetFirstNumberAfter("; LAYER_HEIGHT", lineToWrite, ref layerHeight, out _, stopCheckingString: ":"))
{
accumulatedLayerHeight += layerHeight;
// check if we are above the accumulated at the start of the layer but before adding in this layer height
if (accumulatedLayerHeight > WorldZ)
{
hasBeenReached = true;
yield return $"{GCodeToSend} ; G-Code from Scene Object";
}
accumulatedLayerHeight += layerHeight;
}
}
}

View file

@ -331,9 +331,9 @@ namespace MatterHackers.MatterControl.Library.Export
accumulatedStream = new BabyStepsStream(printer, accumulatedStream);
accumulatedStream = new RemoveNOPsStream(printer, accumulatedStream);
accumulatedStream = new RunSceneGCodeProcesorsStream(printer, accumulatedStream, queuedCommandStream);
accumulatedStream = new RemoveNOPsStream(printer, accumulatedStream);
accumulatedStream = new ProcessWriteRegexStream(printer, accumulatedStream, queuedCommandStream);

View file

@ -65,6 +65,18 @@ namespace MatterHackers.MatterControl.Library
{
Category = this.Name
});
Items.Add(new GeneratorItem(
"Pause".Localize(),
async () =>
{
var gcodeObject = await SendGCodeObject3D.Create();
gcodeObject.GCodeToSend = "M226";
return gcodeObject;
})
{
Category = this.Name
});
}
private class StaticDataItem : ILibraryAssetStream

View file

@ -2442,8 +2442,6 @@ Make sure that your printer is turned on. Some printers will appear to be connec
{
accumulatedStream = new SendProgressStream(gCodeFileSwitcher, Printer);
}
accumulatedStream = pauseHandlingStream = new PauseHandlingStream(Printer, accumulatedStream);
}
else
{
@ -2494,8 +2492,9 @@ Make sure that your printer is turned on. Some printers will appear to be connec
accumulatedStream = softwareEndstopsExStream12;
}
accumulatedStream = new RemoveNOPsStream(Printer, accumulatedStream);
accumulatedStream = pauseHandlingStream = new PauseHandlingStream(Printer, accumulatedStream);
accumulatedStream = new RunSceneGCodeProcesorsStream(Printer, accumulatedStream, queuedCommandStream);
accumulatedStream = new RemoveNOPsStream(Printer, accumulatedStream);
processWriteRegexStream = new ProcessWriteRegexStream(Printer, accumulatedStream, queuedCommandStream);
accumulatedStream = processWriteRegexStream;