diff --git a/EeProm/EePromMarlinSettings.cs b/EeProm/EePromMarlinSettings.cs index e2f4dab81..f0afc5fc4 100644 --- a/EeProm/EePromMarlinSettings.cs +++ b/EeProm/EePromMarlinSettings.cs @@ -231,15 +231,15 @@ namespace MatterHackers.MatterControl.EeProm string cmdho = "M206 X" + hox + " Y" + hoy + " Z" + hoz; string cmdpid = "M301 P" + ppid + " I" + ipid + " D" + dpid; - PrinterCommunication.Instance.QueueLineToPrinter(cmdsteps); - PrinterCommunication.Instance.QueueLineToPrinter(cmdfeed); - PrinterCommunication.Instance.QueueLineToPrinter(cmdmacc); - PrinterCommunication.Instance.QueueLineToPrinter(cmdacc); - PrinterCommunication.Instance.QueueLineToPrinter(cmdav); - PrinterCommunication.Instance.QueueLineToPrinter(cmdho); + PrinterCommunication.Instance.SendLineToPrinterNow(cmdsteps); + PrinterCommunication.Instance.SendLineToPrinterNow(cmdfeed); + PrinterCommunication.Instance.SendLineToPrinterNow(cmdmacc); + PrinterCommunication.Instance.SendLineToPrinterNow(cmdacc); + PrinterCommunication.Instance.SendLineToPrinterNow(cmdav); + PrinterCommunication.Instance.SendLineToPrinterNow(cmdho); if (hasPID) { - PrinterCommunication.Instance.QueueLineToPrinter(cmdpid); + PrinterCommunication.Instance.SendLineToPrinterNow(cmdpid); } changed = false; @@ -395,14 +395,14 @@ namespace MatterHackers.MatterControl.EeProm public void SaveToEeProm() { - PrinterCommunication.Instance.QueueLineToPrinter("M500"); + PrinterCommunication.Instance.SendLineToPrinterNow("M500"); } // this does not save them to eeprom public void SetPrinterToFactorySettings() { hasPID = false; - PrinterCommunication.Instance.QueueLineToPrinter("M502"); + PrinterCommunication.Instance.SendLineToPrinterNow("M502"); } public void Add(object sender, EventArgs e) @@ -426,7 +426,7 @@ namespace MatterHackers.MatterControl.EeProm public void Update() { hasPID = false; - PrinterCommunication.Instance.QueueLineToPrinter("M503"); + PrinterCommunication.Instance.SendLineToPrinterNow("M503"); } } } diff --git a/EeProm/EePromRepetierParameter.cs b/EeProm/EePromRepetierParameter.cs index 9bd656fc2..45aa25ca7 100644 --- a/EeProm/EePromRepetierParameter.cs +++ b/EeProm/EePromRepetierParameter.cs @@ -67,7 +67,7 @@ namespace MatterHackers.MatterControl.EeProm string cmd = "M206 T" + type + " P" + position + " "; if (type == 3) cmd += "X" + val; else cmd += "S" + val; - PrinterCommunication.Instance.QueueLineToPrinter(cmd); + PrinterCommunication.Instance.SendLineToPrinterNow(cmd); changed = false; } diff --git a/EeProm/EePromRepetierStorage.cs b/EeProm/EePromRepetierStorage.cs index d1963d4d8..b0454799e 100644 --- a/EeProm/EePromRepetierStorage.cs +++ b/EeProm/EePromRepetierStorage.cs @@ -92,7 +92,7 @@ namespace MatterHackers.MatterControl.EeProm public void AskPrinterForSettings() { - PrinterCommunication.Instance.QueueLineToPrinter("M205"); + PrinterCommunication.Instance.SendLineToPrinterNow("M205"); } } } \ No newline at end of file diff --git a/PrinterCommunication/PrinterCommunication.cs b/PrinterCommunication/PrinterCommunication.cs index 0521e0891..97971dbd8 100644 --- a/PrinterCommunication/PrinterCommunication.cs +++ b/PrinterCommunication/PrinterCommunication.cs @@ -660,7 +660,7 @@ namespace MatterHackers.MatterControl { if (MonitorPrinterTemperature) { - QueueLineToPrinter("M105"); + SendLineToPrinterNow("M105"); } temperatureRequestTimer.Restart(); } @@ -701,7 +701,7 @@ namespace MatterHackers.MatterControl { targetExtruderTemperature = value; OnExtruderTemperatureSet(new TemperatureEventArgs(TargetExtruderTemperature)); - QueueLineToPrinter("M104 S{0}".FormatWith(targetExtruderTemperature)); + SendLineToPrinterNow("M104 S{0}".FormatWith(targetExtruderTemperature)); } } } @@ -718,7 +718,9 @@ namespace MatterHackers.MatterControl { if (ActivePrinter.DoPrintLeveling) { + ForceImmediateWrites = true; ReadPosition(); + ForceImmediateWrites = false; } } @@ -752,7 +754,7 @@ namespace MatterHackers.MatterControl { fanSpeed = Math.Max(0, Math.Min(255, value)); OnFanSpeedSet(null); - QueueLineToPrinter("M106 S{0}".FormatWith(fanSpeed)); + SendLineToPrinterNow("M106 S{0}".FormatWith(fanSpeed)); } } @@ -768,7 +770,7 @@ namespace MatterHackers.MatterControl { targetBedTemperature = value; OnBedTemperatureSet(new TemperatureEventArgs(TargetBedTemperature)); - QueueLineToPrinter("M140 S{0}".FormatWith(targetBedTemperature)); + SendLineToPrinterNow("M140 S{0}".FormatWith(targetBedTemperature)); } } } @@ -1258,8 +1260,8 @@ namespace MatterHackers.MatterControl // let's check if the printer will talk to us ReadPosition(); - QueueLineToPrinter("M105"); - QueueLineToPrinter("M115"); + SendLineToPrinterNow("M105"); + SendLineToPrinterNow("M115"); } catch (System.ArgumentOutOfRangeException) { @@ -1422,7 +1424,7 @@ namespace MatterHackers.MatterControl } } - public void QueueLineToPrinter(string lineToWrite) + public void SendLineToPrinterNow(string lineToWrite) { using (TimedLock.Lock(this, "QueueLineToPrinter")) { @@ -1430,10 +1432,21 @@ namespace MatterHackers.MatterControl if (lineToWrite.Contains("\n")) { string[] lines = lineToWrite.Split(new string[] { "\n" }, StringSplitOptions.None); - for (int i = lines.Length - 1; i >= 0; i--) + if (ForceImmediateWrites && !PrinterIsPrinting) { - string line = lines[i]; - QueueLineToPrinter(line); + for (int i = 0; i < lines.Length; i++) + { + string line = lines[i]; + SendLineToPrinterNow(line); + } + } + else + { + for (int i = lines.Length - 1; i >= 0; i--) + { + string line = lines[i]; + SendLineToPrinterNow(line); + } } return; } @@ -1441,7 +1454,7 @@ namespace MatterHackers.MatterControl lineToWrite = lineToWrite.Split(';')[0].Trim(); if (PrinterIsPrinting) { - // insert the command into the printing queue + // insert the command into the printing queue at the head if (printerCommandQueueIndex >= 0 && printerCommandQueueIndex < loadedGCode.GCodeCommandQueue.Count - 1) { @@ -1460,9 +1473,10 @@ namespace MatterHackers.MatterControl } else { + // try not to write the exact same command twice (like M105) if (LinesToWriteQueue.Count == 0 || LinesToWriteQueue[LinesToWriteQueue.Count - 1] != lineToWrite) { - LinesToWriteQueue.Insert(0, lineToWrite); + LinesToWriteQueue.Add(lineToWrite); } } } @@ -2013,7 +2027,7 @@ namespace MatterHackers.MatterControl public void ReleaseMotors() { - QueueLineToPrinter("M84"); + SendLineToPrinterNow("M84"); } [Flags] @@ -2034,18 +2048,18 @@ namespace MatterHackers.MatterControl command += " Z0"; } - QueueLineToPrinter(command); + SendLineToPrinterNow(command); ReadPosition(); } public void SetMovementToAbsolute() { - PrinterCommunication.Instance.QueueLineToPrinter("G90"); + PrinterCommunication.Instance.SendLineToPrinterNow("G90"); } public void SetMovementToRelative() { - PrinterCommunication.Instance.QueueLineToPrinter("G91"); + PrinterCommunication.Instance.SendLineToPrinterNow("G91"); } public void MoveRelative(Axis axis, double moveAmountMm, double feedRateMmPerMinute) @@ -2053,8 +2067,8 @@ namespace MatterHackers.MatterControl if (moveAmountMm != 0) { SetMovementToRelative(); - PrinterCommunication.Instance.QueueLineToPrinter("G1 F{0}".FormatWith(feedRateMmPerMinute)); - PrinterCommunication.Instance.QueueLineToPrinter("G1 {0}{1}".FormatWith(axis, moveAmountMm)); + PrinterCommunication.Instance.SendLineToPrinterNow("G1 F{0}".FormatWith(feedRateMmPerMinute)); + PrinterCommunication.Instance.SendLineToPrinterNow("G1 {0}{1}".FormatWith(axis, moveAmountMm)); SetMovementToAbsolute(); } } @@ -2062,20 +2076,20 @@ namespace MatterHackers.MatterControl public void MoveAbsolute(Axis axis, double axisPositionMm, double feedRateMmPerMinute) { SetMovementToAbsolute(); - PrinterCommunication.Instance.QueueLineToPrinter("G1 F{0}".FormatWith(feedRateMmPerMinute)); - PrinterCommunication.Instance.QueueLineToPrinter("G1 {0}{1}".FormatWith(axis, axisPositionMm)); + PrinterCommunication.Instance.SendLineToPrinterNow("G1 F{0}".FormatWith(feedRateMmPerMinute)); + PrinterCommunication.Instance.SendLineToPrinterNow("G1 {0}{1}".FormatWith(axis, axisPositionMm)); } public void MoveAbsolute(Vector3 position, double feedRateMmPerMinute) { SetMovementToAbsolute(); - PrinterCommunication.Instance.QueueLineToPrinter("G1 F{0}".FormatWith(feedRateMmPerMinute)); - PrinterCommunication.Instance.QueueLineToPrinter("G1 X{0}Y{1}Z{2}".FormatWith(position.x, position.y, position.z)); + PrinterCommunication.Instance.SendLineToPrinterNow("G1 F{0}".FormatWith(feedRateMmPerMinute)); + PrinterCommunication.Instance.SendLineToPrinterNow("G1 X{0}Y{1}Z{2}".FormatWith(position.x, position.y, position.z)); } public void ReadPosition() { - QueueLineToPrinter("M114"); + SendLineToPrinterNow("M114"); } } } diff --git a/PrinterControls/MacroControls.cs b/PrinterControls/MacroControls.cs index cb1bc8925..8df5d4edf 100644 --- a/PrinterControls/MacroControls.cs +++ b/PrinterControls/MacroControls.cs @@ -173,7 +173,7 @@ namespace MatterHackers.MatterControl protected void SentCommandToPrinter(string command) { - PrinterCommunication.Instance.QueueLineToPrinter(command); + PrinterCommunication.Instance.SendLineToPrinterNow(command); } } } \ No newline at end of file diff --git a/PrinterControls/OutputScrollWindow.cs b/PrinterControls/OutputScrollWindow.cs index 3864123c4..55ef85fff 100644 --- a/PrinterControls/OutputScrollWindow.cs +++ b/PrinterControls/OutputScrollWindow.cs @@ -246,7 +246,7 @@ namespace MatterHackers.MatterControl } commandHistory.Add(textToSend); commandHistoryIndex = commandHistory.Count; - PrinterCommunication.Instance.QueueLineToPrinter(textToSend); + PrinterCommunication.Instance.SendLineToPrinterNow(textToSend); if (!filterOutput.Checked) { outputScrollWidget.WriteLine(this, new StringEventArgs(textToSend)); diff --git a/PrinterControls/PrinterConnections/ConnectionWindow.cs b/PrinterControls/PrinterConnections/ConnectionWindow.cs index c499a735a..f680930f0 100644 --- a/PrinterControls/PrinterConnections/ConnectionWindow.cs +++ b/PrinterControls/PrinterConnections/ConnectionWindow.cs @@ -37,9 +37,10 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections ChangeToAddPrinter(); } + BackgroundColor = ActiveTheme.Instance.PrimaryBackgroundColor; + this.ShowAsSystemWindow(); MinimumSize = new Vector2(350, 400); - } public override void OnMouseUp(MouseEventArgs mouseEvent) diff --git a/StaticData/Translations/Master.txt b/StaticData/Translations/Master.txt index 809b03399..be486eb49 100644 --- a/StaticData/Translations/Master.txt +++ b/StaticData/Translations/Master.txt @@ -1917,6 +1917,15 @@ Translated:Movement Speeds English:Extruder Translated:Extruder -English:No items to select. Press 'Add' to select a file to print. -Translated:No items to select. Press 'Add' to select a file to print. +English:Power on and connect printer +Translated:Power on and connect printer + +English:Attempting to connect +Translated:Attempting to connect + +English:Connection succeeded +Translated:Connection succeeded + +English:You cannot move any lower. This position on your bed is too low for the extruder to reach. You need to raise your bed, or adjust your limits to allow the extruder to go lower. +Translated:You cannot move any lower. This position on your bed is too low for the extruder to reach. You need to raise your bed, or adjust your limits to allow the extruder to go lower.