Fixing problems with heating extruder 2

issue: MatterHackers/MCCentral#5044
When printing only with extruder 2, MC waits for extruder 1 to heat to 0 degrees

issue: MatterHackers/MCCentral#5043
Load filament wizard for filament 2 does not finish
This commit is contained in:
Lars Brubaker 2019-02-08 17:53:32 -08:00
parent 1d58cb3651
commit 8b2bf97324
4 changed files with 32 additions and 41 deletions

View file

@ -46,7 +46,6 @@ namespace MatterControl.Printing
private double filamentUsedMmCache = 0;
private double diameterOfFilamentUsedMmCache = 0;
private List<double> layerZOffset = new List<double>();
private List<double> layerHeights = new List<double>();
private List<PrinterMachineInstruction> GCodeCommandQueue = new List<PrinterMachineInstruction>();

View file

@ -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++;
}
}

View file

@ -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)

View file

@ -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);