From c7ac37a5cbec733bf47bae72eb3ae746a981084c Mon Sep 17 00:00:00 2001 From: larsbrubaker Date: Fri, 28 Feb 2014 14:12:19 -0800 Subject: [PATCH] Make sure we output g11 and g10 commands correctly. Put in spaces when outputting leveled GCode (export) --- PrinterControls/ManualPrinterControls.cs | 2 ++ PrinterControls/OutputScrollWindow.cs | 6 ++++++ PrinterControls/PrintLeveling.cs | 6 ++++-- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/PrinterControls/ManualPrinterControls.cs b/PrinterControls/ManualPrinterControls.cs index d1f528bb9..723361e41 100644 --- a/PrinterControls/ManualPrinterControls.cs +++ b/PrinterControls/ManualPrinterControls.cs @@ -674,6 +674,8 @@ namespace MatterHackers.MatterControl terminalControlsContainer.HAnchor = Agg.UI.HAnchor.ParentLeftRight; terminalControlsContainer.Height = 68; + OutputScrollWindow.HookupPrinterOutput(); + { FlowLayoutWidget buttonBar = new FlowLayoutWidget(); buttonBar.HAnchor |= HAnchor.ParentLeftRight; diff --git a/PrinterControls/OutputScrollWindow.cs b/PrinterControls/OutputScrollWindow.cs index b7692fdf3..c1030732a 100644 --- a/PrinterControls/OutputScrollWindow.cs +++ b/PrinterControls/OutputScrollWindow.cs @@ -50,6 +50,11 @@ namespace MatterHackers.MatterControl RGBA_Bytes textColor = ActiveTheme.Instance.PrimaryTextColor; TextImageButtonFactory controlButtonFactory = new TextImageButtonFactory(); + public static void HookupPrinterOutput() + { + //throw new NotImplementedException(); + } + static OutputScrollWindow connectionWindow = null; static bool terminalWindowIsOpen = false; public static void Show() @@ -73,6 +78,7 @@ namespace MatterHackers.MatterControl } } + // private as you can't make one private OutputScrollWindow() : base(400, 300) { diff --git a/PrinterControls/PrintLeveling.cs b/PrinterControls/PrintLeveling.cs index 89bfe5b0b..1e118182b 100644 --- a/PrinterControls/PrintLeveling.cs +++ b/PrinterControls/PrintLeveling.cs @@ -80,7 +80,9 @@ namespace MatterHackers.MatterControl public string ApplyLeveling(Vector3 currentDestination, PrinterMachineInstruction.MovementTypes movementMode, string lineBeingSent, bool addLFCR, bool includeSpaces) { - if (lineBeingSent.StartsWith("G0") || lineBeingSent.StartsWith("G1")) + if ((lineBeingSent.StartsWith("G0") || lineBeingSent.StartsWith("G1")) + && lineBeingSent.Length > 2 + && lineBeingSent[2] == ' ') { double extruderDelta = 0; GCodeFile.GetFirstNumberAfter("E", lineBeingSent, ref extruderDelta); @@ -136,7 +138,7 @@ namespace MatterHackers.MatterControl foreach (PrinterMachineInstruction instruction in unleveledGCode.GCodeCommandQueue) { Vector3 currentDestination = instruction.Position; - instruction.Line = ApplyLeveling(currentDestination, instruction.movementType, instruction.Line, false, false); + instruction.Line = ApplyLeveling(currentDestination, instruction.movementType, instruction.Line, false, true); } } }