Use Queue type
This commit is contained in:
parent
acc10125c8
commit
a10e7f5413
1 changed files with 5 additions and 6 deletions
|
|
@ -36,7 +36,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
{
|
||||
public class SwitchExtruderStream : GCodeStreamProxy
|
||||
{
|
||||
private List<string> commandQueue = new List<string>();
|
||||
private Queue<string> commandQueue = new Queue<string>();
|
||||
private object locker = new object();
|
||||
private int requestedExtruder;
|
||||
private int extruderLastSwitchedTo;
|
||||
|
|
@ -86,16 +86,16 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
string gcodeLine = linesToWrite[i].Trim();
|
||||
if (gcodeLine.Length > 0)
|
||||
{
|
||||
commandQueue.Add(gcodeLine);
|
||||
commandQueue.Enqueue(gcodeLine);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
commandQueue.Add(gcodeToQueue);
|
||||
commandQueue.Enqueue(gcodeToQueue);
|
||||
}
|
||||
|
||||
commandQueue.Add(lineIn);
|
||||
commandQueue.Enqueue(lineIn);
|
||||
queuedSwitch = true;
|
||||
}
|
||||
|
||||
|
|
@ -114,9 +114,8 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
{
|
||||
if (commandQueue.Count > 0)
|
||||
{
|
||||
lineToSend = commandQueue[0];
|
||||
lineToSend = commandQueue.Dequeue();
|
||||
lineToSend = printer.ReplaceMacroValues(lineToSend);
|
||||
commandQueue.RemoveAt(0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue