put in the ability to specify "; NO_PROCESSING" on a gcode line

issue: MatterHackers/MCCentral#4663
set position Z Tower and no Level
This commit is contained in:
Lars Brubaker 2018-12-03 16:33:25 -08:00
parent b318c6f018
commit 5fbf6281d7
13 changed files with 83 additions and 27 deletions

View file

@ -74,10 +74,17 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
public override string ReadLine()
{
string processedLine = offsetStream.ReadLine();
if (processedLine != null
string lineToSend = offsetStream.ReadLine();
if (lineToSend != null
&& lineToSend.EndsWith("; NO_PROCESSING"))
{
return lineToSend;
}
if (lineToSend != null
&& layerCount < 1
&& GCodeFile.IsLayerChange(processedLine))
&& GCodeFile.IsLayerChange(lineToSend))
{
layerCount++;
if (layerCount == 1)
@ -85,7 +92,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
maxLengthStream.MaxSegmentLength = 5;
}
}
return processedLine;
return lineToSend;
}
private void OffsetChanged()

View file

@ -45,7 +45,14 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
public override string ReadLine()
{
return ApplyExtrusionMultiplier(internalStream.ReadLine());
var lineToSend = internalStream.ReadLine();
if (lineToSend != null
&& lineToSend.EndsWith("; NO_PROCESSING"))
{
return lineToSend;
}
return ApplyExtrusionMultiplier(lineToSend);
}
private string ApplyExtrusionMultiplier(string lineBeingSent)

View file

@ -54,6 +54,12 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
{
string lineToSend = internalStream.ReadLine();
if (lineToSend != null
&& lineToSend.EndsWith("; NO_PROCESSING"))
{
return lineToSend;
}
if (lineToSend != null
&& LineIsMovement(lineToSend))
{

View file

@ -60,12 +60,18 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
{
if (movesToSend.Count == 0)
{
string lineFromChild = base.ReadLine();
string lineToSend = base.ReadLine();
if (lineFromChild != null
&& LineIsMovement(lineFromChild))
if (lineToSend != null
&& lineToSend.EndsWith("; NO_PROCESSING"))
{
PrinterMove currentDestination = GetPosition(lineFromChild, lastDestination);
return lineToSend;
}
if (lineToSend != null
&& LineIsMovement(lineToSend))
{
PrinterMove currentDestination = GetPosition(lineToSend, lastDestination);
PrinterMove deltaToDestination = currentDestination - lastDestination;
deltaToDestination.feedRate = 0; // remove the changing of the federate (we'll set it initially)
double lengthSquared = Math.Max(deltaToDestination.LengthSquared, deltaToDestination.extrusion * deltaToDestination.extrusion);
@ -109,7 +115,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
lastDestination = currentDestination;
}
return lineFromChild;
return lineToSend;
}
else
{

View file

@ -62,7 +62,13 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
{
string lineToSend = base.ReadLine();
if(lineToSend != null
if (lineToSend != null
&& lineToSend.EndsWith("; NO_PROCESSING"))
{
return lineToSend;
}
if (lineToSend != null
&& lineToSend.StartsWith("T"))
{
int extruder = 0;

View file

@ -156,6 +156,10 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
{
return lineToSend;
}
if (lineToSend.EndsWith("; NO_PROCESSING"))
{
return lineToSend;
}
// We got a line from the gcode we are sending check if we should queue a request for filament runout
if (printer.Settings.GetValue<bool>(SettingsKey.filament_runout_sensor))

View file

@ -71,33 +71,39 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
return "; Software Leveling Applied";
}
string lineFromChild = base.ReadLine();
string lineToSend = base.ReadLine();
if(lineFromChild == "; Software Leveling Applied")
if (lineToSend != null
&& lineToSend.EndsWith("; NO_PROCESSING"))
{
return lineToSend;
}
if (lineToSend == "; Software Leveling Applied")
{
gcodeAlreadyLeveled = true;
}
if (lineFromChild != null
if (lineToSend != null
&& LevelingActive
&& !gcodeAlreadyLeveled)
{
if (LineIsMovement(lineFromChild))
if (LineIsMovement(lineToSend))
{
PrinterMove currentDestination = GetPosition(lineFromChild, lastDestination);
var leveledLine = GetLeveledPosition(lineFromChild, currentDestination);
PrinterMove currentDestination = GetPosition(lineToSend, lastDestination);
var leveledLine = GetLeveledPosition(lineToSend, currentDestination);
lastDestination = currentDestination;
return leveledLine;
}
else if (lineFromChild.StartsWith("G29"))
else if (lineToSend.StartsWith("G29"))
{
// remove G29 (machine prob bed) if we are running our own leveling.
lineFromChild = base.ReadLine(); // get the next line instead
lineToSend = base.ReadLine(); // get the next line instead
}
}
return lineFromChild;
return lineToSend;
}
public override void SetPrinterPosition(PrinterMove position)

View file

@ -63,6 +63,11 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
return null;
}
if (baseLine.EndsWith("; NO_PROCESSING"))
{
return baseLine;
}
// if the line has no content don't process it
if (baseLine.Length == 0
|| baseLine.Trim().Length == 0)

View file

@ -128,6 +128,11 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
// G91 Relative
// G90 Absolute
string lineToSend = base.ReadLine();
if (lineToSend != null
&& lineToSend.EndsWith("; NO_PROCESSING"))
{
return lineToSend;
}
return ProcessLine(lineToSend);
}

View file

@ -77,6 +77,12 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
{
string lineToSend = base.ReadLine();
if (lineToSend != null
&& lineToSend.EndsWith("; NO_PROCESSING"))
{
return lineToSend;
}
if (lineToSend != null
&& lineToSend.StartsWith("M"))
{

View file

@ -51,8 +51,6 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
this.settingsContext = settingsContext;
this.textColor = textColor;
this.theme = theme;
//SaveCommaSeparatedIndexSetting(extruderOffset.ExtruderIndex, settingsContext, slicerConfigName, extruderOffset.Value.Replace(",", "x"));
}
public override void Initialize(int tabIndex)

View file

@ -1670,7 +1670,7 @@
{
"SlicerConfigName": "before_toolchange_gcode",
"PresentationName": "Before Tool Change G-Code",
"HelpText": "G-Code to be run before every tool change. You can use [wipe_tower_x] & [wipe_tower_y] to set the extruder position if needed.",
"HelpText": "G-Code to be run before every tool change. You can use [wipe_tower_x] [wipe_tower_y] & [wipe_tower_z] to set the extruder position if needed.",
"DataEditType": "MULTI_LINE_TEXT",
"ShowIfSet": "!sla_printer&extruder_count>1",
"DefaultValue": ""
@ -1678,7 +1678,7 @@
{
"SlicerConfigName": "toolchange_gcode",
"PresentationName": "After Tool Change G-Code",
"HelpText": "G-Code to be run after every tool change. You can use [wipe_tower_x] & [wipe_tower_y] to set the extruder position if needed.",
"HelpText": "G-Code to be run after every tool change. You can use [wipe_tower_x] [wipe_tower_y] & [wipe_tower_z] to set the extruder position if needed.",
"ShowIfSet": "!sla_printer&extruder_count>1",
"DataEditType": "MULTI_LINE_TEXT",
"DefaultValue": ""
@ -1686,7 +1686,7 @@
{
"SlicerConfigName": "before_toolchange_gcode_1",
"PresentationName": "Before Tool Change G-Code 2",
"HelpText": "G-Code to be run before switching to extruder 2. Will use standard before G-Code if not set. You can use [wipe_tower_x] & [wipe_tower_y] to set the extruder position if needed.",
"HelpText": "G-Code to be run before switching to extruder 2. Will use standard before G-Code if not set. You can use [wipe_tower_x] [wipe_tower_y] & [wipe_tower_z] to set the extruder position if needed.",
"DataEditType": "MULTI_LINE_TEXT",
"ShowIfSet": "!sla_printer&extruder_count>1",
"DefaultValue": ""
@ -1694,7 +1694,7 @@
{
"SlicerConfigName": "toolchange_gcode_1",
"PresentationName": "After Tool Change G-Code 2",
"HelpText": "G-Code to be run after switching to extruder 2. Will use standard after G-Code if not set. You can use [wipe_tower_x] & [wipe_tower_y] to set the extruder position if needed.",
"HelpText": "G-Code to be run after switching to extruder 2. Will use standard after G-Code if not set. You can use [wipe_tower_x] [wipe_tower_y] & [wipe_tower_z] to set the extruder position if needed.",
"ShowIfSet": "!sla_printer&extruder_count>1",
"DataEditType": "MULTI_LINE_TEXT",
"DefaultValue": ""

@ -1 +1 @@
Subproject commit 4ae7af9be45d448e56f7363398aef4ade38674b1
Subproject commit d622147cca7e624c572d80750ea59809c95e1496