diff --git a/MatterControl.Printing/GCode/GCodeMemoryFile.cs b/MatterControl.Printing/GCode/GCodeMemoryFile.cs index 3dc31347c..732a7e48b 100644 --- a/MatterControl.Printing/GCode/GCodeMemoryFile.cs +++ b/MatterControl.Printing/GCode/GCodeMemoryFile.cs @@ -46,7 +46,6 @@ namespace MatterControl.Printing private double filamentUsedMmCache = 0; private double diameterOfFilamentUsedMmCache = 0; - private List layerZOffset = new List(); private List layerHeights = new List(); private List GCodeCommandQueue = new List(); diff --git a/MatterControlLib/ConfigurationPage/PrintLeveling/WizardPages/WaitForTempPage.cs b/MatterControlLib/ConfigurationPage/PrintLeveling/WizardPages/WaitForTempPage.cs index 4a970fc2a..cebe3902a 100644 --- a/MatterControlLib/ConfigurationPage/PrintLeveling/WizardPages/WaitForTempPage.cs +++ b/MatterControlLib/ConfigurationPage/PrintLeveling/WizardPages/WaitForTempPage.cs @@ -232,26 +232,28 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling private void ShowTempChangeProgress() { + int progressBarIndex = 0; for (int i = 0; i < targetHotendTemps.Length; i++) { if (targetHotendTemps[i] > 0) { - hotEndProgressBars[i].Visible = true; + hotEndProgressBars[progressBarIndex].Visible = true; double targetTemp = printer.Connection.GetTargetHotendTemperature(i); double actualTemp = printer.Connection.GetActualHotendTemperature(i); double totalDelta = targetTemp; double currentDelta = actualTemp; - double ratioDone = hotEndDoneTexts[i].Visible ? 1 : totalDelta != 0 ? (currentDelta / totalDelta) : 1; - hotEndProgressBars[i].RatioComplete = Math.Min(Math.Max(0, ratioDone), 1); - hotEndProgressBarTexts[i].Text = $"{actualTemp:0} / {targetTemp:0}"; + double ratioDone = hotEndDoneTexts[progressBarIndex].Visible ? 1 : totalDelta != 0 ? (currentDelta / totalDelta) : 1; + hotEndProgressBars[progressBarIndex].RatioComplete = Math.Min(Math.Max(0, ratioDone), 1); + hotEndProgressBarTexts[progressBarIndex].Text = $"{actualTemp:0} / {targetTemp:0}"; // if we are within 1 degree of our target if (Math.Abs(targetTemp - actualTemp) < 2 - && hotEndDoneTexts[i].Visible == false) + && hotEndDoneTexts[progressBarIndex].Visible == false) { - hotEndDoneTexts[i].Visible = true; + hotEndDoneTexts[progressBarIndex].Visible = true; NextButton.Enabled = true; } + progressBarIndex++; } } diff --git a/MatterControlLib/PrinterCommunication/Io/QueuedCommandsStream.cs b/MatterControlLib/PrinterCommunication/Io/QueuedCommandsStream.cs index 38b81d949..58314bfaf 100644 --- a/MatterControlLib/PrinterCommunication/Io/QueuedCommandsStream.cs +++ b/MatterControlLib/PrinterCommunication/Io/QueuedCommandsStream.cs @@ -82,25 +82,16 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io } } - private void CheckIfNeedToSwitchExtruders(string line) + private void CheckIfNeedToSwitchExtruders(string lineIn) { - if(line == null) + if(lineIn == null) { return; } - var lineNoComment = line.Split(';')[0]; + var lineNoComment = lineIn.Split(';')[0]; - if (line.StartsWith("G28)")) - { - extruderLastSwitchedTo = 0; - requestedExtruder = 0; - } - - if (line.StartsWith("T")) - { - GCodeFile.GetFirstNumberAfter("T", line, ref requestedExtruder); - } + TrackExtruderState(lineNoComment); if ((lineNoComment.StartsWith("G0 ") || lineNoComment.StartsWith("G1 ")) // is a G1 or G0 && (lineNoComment.Contains("X") || lineNoComment.Contains("Y") || lineNoComment.Contains("Z")) // hase a move axis in it @@ -196,23 +187,30 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io lineToSend = base.ReadLine(); } - if (lineToSend != null) - { - if (lineToSend.StartsWith("G28)")) - { - extruderLastSwitchedTo = 0; - requestedExtruder = 0; - } - - if (lineToSend.StartsWith("T")) - { - GCodeFile.GetFirstNumberAfter("T", lineToSend, ref requestedExtruder); - } - } + TrackExtruderState(lineToSend); return lineToSend; } + private void TrackExtruderState(string line) + { + if (line == null) + { + return; + } + + if (line.StartsWith("G28)")) + { + extruderLastSwitchedTo = 0; + requestedExtruder = 0; + } + + if (line.StartsWith("T")) + { + GCodeFile.GetFirstNumberAfter("T", line, ref requestedExtruder); + } + } + public void Reset() { lock (locker) diff --git a/MatterControlLib/PrinterCommunication/PrinterConnection.cs b/MatterControlLib/PrinterCommunication/PrinterConnection.cs index c6c1faa2d..04beea300 100644 --- a/MatterControlLib/PrinterCommunication/PrinterConnection.cs +++ b/MatterControlLib/PrinterCommunication/PrinterConnection.cs @@ -198,8 +198,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication private GCodeStream totalGCodeStream = null; - private PrinterMachineInstruction.MovementTypes movementMode = PrinterMachineInstruction.MovementTypes.Absolute; - public CommunicationStates PrePauseCommunicationState { get; private set; } = CommunicationStates.Printing; private DetailedPrintingState _printingStatePrivate; @@ -302,7 +300,6 @@ namespace MatterHackers.MatterControl.PrinterCommunication #endregion hardware failure callbacks - WriteLineStartCallBacks.Register("G90", MovementWasSetToAbsoluteMode); WriteLineStartCallBacks.Register("M80", AtxPowerUpWasWritenToPrinter); WriteLineStartCallBacks.Register("M81", AtxPowerDownWasWritenToPrinter); WriteLineStartCallBacks.Register("M104", HotendTemperatureWasWritenToPrinter); @@ -2208,11 +2205,6 @@ You will then need to logout and log back in to the computer for the changes to // Console.WriteLine("Syncing print to db stopped"); } - private void MovementWasSetToAbsoluteMode(string line) - { - movementMode = PrinterMachineInstruction.MovementTypes.Absolute; - } - private void AtxPowerUpWasWritenToPrinter(string line) { OnAtxPowerStateChanged(true);