public SendProgressStream(GCodeStream internalStream, PrintHostConfig printer) : base(printer, internalStream) { }
public void PauseHandlingStreamTests() { int readX = 50; // Validate that the number parsing code is working as expected, specifically ignoring data that appears in comments // This is a regression that we saw in the Lulzbot Mini profile after adding macro processing. GCodeFile.GetFirstNumberAfter("X", "G1 Z10 E - 10 F12000 ; suck up XXmm of filament", ref readX); // did not change Assert.AreEqual(50, readX, "Don't change the x if it is after a comment"); // a comments that looks more like a valid line GCodeFile.GetFirstNumberAfter("X", "G1 Z10 E - 10 F12000 ; X33", ref readX); // did not change Assert.AreEqual(50, readX, "Don't change the x if it is after a comment"); // a line that should parse GCodeFile.GetFirstNumberAfter("X", "G1 Z10 E - 10 F12000 X33", ref readX); // did change Assert.AreEqual(33, readX, "not in a comment, do a change"); string[] inputLines = new string[] { "; the printer is moving normally", "G1 X10 Y10 Z10 E0", "G1 X10 Y10 Z10 E10", "G1 X10 Y10 Z10 E30", "; the printer pauses", "G91", "G1 Z10 E - 10 F12000 ; suck up XXmm of filament", "G90", "; the user moves the printer", "; the printer un-pauses", "G91", "G1 Z-10 E10.8 F12000", "G90", null, }; // We should go back to the above code when possible. It requires making pause part and move while paused part of the stream. // All communication should go through stream to minimize the difference between printing and controlling while not printing (all printing in essence). string[] expected = new string[] { "; the printer is moving normally", "G1 X10 Y10 Z10", "G1 E10", "G1 E30", "; the printer pauses", "", // G91 is removed "G1 Z20 E20 F12000", // altered to be absolute "G90", "; the user moves the printer", "; the printer un-pauses", "", // G91 is removed "G1 Z10 E30.8", "G90", null, }; AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData")); MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4)); List <GCodeStream> streamList; GCodeStream pauseHandlingStream = CreateTestGCodeStream(inputLines, out streamList); int expectedIndex = 0; string actualLine = pauseHandlingStream.ReadLine(); string expectedLine = expected[expectedIndex++]; Assert.AreEqual(expectedLine, actualLine, "Unexpected response from PauseHandlingStream"); while (actualLine != null) { expectedLine = expected[expectedIndex++]; actualLine = pauseHandlingStream.ReadLine(); Assert.AreEqual(expectedLine, actualLine, "Unexpected response from PauseHandlingStream"); } }
public void MorePauseHandlingStreamTests() { string[] inputLines = new string[] { "; the printer is moving normally", "G1 X10 Y10 Z10 E0", "G1 X11 Y10 Z10 E10", "G1 X12 Y10 Z10 E30", "; the printer pauses", "@pause", "; do_resume", // just a marker for us to issue a resume // move some more "G1 X13 Y10 Z10 E40", null, }; // We should go back to the above code when possible. It requires making pause part and move while paused part of the stream. // All communication should go through stream to minimize the difference between printing and controlling while not printing (all printing in essence). string[] expected = new string[] { "; the printer is moving normally", "G1 X10 Y10 Z10", "G1 X11 E10", "G1 X12 E30", "; the printer pauses", "", "", "G1 Z20 E20 F12000", "G90", "M114", "", "; do_resume", "G92 E-10", "G1 Z16.67 F3001", "G1 X12.01 Y10.01 Z13.34", "G1 Z10.01", "G1 X12 Y10 Z10 F3000", "", "G1 Z0 E30.8 F12000", "G90", "M114", "", "G1 X12.1 F1800", "G1 X12.2", "G90", "G1 X12.33 Z1.667 E32.333", "G1 X12.47 Z3.333 E33.867", "G1 X12.6 Z5 E35.4", "G1 X12.73 Z6.667 E36.933", "G1 X12.87 Z8.333 E38.467", "G1 X13 Z10 E40", null, }; AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData")); MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4)); // this is the pause and resume from the Eris PrinterSettings settings = ActiveSliceSettings.Instance; settings.SetValue(SettingsKey.pause_gcode, "G91\nG1 Z10 E - 10 F12000\n G90"); settings.SetValue(SettingsKey.resume_gcode, "G91\nG1 Z-10 E10.8 F12000\nG90"); List <GCodeStream> streamList; GCodeStream pauseHandlingStream = CreateTestGCodeStream(inputLines, out streamList); PauseHandlingStream pauseStream = null; foreach (var stream in streamList) { if (stream as PauseHandlingStream != null) { pauseStream = (PauseHandlingStream)stream; break; } } int expectedIndex = 0; string actualLine = pauseHandlingStream.ReadLine(); string expectedLine = expected[expectedIndex++]; Assert.AreEqual(expectedLine, actualLine, "Unexpected response from PauseHandlingStream"); while (actualLine != null) { expectedLine = expected[expectedIndex++]; actualLine = pauseHandlingStream.ReadLine(); //Debug.WriteLine("\"{0}\",".FormatWith(actualLine)); if (actualLine == "; do_resume") { pauseStream.Resume(); } Assert.AreEqual(expectedLine, actualLine, "Unexpected response from PauseHandlingStream"); } }
public GCodeStreamProxy(PrintHostConfig printer, GCodeStream internalStream) : base(printer) { this.internalStream = internalStream; }
public void CorrectEOutputPositions() { string[] inputLines = new string[] { "G1 E11 F300", // BCN tool change test // Before: "G92 E0", "G91", "G1 E - 5 F302", "G90", // After: "G91", "G1 E8 F150", "G90", "G4 P0", "G92 E0", "G4 P0", "G91", "G1 E-2 F301", "G90", null, }; // We should go back to the above code when possible. It requires making pause part and move while paused part of the stream. // All communication should go through stream to minimize the difference between printing and controlling while not printing (all printing in essence). string[] expected = new string[] { "G1 E1 F300", "G1 E2", "G1 E3", "G1 E4", "G1 E5", "G1 E6", "G1 E7", "G1 E8", "G1 E9", "G1 E10", "G1 E11", "G92 E0", "", "G1 E-1 F302", "G1 E-2", "G1 E-3", "G1 E-4", "G1 E-5", "G90", "", "G1 E-4 F150", "G1 E-3", "G1 E-2", "G1 E-1", "G1 E0", "G1 E1", "G1 E2", "G1 E3", "G90", "G4 P0", "G92 E0", "G4 P0", "", "G1 E-1 F301", "G1 E-2", "G90", null, }; AggContext.StaticData = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData")); MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4)); List <GCodeStream> streamList; GCodeStream testStream = CreateTestGCodeStream(inputLines, out streamList); int expectedIndex = 0; string actualLine = testStream.ReadLine(); string expectedLine = expected[expectedIndex++]; Assert.AreEqual(expectedLine, actualLine, "Unexpected response from testStream"); Debug.WriteLine(actualLine); while (actualLine != null) { actualLine = testStream.ReadLine(); if (actualLine == "G92 E0") { testStream.SetPrinterPosition(new PrinterMove(new Vector3(), 0, 300)); } expectedLine = expected[expectedIndex++]; Debug.WriteLine(actualLine); Assert.AreEqual(expectedLine, actualLine, "Unexpected response from testStream"); } }
public void PauseHandlingStreamTests() { int readX = 50; // Validate that the number parsing code is working as expected, specifically ignoring data that appears in comments // This is a regression that we saw in the Lulzbot Mini profile after adding macro processing. GCodeFile.GetFirstNumberAfter("X", "G1 Z10 E - 10 F12000 ; suck up XXmm of filament", ref readX); // did not change Assert.AreEqual(50, readX, "Don't change the x if it is after a comment"); // a comments that looks more like a valid line GCodeFile.GetFirstNumberAfter("X", "G1 Z10 E - 10 F12000 ; X33", ref readX); // did not change Assert.AreEqual(50, readX, "Don't change the x if it is after a comment"); // a line that should parse GCodeFile.GetFirstNumberAfter("X", "G1 Z10 E - 10 F12000 X33", ref readX); // did change Assert.AreEqual(33, readX, "not in a comment, do a change"); string[] inputLines = new string[] { "; the printer is moving normally", "G1 X10 Y10 Z10 E0", "G1 X10 Y10 Z10 E10", "G1 X10 Y10 Z10 E30", "; the printer pauses", "G91", "G1 Z10 E - 10 F12000 ; suck up XXmm of filament", "G90", "; the user moves the printer", "; the printer un-pauses", "G91", "G1 Z-10 E10.8 F12000", "G90", }; // We should go back to the above code when possible. It requires making pause part and move while paused part of the stream. // All communication should go through stream to minimize the difference between printing and controlling while not printing (all printing in essence). string[] expected = new string[] { "; the printer is moving normally", "G1 X10 Y10 Z10 E0", "G1 E10", "G1 E30", "; the printer pauses", "", // G91 is removed "G1 Z20 E20 F12000", // altered to be absolute "G90", "; the user moves the printer", "; the printer un-pauses", "", // G91 is removed "G1 Z10 E30.8", "", // G90 is removed }; var printer = new PrinterConfig(new PrinterSettings()); GCodeStream pauseHandlingStream = CreateTestGCodeStream(printer, inputLines, out List <GCodeStream> streamList); ValidateStreamResponse(expected, pauseHandlingStream); }
public void MorePauseHandlingStreamTests() { string[] inputLines = new string[] { "; the printer is moving normally", "G1 X10 Y10 Z10 E0", "G1 X11 Y10 Z10 E10", "G1 X12 Y10 Z10 E30", "; the printer pauses", "@pause", "; do_resume", // just a marker for us to issue a resume // move some more "G1 X13 Y10 Z10 E40", }; // We should go back to the above code when possible. It requires making pause part and move while paused part of the stream. // All communication should go through stream to minimize the difference between printing and controlling while not printing (all printing in essence). string[] expected = new string[] { "; the printer is moving normally", "G1 X10 Y10 Z10 E0", "G1 X11 E10", "G1 X12 E30", "; the printer pauses", "", "", "G1 Z20 E20 F12000", "G90", "M114", "", "; do_resume", "G92 E-10", "G1 Z16.67 F3001", "G1 X12.01 Y10.01 Z13.34", "G1 Z10.01", "G1 X12 Y10 Z10 F3000", "", "G1 Z0 E30.8 F12000", "", // G90 removed "M114", "", "G1 X12.1 F1800", "G1 X12.2", "", // G90 removed "G1 X12.33 Z1.667 E32.333", "G1 X12.47 Z3.333 E33.867", "G1 X12.6 Z5 E35.4", "G1 X12.73 Z6.667 E36.933", "G1 X12.87 Z8.333 E38.467", "G1 X13 Z10 E40", }; // this is the pause and resume from the Eris var printer = new PrinterConfig(new PrinterSettings()); printer.Settings.SetValue(SettingsKey.pause_gcode, "G91\nG1 Z10 E - 10 F12000\n G90"); printer.Settings.SetValue(SettingsKey.resume_gcode, "G91\nG1 Z-10 E10.8 F12000\nG90"); GCodeStream pauseHandlingStream = CreateTestGCodeStream(printer, inputLines, out List <GCodeStream> streamList); ValidateStreamResponse(expected, pauseHandlingStream, streamList); }
public RemoveNOPsStream(PrintHostConfig printer, GCodeStream internalStream) : base(printer, internalStream) { }
public void CorrectEOutputPositions() { string[] inputLines = new string[] { "G1 E11 F300", // BCN tool change test // Before: "G92 E0", "G91", "G1 E - 5 F302", "G90", // After: "G91", "G1 E8 F150", "G90", "G4 P0", "G92 E0", "G4 P0", "G91", "G1 E-2 F301", "G90", }; // We should go back to the above code when possible. It requires making pause part and move while paused part of the stream. // All communication should go through stream to minimize the difference between printing and controlling while not printing (all printing in essence). string[] expected = new string[] { "G1 E11 F300", "G92 E0", "", "G1 E-1 F302", "G1 E-2", "G1 E-3", "G1 E-4", "G1 E-5", "G90", "", // 10 "G1 E-4 F150", "G1 E-3", "G1 E-2", "G1 E-1", "G1 E0", "G1 E1", "G1 E2", "G1 E3", "", "G4 P0", "G92 E0", "G4 P0", "", "G1 E-1 F301", "G1 E-2", "", }; var printer = new PrinterConfig(new PrinterSettings()); GCodeStream testStream = CreateTestGCodeStream(printer, inputLines, out List <GCodeStream> streamList); ValidateStreamResponse(expected, testStream); }
public void CorrectEOutputForMiniStartupWithM83() { string[] inputLines = new string[] { "G21 ; set units to millimeters", "M107 ; fan off", "T0 ; set the active extruder to 0", "; settings from start_gcode", "M83", "M104 S170 ; set hotend temperature for bed leveling", "M140 S60 ; set bed temperature", "M109 R170", "G28", "G29", "M104 S215 ; set hotend temperature", "G92 E0.0", "G1 X0 Y0 F2400", "G1 Z3 F720", "G92 E0.0", "G1 X5 F1000", "G1 Z0 F720", "G1 X10 E5 F900", "G1 X15 E5", "G92 E0.0", "; automatic settings after start_gcode", "T0 ; set the active extruder to 0", "G90 ; use absolute coordinates", "G92 E0 ; reset the expected extruder position", "M82 ; use absolute distance for extrusion", "G1 E5 F440", "G1 E10", }; string[] expected = new string[] { "G21 ; set units to millimeters", "M107 ; fan off", "T0 ; set the active extruder to 0", "; settings from start_gcode", "", // set to relative e "M104 S170 ; set hotend temperature for bed leveling", "M140 S60 ; set bed temperature", "M109 R170", "G28", "G29", // 10 "M104 S215 ; set hotend temperature", "G92 E0.0", "G1 F2400", "G1 Z1 F720", "G1 Z2", "G1 Z3", "G92 E0.0", "G1 X1 F1000", "G1 X2", "G1 X3", // 20 "G1 X4", "G1 X5", "G1 F720", "G1 X6 E1 F900", "G1 X7 E2", "G1 X8 E3", "G1 X9 E4", "G1 X10 E5", "G1 X11 E6", "G1 X12 E7", // 30 "G1 X13 E8", "G1 X14 E9", "G1 X15 E10", "G92 E0.0", "; automatic settings after start_gcode", "T0 ; set the active extruder to 0", "G90 ; use absolute coordinates", "G92 E0 ; reset the expected extruder position", "M82 ; use absolute distance for extrusion", "G1 E1 F440", // 40 "G1 E2", "G1 E3", "G1 E4", "G1 E5", "G1 E6", "G1 E7", "G1 E8", "G1 E9", "G1 E10", }; var printer = new PrinterConfig(new PrinterSettings()); GCodeStream testStream = CreateTestGCodeStream(printer, inputLines, out List <GCodeStream> streamList); ValidateStreamResponse(expected, testStream); }
public void PauseHandlingStreamTests() { string[] inputLines = new string[] { "; the printer is moving normally", "G1 X10 Y10 Z10 E0", "G1 X10 Y10 Z10 E10", "G1 X10 Y10 Z10 E30", "; the printer pauses", "G91", "G1 Z10 E - 10 F12000", "G90", "; the user moves the printer", "; the printer un-pauses", "G91", "G1 Z-10 E10.8 F12000", "G90", null, }; // We should go back to the above code when possible. It requires making pause part and move while paused part of the stream. // All communication should go through stream to minimize the difference between printing and controlling while not printing (all printing in essence). string[] expected = new string[] { "; the printer is moving normally", "G1 X10 Y10 Z10", "G1 E10", "G1 E30", "; the printer pauses", "", // G91 is removed "G1 Z20 E20 F12000", // altered to be absolute "G90", "; the user moves the printer", "; the printer un-pauses", "", // G91 is removed "G1 Z10 E30.8", "G90", null, }; StaticData.Instance = new FileSystemStaticData(TestContext.CurrentContext.ResolveProjectPath(4, "StaticData")); MatterControlUtilities.OverrideAppDataLocation(TestContext.CurrentContext.ResolveProjectPath(4)); List <GCodeStream> streamList; GCodeStream pauseHandlingStream = CreateTestGCodeStream(inputLines, out streamList); int expectedIndex = 0; string actualLine = pauseHandlingStream.ReadLine(); string expectedLine = expected[expectedIndex++]; Assert.AreEqual(expectedLine, actualLine, "Unexpected response from PauseHandlingStream"); while (actualLine != null) { expectedLine = expected[expectedIndex++]; actualLine = pauseHandlingStream.ReadLine(); Assert.AreEqual(expectedLine, actualLine, "Unexpected response from PauseHandlingStream"); } }
public void CorrectEOutputPositionsM83() { string[] inputLines = new string[] { "G1 E11 F300", // Before: "G92 E0", "M83", // relative extruder "G1 E - 5 F302", "M82", // After: "M83", "G1 E8 F150", "M82", "G4 P0", "G92 E0", "G4 P0", "M83", "G1 E-2 F301", "M82", "G1 E2 F301", }; string[] expected = new string[] { "G1 E11 F300", "G92 E0", "", "G1 E-1 F302", "G1 E-2", "G1 E-3", "G1 E-4", "G1 E-5", "M82", "", // 10 "G1 E-4 F150", "G1 E-3", "G1 E-2", "G1 E-1", "G1 E0", "G1 E1", "G1 E2", "G1 E3", "", "G4 P0", // 20 "G92 E0", "G4 P0", "", "G1 E-1 F301", "G1 E-2", "", "G1 E-1", "G1 E0", "G1 E1", "G1 E2", // 30 }; var printer = new PrinterConfig(new PrinterSettings()); GCodeStream testStream = CreateTestGCodeStream(printer, inputLines, out List <GCodeStream> streamList); ValidateStreamResponse(expected, testStream); }
public RelativeToAbsoluteStream(PrintHostConfig printer, GCodeStream internalStream) : base(printer, internalStream) { }
public ExtrusionMultiplierStream(PrintHostConfig printer, GCodeStream internalStream) : base(printer, internalStream) { }
public FeedRateMultiplierStream(PrintHostConfig printer, GCodeStream internalStream) : base(printer, internalStream) { }
public static string GetDebugState(this GCodeStream sourceStream) { return(GetDebugState(sourceStream, ApplicationController.Instance.ActivePrinters.First())); }