diff --git a/ActionBar/ActionBarBaseControls.cs b/ActionBar/ActionBarBaseControls.cs
index dc330e7ef..d725c73e1 100644
--- a/ActionBar/ActionBarBaseControls.cs
+++ b/ActionBar/ActionBarBaseControls.cs
@@ -1,20 +1,10 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.IO.Ports;
-using System.Diagnostics;
-
using MatterHackers.Agg;
-using MatterHackers.Agg.Image;
using MatterHackers.Agg.UI;
-using MatterHackers.Agg.OpenGlGui;
-using MatterHackers.PolygonMesh;
-using MatterHackers.RenderOpenGl;
-using MatterHackers.VectorMath;
using MatterHackers.Agg.VertexSource;
-
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.PrinterCommunication;
+using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl.ActionBar
{
@@ -162,7 +152,7 @@ namespace MatterHackers.MatterControl.ActionBar
this.AddChild(textContainer);
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(onActivePrinterChanged, ref unregisterEvents);
- PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onActivePrinterChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onActivePrinterChanged, ref unregisterEvents);
}
public override void OnClosed(EventArgs e)
@@ -190,16 +180,16 @@ namespace MatterHackers.MatterControl.ActionBar
void SetButtonText()
{
- if (PrinterCommunication.Instance.CommunicationState == PrinterCommunication.CommunicationStates.FailedToConnect && PrinterCommunication.Instance.ConnectionFailureMessage != "")
+ if (PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.FailedToConnect && PrinterConnectionAndCommunication.Instance.ConnectionFailureMessage != "")
{
string statusString = LocalizedString.Get("Status: {0} - {1}");
- printerStatusText.Text = string.Format(statusString, PrinterCommunication.Instance.PrinterConnectionStatusVerbose, PrinterCommunication.Instance.ConnectionFailureMessage);
+ printerStatusText.Text = string.Format(statusString, PrinterConnectionAndCommunication.Instance.PrinterConnectionStatusVerbose, PrinterConnectionAndCommunication.Instance.ConnectionFailureMessage);
}
else
{
string statusStringBeg = LocalizedString.Get("Status").ToUpper();
- string statusString = string.Format("{1}: {0}", PrinterCommunication.Instance.PrinterConnectionStatusVerbose, statusStringBeg);
- printerStatusText.Text = string.Format(statusString,PrinterCommunication.Instance.PrinterConnectionStatusVerbose);
+ string statusString = string.Format("{1}: {0}", PrinterConnectionAndCommunication.Instance.PrinterConnectionStatusVerbose, statusStringBeg);
+ printerStatusText.Text = string.Format(statusString,PrinterConnectionAndCommunication.Instance.PrinterConnectionStatusVerbose);
}
if (ActivePrinterProfile.Instance.ActivePrinter != null)
{
diff --git a/ActionBar/HelpTextWidget.cs b/ActionBar/HelpTextWidget.cs
index 775b33083..8418b9748 100644
--- a/ActionBar/HelpTextWidget.cs
+++ b/ActionBar/HelpTextWidget.cs
@@ -8,6 +8,7 @@ using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.VectorMath;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl
{
@@ -76,7 +77,7 @@ namespace MatterHackers.MatterControl
private void AddHandlers()
{
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
- PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
}
public override void OnClosed(EventArgs e)
diff --git a/ActionBar/PrintActionRow.cs b/ActionBar/PrintActionRow.cs
index 63f5e2503..3d8b23ed0 100644
--- a/ActionBar/PrintActionRow.cs
+++ b/ActionBar/PrintActionRow.cs
@@ -10,6 +10,7 @@ using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.PrintQueue;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.ActionBar
{
@@ -134,8 +135,8 @@ namespace MatterHackers.MatterControl.ActionBar
event EventHandler unregisterEvents;
protected override void AddHandlers()
{
- PrinterCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onStateChanged, ref unregisterEvents);
- PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onStateChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onStateChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onStateChanged, ref unregisterEvents);
addButton.Click += new ButtonBase.ButtonEventHandler(onAddButton_Click);
startButton.Click += new ButtonBase.ButtonEventHandler(onStartButton_Click);
skipButton.Click += new ButtonBase.ButtonEventHandler(onSkipButton_Click);
@@ -207,11 +208,11 @@ namespace MatterHackers.MatterControl.ActionBar
}
timeSincePrintStarted.Restart();
- PrinterCommunication.Instance.StartPrint(gcodeFileContents);
+ PrinterConnectionAndCommunication.Instance.StartPrint(gcodeFileContents);
}
else
{
- PrinterCommunication.Instance.CommunicationState = PrinterCommunication.CommunicationStates.Connected;
+ PrinterConnectionAndCommunication.Instance.CommunicationState = PrinterConnectionAndCommunication.CommunicationStates.Connected;
}
}
}
@@ -236,7 +237,7 @@ namespace MatterHackers.MatterControl.ActionBar
// else print as normal
if (ActiveSliceSettings.Instance.IsValid())
{
- string pathAndFile = PrinterCommunication.Instance.ActivePrintItem.FileLocation;
+ string pathAndFile = PrinterConnectionAndCommunication.Instance.ActivePrintItem.FileLocation;
if (File.Exists(pathAndFile))
{
string hideGCodeWarning = ApplicationSettings.Instance.get("HideGCodeWarning");
@@ -264,8 +265,8 @@ namespace MatterHackers.MatterControl.ActionBar
}
}
- PrinterCommunication.Instance.CommunicationState = PrinterCommunication.CommunicationStates.PreparingToPrint;
- PrintItemWrapper partToPrint = PrinterCommunication.Instance.ActivePrintItem;
+ PrinterConnectionAndCommunication.Instance.CommunicationState = PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint;
+ PrintItemWrapper partToPrint = PrinterConnectionAndCommunication.Instance.ActivePrintItem;
SlicingQueue.Instance.QueuePartForSlicing(partToPrint);
partToPrint.SlicingDone.RegisterEvent(partToPrint_SliceDone, ref unregisterEvents);
@@ -296,9 +297,9 @@ namespace MatterHackers.MatterControl.ActionBar
void onResumeButton_Click(object sender, MouseEventArgs mouseEvent)
{
- if (PrinterCommunication.Instance.PrinterIsPaused)
+ if (PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
{
- PrinterCommunication.Instance.Resume();
+ PrinterConnectionAndCommunication.Instance.Resume();
}
}
@@ -309,7 +310,7 @@ namespace MatterHackers.MatterControl.ActionBar
void onPauseButton_Click(object sender, MouseEventArgs mouseEvent)
{
- PrinterCommunication.Instance.RequestPause();
+ PrinterConnectionAndCommunication.Instance.RequestPause();
}
string cancelCurrentPrintMessage = "Cancel the current print?".Localize();
@@ -336,17 +337,17 @@ namespace MatterHackers.MatterControl.ActionBar
private void CancelPrinting()
{
- if (PrinterCommunication.Instance.CommunicationState == PrinterCommunication.CommunicationStates.PreparingToPrint)
+ if (PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint)
{
SlicingQueue.Instance.CancelCurrentSlicing();
}
- PrinterCommunication.Instance.Stop();
+ PrinterConnectionAndCommunication.Instance.Stop();
timeSincePrintStarted.Reset();
}
void onDoneWithCurrentPartButton_Click(object sender, MouseEventArgs mouseEvent)
{
- PrinterCommunication.Instance.ResetToReadyState();
+ PrinterConnectionAndCommunication.Instance.ResetToReadyState();
QueueData.Instance.RemoveAt(queueDataView.SelectedIndex);
// We don't have to change the selected index because we should be on the next one as we deleted the one
// we were on.
@@ -406,7 +407,7 @@ namespace MatterHackers.MatterControl.ActionBar
protected void SetButtonStates()
{
this.activePrintButtons.Clear();
- if (PrinterCommunication.Instance.ActivePrintItem == null)
+ if (PrinterConnectionAndCommunication.Instance.ActivePrintItem == null)
{
this.activePrintButtons.Add(addButton);
ShowActiveButtons();
@@ -414,14 +415,14 @@ namespace MatterHackers.MatterControl.ActionBar
}
else
{
- switch (PrinterCommunication.Instance.CommunicationState)
+ switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
{
- case PrinterCommunication.CommunicationStates.AttemptingToConnect:
+ case PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect:
this.activePrintButtons.Add(cancelConnectButton);
EnableActiveButtons();
break;
- case PrinterCommunication.CommunicationStates.Connected:
+ case PrinterConnectionAndCommunication.CommunicationStates.Connected:
this.activePrintButtons.Add(startButton);
//Show 'skip' button if there are more items in queue
@@ -434,24 +435,24 @@ namespace MatterHackers.MatterControl.ActionBar
EnableActiveButtons();
break;
- case PrinterCommunication.CommunicationStates.PreparingToPrint:
+ case PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint:
this.activePrintButtons.Add(cancelButton);
EnableActiveButtons();
break;
- case PrinterCommunication.CommunicationStates.Printing:
+ case PrinterConnectionAndCommunication.CommunicationStates.Printing:
this.activePrintButtons.Add (pauseButton);
this.activePrintButtons.Add (cancelButton);
EnableActiveButtons ();
break;
- case PrinterCommunication.CommunicationStates.Paused:
+ case PrinterConnectionAndCommunication.CommunicationStates.Paused:
this.activePrintButtons.Add(resumeButton);
this.activePrintButtons.Add(cancelButton);
EnableActiveButtons();
break;
- case PrinterCommunication.CommunicationStates.FinishedPrint:
+ case PrinterConnectionAndCommunication.CommunicationStates.FinishedPrint:
this.activePrintButtons.Add(reprintButton);
this.activePrintButtons.Add(doneWithCurrentPartButton);
EnableActiveButtons();
diff --git a/ActionBar/PrintStatusRow.cs b/ActionBar/PrintStatusRow.cs
index 3665c4311..6be40b45c 100644
--- a/ActionBar/PrintStatusRow.cs
+++ b/ActionBar/PrintStatusRow.cs
@@ -38,6 +38,7 @@ using MatterHackers.Localizations;
using MatterHackers.MatterControl.PrintQueue;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.VectorMath;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.ActionBar
{
@@ -119,7 +120,7 @@ namespace MatterHackers.MatterControl.ActionBar
activePrintPreviewImage.PrintItem.SlicingOutputMessage.UnregisterEvent(PrintItem_SlicingOutputMessage, ref unregisterEvents);
}
- activePrintPreviewImage.PrintItem = PrinterCommunication.Instance.ActivePrintItem;
+ activePrintPreviewImage.PrintItem = PrinterConnectionAndCommunication.Instance.ActivePrintItem;
// then hook up our new part
if (activePrintPreviewImage.PrintItem != null)
@@ -262,10 +263,10 @@ namespace MatterHackers.MatterControl.ActionBar
protected void AddHandlers()
{
- PrinterCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onPrintItemChanged, ref unregisterEvents);
- PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onStateChanged, ref unregisterEvents);
- PrinterCommunication.Instance.WroteLine.RegisterEvent(Instance_WroteLine, ref unregisterEvents);
- PrinterCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onPrintItemChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onStateChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.WroteLine.RegisterEvent(Instance_WroteLine, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents);
}
public override void OnClosed(EventArgs e)
@@ -285,7 +286,7 @@ namespace MatterHackers.MatterControl.ActionBar
void OnIdle(object state)
{
- if (PrinterCommunication.Instance.PrinterIsPrinting)
+ if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
{
if (!timeSinceLastDrawTime.IsRunning)
{
@@ -316,9 +317,9 @@ namespace MatterHackers.MatterControl.ActionBar
private void UpdatePrintStatus()
{
- if (PrinterCommunication.Instance.ActivePrintItem != null)
+ if (PrinterConnectionAndCommunication.Instance.ActivePrintItem != null)
{
- int totalSecondsInPrint = PrinterCommunication.Instance.TotalSecondsInPrint;
+ int totalSecondsInPrint = PrinterConnectionAndCommunication.Instance.TotalSecondsInPrint;
int totalHoursInPrint = (int)(totalSecondsInPrint / (60 * 60));
int totalMinutesInPrint = (int)(totalSecondsInPrint / 60 - totalHoursInPrint * 60);
@@ -357,11 +358,11 @@ namespace MatterHackers.MatterControl.ActionBar
string printPercentRemainingText;
string printPercentCompleteText = LocalizedString.Get("complete");
- printPercentRemainingText = string.Format("{0:0.0}% {1}", PrinterCommunication.Instance.PercentComplete,printPercentCompleteText);
+ printPercentRemainingText = string.Format("{0:0.0}% {1}", PrinterConnectionAndCommunication.Instance.PercentComplete,printPercentCompleteText);
- switch (PrinterCommunication.Instance.CommunicationState)
+ switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
{
- case PrinterCommunication.CommunicationStates.PreparingToPrint:
+ case PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint:
string preparingPrintLabel = LocalizedString.Get("Preparing To Print");
string preparingPrintLabelFull = string.Format("{0}:", preparingPrintLabel);
activePrintLabel.Text = preparingPrintLabelFull;
@@ -369,14 +370,14 @@ namespace MatterHackers.MatterControl.ActionBar
activePrintInfo.Text = "";
break;
- case PrinterCommunication.CommunicationStates.Printing:
+ case PrinterConnectionAndCommunication.CommunicationStates.Printing:
{
- activePrintLabel.Text = PrinterCommunication.Instance.PrintingStateString;
+ activePrintLabel.Text = PrinterConnectionAndCommunication.Instance.PrintingStateString;
ActivePrintStatusText = totalPrintTimeText;
}
break;
- case PrinterCommunication.CommunicationStates.Paused:
+ case PrinterConnectionAndCommunication.CommunicationStates.Paused:
{
string activePrintLabelText = LocalizedString.Get ("Printing Paused");
string activePrintLabelTextFull = string.Format("{0}:", activePrintLabelText);
@@ -385,7 +386,7 @@ namespace MatterHackers.MatterControl.ActionBar
}
break;
- case PrinterCommunication.CommunicationStates.FinishedPrint:
+ case PrinterConnectionAndCommunication.CommunicationStates.FinishedPrint:
string donePrintingText = LocalizedString.Get ("Done Printing");
string donePrintingTextFull = string.Format ("{0}:", donePrintingText);
activePrintLabel.Text = donePrintingTextFull;
@@ -419,16 +420,16 @@ namespace MatterHackers.MatterControl.ActionBar
}
else
{
- switch (PrinterCommunication.Instance.CommunicationState)
+ switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
{
- case PrinterCommunication.CommunicationStates.Disconnected:
+ case PrinterConnectionAndCommunication.CommunicationStates.Disconnected:
return LocalizedString.Get("Not connected. Press 'Connect' to enable printing.");
- case PrinterCommunication.CommunicationStates.AttemptingToConnect:
+ case PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect:
string attemptToConnect = LocalizedString.Get("Attempting to Connect");
string attemptToConnectFull = string.Format("{0}...", attemptToConnect);
return attemptToConnectFull;
- case PrinterCommunication.CommunicationStates.ConnectionLost:
- case PrinterCommunication.CommunicationStates.FailedToConnect:
+ case PrinterConnectionAndCommunication.CommunicationStates.ConnectionLost:
+ case PrinterConnectionAndCommunication.CommunicationStates.FailedToConnect:
return LocalizedString.Get("Unable to communicate with printer.");
default:
return "";
@@ -444,9 +445,9 @@ namespace MatterHackers.MatterControl.ActionBar
void UpdatePrintItemName()
{
- if (PrinterCommunication.Instance.ActivePrintItem != null)
+ if (PrinterConnectionAndCommunication.Instance.ActivePrintItem != null)
{
- string labelName = textInfo.ToTitleCase(PrinterCommunication.Instance.ActivePrintItem.Name);
+ string labelName = textInfo.ToTitleCase(PrinterConnectionAndCommunication.Instance.ActivePrintItem.Name);
labelName = labelName.Replace('_', ' ');
this.activePrintName.Text = labelName;
}
diff --git a/ActionBar/PrinterActionRow.cs b/ActionBar/PrinterActionRow.cs
index 9abc359c1..d75faad37 100644
--- a/ActionBar/PrinterActionRow.cs
+++ b/ActionBar/PrinterActionRow.cs
@@ -13,6 +13,7 @@ using MatterHackers.MatterControl;
using MatterHackers.MatterControl.PrintQueue;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.PrinterControls.PrinterConnections;
+using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.Localizations;
@@ -112,8 +113,8 @@ namespace MatterHackers.MatterControl.ActionBar
{
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(ReloadPrinterSelectionWidget, ref unregisterEvents);
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(onActivePrinterChanged, ref unregisterEvents);
- PrinterCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
- PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
selectActivePrinterButton.Click += new ButtonBase.ButtonEventHandler(onSelectActivePrinterButton_Click);
connectPrinterButton.Click += new ButtonBase.ButtonEventHandler(onConnectButton_Click);
@@ -149,8 +150,8 @@ namespace MatterHackers.MatterControl.ActionBar
void ConnectToActivePrinter()
{
- PrinterCommunication.Instance.HaltConnectionThread();
- PrinterCommunication.Instance.ConnectToActivePrinter();
+ PrinterConnectionAndCommunication.Instance.HaltConnectionThread();
+ PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter();
}
void onSelectActivePrinterButton_Click(object sender, MouseEventArgs mouseEvent)
@@ -208,11 +209,11 @@ namespace MatterHackers.MatterControl.ActionBar
void OnIdleDisconnect(object state)
{
bool doCancel = true;
- if (PrinterCommunication.Instance.PrinterIsPrinting)
+ if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
{
if (StyledMessageBox.ShowMessageBox(disconnectAndCancelMessage, disconnectAndCancelTitle, StyledMessageBox.MessageType.YES_NO))
{
- PrinterCommunication.Instance.Stop();
+ PrinterConnectionAndCommunication.Instance.Stop();
}
else
{
@@ -222,7 +223,7 @@ namespace MatterHackers.MatterControl.ActionBar
if (doCancel)
{
- PrinterCommunication.Instance.Disable();
+ PrinterConnectionAndCommunication.Instance.Disable();
selectActivePrinterButton.Invalidate();
}
}
@@ -230,7 +231,7 @@ namespace MatterHackers.MatterControl.ActionBar
void SetConnectionButtonVisibleState(object state)
{
- if (PrinterCommunication.Instance.PrinterIsConnected)
+ if (PrinterConnectionAndCommunication.Instance.PrinterIsConnected)
{
disconnectPrinterButton.Visible = true;
connectPrinterButton.Visible = false;
diff --git a/ActionBar/TemperatureWidgetBase.cs b/ActionBar/TemperatureWidgetBase.cs
index 4a74560eb..813881579 100644
--- a/ActionBar/TemperatureWidgetBase.cs
+++ b/ActionBar/TemperatureWidgetBase.cs
@@ -28,15 +28,10 @@ either expressed or implied, of the FreeBSD Project.
*/
using System;
-using System.Diagnostics;
-using System.Globalization;
-using System.IO;
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.Agg.VertexSource;
-using MatterHackers.Localizations;
-using MatterHackers.MatterControl.PrintQueue;
-using MatterHackers.VectorMath;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.ActionBar
{
@@ -147,7 +142,7 @@ namespace MatterHackers.MatterControl.ActionBar
void onEnterBounds(Object sender, EventArgs e)
{
labelTextWidget.Visible = true;
- if (PrinterCommunication.Instance.PrinterIsConnected && !PrinterCommunication.Instance.PrinterIsPrinting)
+ if (PrinterConnectionAndCommunication.Instance.PrinterIsConnected && !PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
{
preheatButton.Visible = true;
}
diff --git a/ActionBar/TemperatureWidgetBed.cs b/ActionBar/TemperatureWidgetBed.cs
index b85ede4d0..a377d5074 100644
--- a/ActionBar/TemperatureWidgetBed.cs
+++ b/ActionBar/TemperatureWidgetBed.cs
@@ -38,6 +38,7 @@ using MatterHackers.Localizations;
using MatterHackers.MatterControl.PrintQueue;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.VectorMath;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.ActionBar
{
@@ -55,7 +56,7 @@ namespace MatterHackers.MatterControl.ActionBar
event EventHandler unregisterEvents;
void AddHandlers()
{
- PrinterCommunication.Instance.BedTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.BedTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents);
this.MouseEnterBounds += onMouseEnterBounds;
this.MouseLeaveBounds += onMouseLeaveBounds;
}
@@ -83,18 +84,18 @@ namespace MatterHackers.MatterControl.ActionBar
void setToCurrentTemperature()
{
string tempDirectionIndicator = "";
- if (PrinterCommunication.Instance.TargetBedTemperature > 0)
+ if (PrinterConnectionAndCommunication.Instance.TargetBedTemperature > 0)
{
- if ((int)(PrinterCommunication.Instance.TargetBedTemperature + 0.5) < (int)(PrinterCommunication.Instance.ActualBedTemperature + 0.5))
+ if ((int)(PrinterConnectionAndCommunication.Instance.TargetBedTemperature + 0.5) < (int)(PrinterConnectionAndCommunication.Instance.ActualBedTemperature + 0.5))
{
tempDirectionIndicator = "↓";
}
- else if ((int)(PrinterCommunication.Instance.TargetBedTemperature + 0.5) > (int)(PrinterCommunication.Instance.ActualBedTemperature + 0.5))
+ else if ((int)(PrinterConnectionAndCommunication.Instance.TargetBedTemperature + 0.5) > (int)(PrinterConnectionAndCommunication.Instance.ActualBedTemperature + 0.5))
{
tempDirectionIndicator = "↑";
}
}
- this.IndicatorValue = string.Format(" {0:0.#}°{1}", PrinterCommunication.Instance.ActualBedTemperature, tempDirectionIndicator);
+ this.IndicatorValue = string.Format(" {0:0.#}°{1}", PrinterConnectionAndCommunication.Instance.ActualBedTemperature, tempDirectionIndicator);
}
void onTemperatureRead(Object sender, EventArgs e)
@@ -111,16 +112,16 @@ namespace MatterHackers.MatterControl.ActionBar
if (double.TryParse(ActiveSliceSettings.Instance.GetActiveValue("first_layer_bed_temperature"), out targetTemp))
{
double goalTemp = (int)(targetTemp + .5);
- if (PrinterCommunication.Instance.PrinterIsPrinting
- && PrinterCommunication.Instance.PrintingState == PrinterCommunication.DetailedPrintingState.HeatingBed
- && goalTemp != PrinterCommunication.Instance.TargetBedTemperature)
+ if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
+ && PrinterConnectionAndCommunication.Instance.PrintingState == PrinterConnectionAndCommunication.DetailedPrintingState.HeatingBed
+ && goalTemp != PrinterConnectionAndCommunication.Instance.TargetBedTemperature)
{
- string message = string.Format(waitingForBedToHeatMessage, PrinterCommunication.Instance.TargetBedTemperature, sliceSettingsNote);
+ string message = string.Format(waitingForBedToHeatMessage, PrinterConnectionAndCommunication.Instance.TargetBedTemperature, sliceSettingsNote);
StyledMessageBox.ShowMessageBox(message, waitingForBedToHeatTitle);
}
else
{
- PrinterCommunication.Instance.TargetBedTemperature = (int)(targetTemp + .5);
+ PrinterConnectionAndCommunication.Instance.TargetBedTemperature = (int)(targetTemp + .5);
}
}
}
diff --git a/ActionBar/TemperatureWidgetExtruder.cs b/ActionBar/TemperatureWidgetExtruder.cs
index 2dde2e984..85ecaea54 100644
--- a/ActionBar/TemperatureWidgetExtruder.cs
+++ b/ActionBar/TemperatureWidgetExtruder.cs
@@ -38,6 +38,7 @@ using MatterHackers.Localizations;
using MatterHackers.MatterControl.PrintQueue;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.VectorMath;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.ActionBar
{
@@ -54,7 +55,7 @@ namespace MatterHackers.MatterControl.ActionBar
event EventHandler unregisterEvents;
void AddHandlers()
{
- PrinterCommunication.Instance.ExtruderTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.ExtruderTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents);
this.MouseEnterBounds += onMouseEnterBounds;
this.MouseLeaveBounds += onMouseLeaveBounds;
}
@@ -81,18 +82,18 @@ namespace MatterHackers.MatterControl.ActionBar
void setToCurrentTemperature()
{
string tempDirectionIndicator = "";
- if (PrinterCommunication.Instance.TargetExtruderTemperature > 0)
+ if (PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature > 0)
{
- if ((int)(PrinterCommunication.Instance.TargetExtruderTemperature + 0.5) < (int)(PrinterCommunication.Instance.ActualExtruderTemperature + 0.5))
+ if ((int)(PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature + 0.5) < (int)(PrinterConnectionAndCommunication.Instance.ActualExtruderTemperature + 0.5))
{
tempDirectionIndicator = "↓";
}
- else if ((int)(PrinterCommunication.Instance.TargetExtruderTemperature + 0.5) > (int)(PrinterCommunication.Instance.ActualExtruderTemperature + 0.5))
+ else if ((int)(PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature + 0.5) > (int)(PrinterConnectionAndCommunication.Instance.ActualExtruderTemperature + 0.5))
{
tempDirectionIndicator = "↑";
}
}
- this.IndicatorValue = string.Format(" {0:0.#}°{1}", PrinterCommunication.Instance.ActualExtruderTemperature, tempDirectionIndicator);
+ this.IndicatorValue = string.Format(" {0:0.#}°{1}", PrinterConnectionAndCommunication.Instance.ActualExtruderTemperature, tempDirectionIndicator);
}
void onTemperatureRead(Object sender, EventArgs e)
@@ -109,16 +110,16 @@ namespace MatterHackers.MatterControl.ActionBar
if (double.TryParse(ActiveSliceSettings.Instance.GetActiveValue("first_layer_temperature"), out targetTemp))
{
double goalTemp = (int)(targetTemp + .5);
- if (PrinterCommunication.Instance.PrinterIsPrinting
- && PrinterCommunication.Instance.PrintingState == PrinterCommunication.DetailedPrintingState.HeatingExtruder
- && goalTemp != PrinterCommunication.Instance.TargetExtruderTemperature)
+ if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
+ && PrinterConnectionAndCommunication.Instance.PrintingState == PrinterConnectionAndCommunication.DetailedPrintingState.HeatingExtruder
+ && goalTemp != PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature)
{
- string message = string.Format(waitingForeExtruderToHeatMessage, PrinterCommunication.Instance.TargetExtruderTemperature, sliceSettingsNote);
+ string message = string.Format(waitingForeExtruderToHeatMessage, PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature, sliceSettingsNote);
StyledMessageBox.ShowMessageBox(message, waitingForeExtruderToHeatTitle);
}
else
{
- PrinterCommunication.Instance.TargetExtruderTemperature = (int)(targetTemp + .5);
+ PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature = (int)(targetTemp + .5);
}
}
}
diff --git a/ApplicationView/ApplicationMenuRow.cs b/ApplicationView/ApplicationMenuRow.cs
index cc13628a7..1b4776f20 100644
--- a/ApplicationView/ApplicationMenuRow.cs
+++ b/ApplicationView/ApplicationMenuRow.cs
@@ -1,23 +1,13 @@
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.IO;
-
-
-
using MatterHackers.Agg;
-using MatterHackers.Agg.Transform;
-using MatterHackers.Agg.Image;
-using MatterHackers.Agg.VertexSource;
using MatterHackers.Agg.UI;
-using MatterHackers.Agg.Font;
-using MatterHackers.VectorMath;
-
-using MatterHackers.MatterControl.PrintQueue;
+using MatterHackers.Localizations;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.MatterControl.DataStorage;
-using MatterHackers.Localizations;
+using MatterHackers.MatterControl.PrinterCommunication;
+using MatterHackers.MatterControl.PrintQueue;
+using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl
{
@@ -172,7 +162,7 @@ namespace MatterHackers.MatterControl
parent = parent.Parent;
}
- if(PrinterCommunication.Instance.PrinterIsPrinting)
+ if(PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
{
StyledMessageBox.ShowMessageBox(cannotExitWhileActiveMessage, cannotExitWhileActiveTitle);
}
diff --git a/ApplicationView/WidescreenPanel.cs b/ApplicationView/WidescreenPanel.cs
index 18e4de2f1..ae2fae540 100644
--- a/ApplicationView/WidescreenPanel.cs
+++ b/ApplicationView/WidescreenPanel.cs
@@ -48,6 +48,7 @@ using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.PartPreviewWindow;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl
{
@@ -85,7 +86,7 @@ namespace MatterHackers.MatterControl
Padding = new BorderDouble(4);
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(LoadSettingsOnPrinterChanged, ref unregisterEvents);
- PrinterCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents);
ApplicationWidget.Instance.ReloadPanelTrigger.RegisterEvent(ReloadAdvancedControlsPanel, ref unregisterEvents);
this.BoundsChanged += new EventHandler(onBoundsChanges);
}
@@ -243,11 +244,11 @@ namespace MatterHackers.MatterControl
ColumnTwo.RemoveAllChildren();
double buildHeight = ActiveSliceSettings.Instance.BuildHeight;
- part3DView = new View3DTransformPart(PrinterCommunication.Instance.ActivePrintItem, new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight), ActiveSliceSettings.Instance.BedShape, View3DTransformPart.WindowType.Embeded, View3DTransformPart.AutoRotate.Enabled);
+ part3DView = new View3DTransformPart(PrinterConnectionAndCommunication.Instance.ActivePrintItem, new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight), ActiveSliceSettings.Instance.BedShape, View3DTransformPart.WindowType.Embeded, View3DTransformPart.AutoRotate.Enabled);
part3DView.Margin = new BorderDouble(bottom: 4);
part3DView.AnchorAll();
- partGcodeView = new ViewGcodeBasic(PrinterCommunication.Instance.ActivePrintItem, new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight), ActiveSliceSettings.Instance.BedShape, ActiveSliceSettings.Instance.BedCenter, false);
+ partGcodeView = new ViewGcodeBasic(PrinterConnectionAndCommunication.Instance.ActivePrintItem, new Vector3(ActiveSliceSettings.Instance.BedSize, buildHeight), ActiveSliceSettings.Instance.BedShape, ActiveSliceSettings.Instance.BedCenter, false);
partGcodeView.AnchorAll();
ColumnTwo.AddChild(part3DView);
diff --git a/ConfigurationPage/PrintLeveling/LevelWizard2Point.cs b/ConfigurationPage/PrintLeveling/LevelWizard2Point.cs
index ba2e2f82a..b7bf6deeb 100644
--- a/ConfigurationPage/PrintLeveling/LevelWizard2Point.cs
+++ b/ConfigurationPage/PrintLeveling/LevelWizard2Point.cs
@@ -39,6 +39,7 @@ using MatterHackers.VectorMath;
using MatterHackers.Agg.Font;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.SlicerConfiguration;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
@@ -107,5 +108,17 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
string doneInstructions = string.Format("{0}\n\n\t• {1}\n\n{2}", doneInstructionsText, doneInstructionsTextTwo, doneInstructionsTextThree);
printLevelWizard.AddPage(new LastPage2PointInstructions("Done".Localize(), doneInstructions, probePositions));
}
+
+ public static string ProcesssCommand(string lineBeingSent)
+ {
+ if (lineBeingSent == "G28")
+ {
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G28 Y0");
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G28 Z0");
+ return "G28 X0";
+ }
+
+ return lineBeingSent;
+ }
}
}
diff --git a/ConfigurationPage/PrintLeveling/PrintLevelPages.cs b/ConfigurationPage/PrintLeveling/PrintLevelPages.cs
index f811f169f..06bb9a3ec 100644
--- a/ConfigurationPage/PrintLeveling/PrintLevelPages.cs
+++ b/ConfigurationPage/PrintLeveling/PrintLevelPages.cs
@@ -39,6 +39,7 @@ using MatterHackers.VectorMath;
using MatterHackers.Agg.Font;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.SlicerConfiguration;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
@@ -104,10 +105,10 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
public override void PageIsBecomingActive()
{
- PrinterCommunication.Instance.MoveAbsolute(PrinterCommunication.Axis.Z, probeStartPosition.z, InstructionsPage.ManualControlsFeedRate().z);
- PrinterCommunication.Instance.MoveAbsolute(probeStartPosition, InstructionsPage.ManualControlsFeedRate().x);
- PrinterCommunication.Instance.SendLineToPrinterNow("G30");
- PrinterCommunication.Instance.ReadLine.RegisterEvent(FinishedProbe, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.MoveAbsolute(PrinterConnectionAndCommunication.Axis.Z, probeStartPosition.z, InstructionsPage.ManualControlsFeedRate().z);
+ PrinterConnectionAndCommunication.Instance.MoveAbsolute(probeStartPosition, InstructionsPage.ManualControlsFeedRate().x);
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G30");
+ PrinterConnectionAndCommunication.Instance.ReadLine.RegisterEvent(FinishedProbe, ref unregisterEvents);
base.PageIsBecomingActive();
@@ -122,12 +123,12 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
if (currentEvent.Data.Contains("endstops hit"))
{
- PrinterCommunication.Instance.ReadLine.UnregisterEvent(FinishedProbe, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.ReadLine.UnregisterEvent(FinishedProbe, ref unregisterEvents);
int zStringPos = currentEvent.Data.LastIndexOf("Z:");
string zProbeHeight = currentEvent.Data.Substring(zStringPos + 2);
probePosition.position = new Vector3(probeStartPosition.x, probeStartPosition.y, double.Parse(zProbeHeight));
- PrinterCommunication.Instance.MoveAbsolute(probeStartPosition, InstructionsPage.ManualControlsFeedRate().z);
- PrinterCommunication.Instance.ReadPosition();
+ PrinterConnectionAndCommunication.Instance.MoveAbsolute(probeStartPosition, InstructionsPage.ManualControlsFeedRate().z);
+ PrinterConnectionAndCommunication.Instance.ReadPosition();
container.nextButton.ClickButton(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
}
@@ -181,7 +182,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
public override void PageIsBecomingActive()
{
- PrinterCommunication.Instance.HomeAxis(PrinterCommunication.Axis.XYZ);
+ PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.XYZ);
base.PageIsBecomingActive();
}
}
@@ -201,7 +202,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
this.allowLessThan0 = allowLessThan0;
this.moveAmount = moveDistance;
- this.lastReportedPosition = PrinterCommunication.Instance.LastReportedPosition;
+ this.lastReportedPosition = PrinterConnectionAndCommunication.Instance.LastReportedPosition;
this.probePosition = whereToWriteProbePosition;
GuiWidget spacer = new GuiWidget(15, 15);
@@ -243,7 +244,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
public override void PageIsBecomingInactive()
{
- probePosition.position = PrinterCommunication.Instance.LastReportedPosition;
+ probePosition.position = PrinterConnectionAndCommunication.Instance.LastReportedPosition;
base.PageIsBecomingInactive();
}
@@ -263,7 +264,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
void zMinusControl_Click(object sender, MouseEventArgs mouseEvent)
{
if (!allowLessThan0
- && PrinterCommunication.Instance.LastReportedPosition.z - moveAmount < 0)
+ && PrinterConnectionAndCommunication.Instance.LastReportedPosition.z - moveAmount < 0)
{
UiThread.RunOnIdle( (state) =>
{
@@ -272,14 +273,14 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
// don't move the bed lower it will not work when we print.
return;
}
- PrinterCommunication.Instance.MoveRelative(PrinterCommunication.Axis.Z, -moveAmount, InstructionsPage.ManualControlsFeedRate().z);
- PrinterCommunication.Instance.ReadPosition();
+ PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, -moveAmount, InstructionsPage.ManualControlsFeedRate().z);
+ PrinterConnectionAndCommunication.Instance.ReadPosition();
}
void zPlusControl_Click(object sender, MouseEventArgs mouseEvent)
{
- PrinterCommunication.Instance.MoveRelative(PrinterCommunication.Axis.Z, moveAmount, InstructionsPage.ManualControlsFeedRate().z);
- PrinterCommunication.Instance.ReadPosition();
+ PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmount, InstructionsPage.ManualControlsFeedRate().z);
+ PrinterConnectionAndCommunication.Instance.ReadPosition();
}
}
@@ -308,9 +309,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
base.PageIsBecomingActive();
- PrinterCommunication.Instance.MoveAbsolute(PrinterCommunication.Axis.Z, probeStartPosition.z, InstructionsPage.ManualControlsFeedRate().z);
- PrinterCommunication.Instance.MoveAbsolute(probeStartPosition, InstructionsPage.ManualControlsFeedRate().x);
- PrinterCommunication.Instance.ReadPosition();
+ PrinterConnectionAndCommunication.Instance.MoveAbsolute(PrinterConnectionAndCommunication.Axis.Z, probeStartPosition.z, InstructionsPage.ManualControlsFeedRate().z);
+ PrinterConnectionAndCommunication.Instance.MoveAbsolute(probeStartPosition, InstructionsPage.ManualControlsFeedRate().x);
+ PrinterConnectionAndCommunication.Instance.ReadPosition();
container.nextButton.Enabled = false;
@@ -342,10 +343,10 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
public override void PageIsBecomingActive()
{
- PrinterCommunication.Instance.MoveAbsolute(PrinterCommunication.Axis.Z, probeStartPosition.z, InstructionsPage.ManualControlsFeedRate().z);
- PrinterCommunication.Instance.MoveAbsolute(probeStartPosition, InstructionsPage.ManualControlsFeedRate().x);
- PrinterCommunication.Instance.SendLineToPrinterNow("G30");
- PrinterCommunication.Instance.ReadLine.RegisterEvent(FinishedProbe, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.MoveAbsolute(PrinterConnectionAndCommunication.Axis.Z, probeStartPosition.z, InstructionsPage.ManualControlsFeedRate().z);
+ PrinterConnectionAndCommunication.Instance.MoveAbsolute(probeStartPosition, InstructionsPage.ManualControlsFeedRate().x);
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G30");
+ PrinterConnectionAndCommunication.Instance.ReadLine.RegisterEvent(FinishedProbe, ref unregisterEvents);
base.PageIsBecomingActive();
@@ -362,15 +363,15 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
if (currentEvent.Data.Contains("endstops hit"))
{
- PrinterCommunication.Instance.ReadLine.UnregisterEvent(FinishedProbe, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.ReadLine.UnregisterEvent(FinishedProbe, ref unregisterEvents);
int zStringPos = currentEvent.Data.LastIndexOf("Z:");
string zProbeHeight = currentEvent.Data.Substring(zStringPos + 2);
// store the position that the limit swich fires
whereToWriteSamplePosition.position = new Vector3(probeStartPosition.x, probeStartPosition.y, double.Parse(zProbeHeight));
// now move to the probe start position
- PrinterCommunication.Instance.MoveAbsolute(probeStartPosition, InstructionsPage.ManualControlsFeedRate().z);
- PrinterCommunication.Instance.ReadPosition();
+ PrinterConnectionAndCommunication.Instance.MoveAbsolute(probeStartPosition, InstructionsPage.ManualControlsFeedRate().z);
+ PrinterConnectionAndCommunication.Instance.ReadPosition();
}
}
}
@@ -422,7 +423,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
if (haveDrawn)
{
- PrinterCommunication.Instance.MoveRelative(PrinterCommunication.Axis.Z, 2, InstructionsPage.ManualControlsFeedRate().z);
+ PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, 2, InstructionsPage.ManualControlsFeedRate().z);
}
base.PageIsBecomingInactive();
}
diff --git a/ConfigurationPage/PrintLeveling/PrintLevelingData.cs b/ConfigurationPage/PrintLeveling/PrintLevelingData.cs
index 5ecd216d2..72a22bec8 100644
--- a/ConfigurationPage/PrintLeveling/PrintLevelingData.cs
+++ b/ConfigurationPage/PrintLeveling/PrintLevelingData.cs
@@ -105,13 +105,12 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
static PrintLevelingData instance = null;
public static PrintLevelingData GetForPrinter(Printer printer)
{
- if (printer != activePrinter)
+ if (activePrinter != printer)
{
CreateFromJsonOrLegacy(printer.PrintLevelingJsonData, printer.PrintLevelingProbePositions);
+ activePrinter = printer;
}
- activePrinter = printer;
-
return instance;
}
diff --git a/ConfigurationPage/PrinterConfigurationPage.cs b/ConfigurationPage/PrinterConfigurationPage.cs
index a975f07c4..c796f3239 100644
--- a/ConfigurationPage/PrinterConfigurationPage.cs
+++ b/ConfigurationPage/PrinterConfigurationPage.cs
@@ -30,19 +30,16 @@ either expressed or implied, of the FreeBSD Project.
using System;
using System.Collections.Generic;
using System.IO;
-using System.Reflection;
-using System.IO.Ports;
-
using MatterHackers.Agg;
-using MatterHackers.Agg.UI;
-using MatterHackers.Agg.ImageProcessing;
-using MatterHackers.VectorMath;
using MatterHackers.Agg.Image;
-using MatterHackers.MatterControl.DataStorage;
-using MatterHackers.MatterControl.CustomWidgets;
+using MatterHackers.Agg.ImageProcessing;
+using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
-using MatterHackers.MatterControl;
using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
+using MatterHackers.MatterControl.CustomWidgets;
+using MatterHackers.MatterControl.DataStorage;
+using MatterHackers.MatterControl.PrinterCommunication;
+using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl
{
@@ -356,13 +353,13 @@ namespace MatterHackers.MatterControl
#if false // This is to force the creation of the repetier window for testing when we don't have repetier firmware.
new MatterHackers.MatterControl.EeProm.EePromRepetierWidget();
#else
- switch(PrinterCommunication.Instance.FirmwareType)
+ switch(PrinterConnectionAndCommunication.Instance.FirmwareType)
{
- case PrinterCommunication.FirmwareTypes.Repetier:
+ case PrinterConnectionAndCommunication.FirmwareTypes.Repetier:
new MatterHackers.MatterControl.EeProm.EePromRepetierWidget();
break;
- case PrinterCommunication.FirmwareTypes.Marlin:
+ case PrinterConnectionAndCommunication.FirmwareTypes.Marlin:
new MatterHackers.MatterControl.EeProm.EePromMarlinWidget();
break;
@@ -559,33 +556,33 @@ namespace MatterHackers.MatterControl
}
else // we at least have a printer selected
{
- switch (PrinterCommunication.Instance.CommunicationState)
+ switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
{
- case PrinterCommunication.CommunicationStates.Disconnecting:
- case PrinterCommunication.CommunicationStates.ConnectionLost:
- case PrinterCommunication.CommunicationStates.Disconnected:
- case PrinterCommunication.CommunicationStates.AttemptingToConnect:
- case PrinterCommunication.CommunicationStates.FailedToConnect:
+ case PrinterConnectionAndCommunication.CommunicationStates.Disconnecting:
+ case PrinterConnectionAndCommunication.CommunicationStates.ConnectionLost:
+ case PrinterConnectionAndCommunication.CommunicationStates.Disconnected:
+ case PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect:
+ case PrinterConnectionAndCommunication.CommunicationStates.FailedToConnect:
eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
printLevelContainer.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
terminalCommunicationsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
break;
- case PrinterCommunication.CommunicationStates.FinishedPrint:
- case PrinterCommunication.CommunicationStates.Connected:
+ case PrinterConnectionAndCommunication.CommunicationStates.FinishedPrint:
+ case PrinterConnectionAndCommunication.CommunicationStates.Connected:
eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
printLevelContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
terminalCommunicationsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
break;
- case PrinterCommunication.CommunicationStates.PreparingToPrint:
- case PrinterCommunication.CommunicationStates.Printing:
- switch (PrinterCommunication.Instance.PrintingState)
+ case PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint:
+ case PrinterConnectionAndCommunication.CommunicationStates.Printing:
+ switch (PrinterConnectionAndCommunication.Instance.PrintingState)
{
- case PrinterCommunication.DetailedPrintingState.HomingAxis:
- case PrinterCommunication.DetailedPrintingState.HeatingBed:
- case PrinterCommunication.DetailedPrintingState.HeatingExtruder:
- case PrinterCommunication.DetailedPrintingState.Printing:
+ case PrinterConnectionAndCommunication.DetailedPrintingState.HomingAxis:
+ case PrinterConnectionAndCommunication.DetailedPrintingState.HeatingBed:
+ case PrinterConnectionAndCommunication.DetailedPrintingState.HeatingExtruder:
+ case PrinterConnectionAndCommunication.DetailedPrintingState.Printing:
eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
printLevelContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
@@ -597,7 +594,7 @@ namespace MatterHackers.MatterControl
}
break;
- case PrinterCommunication.CommunicationStates.Paused:
+ case PrinterConnectionAndCommunication.CommunicationStates.Paused:
eePromControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
printLevelContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
terminalCommunicationsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
@@ -613,8 +610,8 @@ namespace MatterHackers.MatterControl
private void AddHandlers()
{
ActiveTheme.Instance.ThemeChanged.RegisterEvent(onThemeChanged, ref unregisterEvents);
- PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
- PrinterCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
}
private void onPrinterStatusChanged(object sender, EventArgs e)
diff --git a/CustomWidgets/ExportPrintItemWindow.cs b/CustomWidgets/ExportPrintItemWindow.cs
index a91b2ca75..74b1ef81c 100644
--- a/CustomWidgets/ExportPrintItemWindow.cs
+++ b/CustomWidgets/ExportPrintItemWindow.cs
@@ -208,7 +208,7 @@ namespace MatterHackers.MatterControl
GCodeFile unleveledGCode = new GCodeFile(source);
if (applyLeveling.Checked)
{
- PrintLeveling.Instance.ApplyLeveling(unleveledGCode);
+ PrintLevelingPlane.Instance.ApplyLeveling(unleveledGCode);
}
unleveledGCode.Save(dest);
}
diff --git a/CustomWidgets/PrintProgressBarWidget.cs b/CustomWidgets/PrintProgressBarWidget.cs
index 08d22c7ef..933758321 100644
--- a/CustomWidgets/PrintProgressBarWidget.cs
+++ b/CustomWidgets/PrintProgressBarWidget.cs
@@ -7,6 +7,7 @@ using System.Diagnostics;
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.VectorMath;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl
{
@@ -57,9 +58,9 @@ namespace MatterHackers.MatterControl
event EventHandler unregisterEvents;
void AddHandlers()
{
- PrinterCommunication.Instance.WroteLine.RegisterEvent(Instance_WroteLine, ref unregisterEvents);
- PrinterCommunication.Instance.ActivePrintItemChanged.RegisterEvent(Instance_PrintItemChanged, ref unregisterEvents);
- PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(Instance_PrintItemChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.WroteLine.RegisterEvent(Instance_WroteLine, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(Instance_PrintItemChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(Instance_PrintItemChanged, ref unregisterEvents);
ActiveTheme.Instance.ThemeChanged.RegisterEvent(onThemeChanged, ref unregisterEvents);
}
@@ -102,7 +103,7 @@ namespace MatterHackers.MatterControl
if (timeSinceLastUpdate.ElapsedMilliseconds > 999)
{
timeSinceLastUpdate.Restart();
- currentPercent = PrinterCommunication.Instance.PercentComplete;
+ currentPercent = PrinterConnectionAndCommunication.Instance.PercentComplete;
UpdatePrintStatus();
this.Invalidate();
}
@@ -118,7 +119,7 @@ namespace MatterHackers.MatterControl
if (timeSinceLastUpdate.ElapsedMilliseconds > 999)
{
timeSinceLastUpdate.Restart();
- currentPercent = PrinterCommunication.Instance.PercentComplete;
+ currentPercent = PrinterConnectionAndCommunication.Instance.PercentComplete;
UpdatePrintStatus();
}
@@ -131,7 +132,7 @@ namespace MatterHackers.MatterControl
private void UpdatePrintStatus()
{
- if (PrinterCommunication.Instance.ActivePrintItem == null)
+ if (PrinterConnectionAndCommunication.Instance.ActivePrintItem == null)
{
printTimeElapsed.Text = string.Format("");
printTimeRemaining.Text = string.Format("");
@@ -139,7 +140,7 @@ namespace MatterHackers.MatterControl
else
{
- int secondsPrinted = PrinterCommunication.Instance.SecondsPrinted;
+ int secondsPrinted = PrinterConnectionAndCommunication.Instance.SecondsPrinted;
int hoursPrinted = (int)(secondsPrinted / (60 * 60));
int minutesPrinted = (int)(secondsPrinted / 60 - hoursPrinted * 60);
secondsPrinted = secondsPrinted % 60;
@@ -167,11 +168,11 @@ namespace MatterHackers.MatterControl
string printPercentRemainingText = string.Format("{0:0.0}%", currentPercent);
- if (PrinterCommunication.Instance.PrinterIsPrinting || PrinterCommunication.Instance.PrinterIsPaused)
+ if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting || PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
{
printTimeRemaining.Text = printPercentRemainingText;
}
- else if (PrinterCommunication.Instance.PrintIsFinished)
+ else if (PrinterConnectionAndCommunication.Instance.PrintIsFinished)
{
printTimeRemaining.Text = "Done!";
}
diff --git a/EeProm/EePromMarlinSettings.cs b/EeProm/EePromMarlinSettings.cs
index f0afc5fc4..59f8ae76e 100644
--- a/EeProm/EePromMarlinSettings.cs
+++ b/EeProm/EePromMarlinSettings.cs
@@ -28,11 +28,8 @@ either expressed or implied, of the FreeBSD Project.
*/
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
using MatterHackers.Agg.UI;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.EeProm
{
@@ -231,15 +228,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.SendLineToPrinterNow(cmdsteps);
- PrinterCommunication.Instance.SendLineToPrinterNow(cmdfeed);
- PrinterCommunication.Instance.SendLineToPrinterNow(cmdmacc);
- PrinterCommunication.Instance.SendLineToPrinterNow(cmdacc);
- PrinterCommunication.Instance.SendLineToPrinterNow(cmdav);
- PrinterCommunication.Instance.SendLineToPrinterNow(cmdho);
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(cmdsteps);
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(cmdfeed);
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(cmdmacc);
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(cmdacc);
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(cmdav);
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(cmdho);
if (hasPID)
{
- PrinterCommunication.Instance.SendLineToPrinterNow(cmdpid);
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(cmdpid);
}
changed = false;
@@ -395,14 +392,14 @@ namespace MatterHackers.MatterControl.EeProm
public void SaveToEeProm()
{
- PrinterCommunication.Instance.SendLineToPrinterNow("M500");
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("M500");
}
// this does not save them to eeprom
public void SetPrinterToFactorySettings()
{
hasPID = false;
- PrinterCommunication.Instance.SendLineToPrinterNow("M502");
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("M502");
}
public void Add(object sender, EventArgs e)
@@ -426,7 +423,7 @@ namespace MatterHackers.MatterControl.EeProm
public void Update()
{
hasPID = false;
- PrinterCommunication.Instance.SendLineToPrinterNow("M503");
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("M503");
}
}
}
diff --git a/EeProm/EePromMarlinWidget.cs b/EeProm/EePromMarlinWidget.cs
index bbd1f8740..8be4abacc 100644
--- a/EeProm/EePromMarlinWidget.cs
+++ b/EeProm/EePromMarlinWidget.cs
@@ -29,12 +29,10 @@ either expressed or implied, of the FreeBSD Project.
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.EeProm
{
@@ -188,7 +186,7 @@ namespace MatterHackers.MatterControl.EeProm
mainContainer.AddChild(bottomButtonBar);
}
- PrinterCommunication.Instance.CommunicationUnconditionalFromPrinter.RegisterEvent(currentEePromSettings.Add, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationUnconditionalFromPrinter.RegisterEvent(currentEePromSettings.Add, ref unregisterEvents);
currentEePromSettings.eventAdded += SetUiToPrinterSettings;
diff --git a/EeProm/EePromRepetierParameter.cs b/EeProm/EePromRepetierParameter.cs
index 45aa25ca7..333906829 100644
--- a/EeProm/EePromRepetierParameter.cs
+++ b/EeProm/EePromRepetierParameter.cs
@@ -31,6 +31,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.EeProm
{
@@ -67,7 +68,7 @@ namespace MatterHackers.MatterControl.EeProm
string cmd = "M206 T" + type + " P" + position + " ";
if (type == 3) cmd += "X" + val;
else cmd += "S" + val;
- PrinterCommunication.Instance.SendLineToPrinterNow(cmd);
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(cmd);
changed = false;
}
diff --git a/EeProm/EePromRepetierStorage.cs b/EeProm/EePromRepetierStorage.cs
index b0454799e..84bc11d74 100644
--- a/EeProm/EePromRepetierStorage.cs
+++ b/EeProm/EePromRepetierStorage.cs
@@ -33,6 +33,7 @@ using System.Linq;
using System.Text;
using MatterHackers.Agg.UI;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.EeProm
{
@@ -92,7 +93,7 @@ namespace MatterHackers.MatterControl.EeProm
public void AskPrinterForSettings()
{
- PrinterCommunication.Instance.SendLineToPrinterNow("M205");
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("M205");
}
}
}
\ No newline at end of file
diff --git a/EeProm/EePromRepetierWidget.cs b/EeProm/EePromRepetierWidget.cs
index 3135a27e3..978959be9 100644
--- a/EeProm/EePromRepetierWidget.cs
+++ b/EeProm/EePromRepetierWidget.cs
@@ -37,6 +37,7 @@ using System.Text;
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.EeProm
{
@@ -117,7 +118,7 @@ namespace MatterHackers.MatterControl.EeProm
ShowAsSystemWindow();
currentEePromSettings.Clear();
- PrinterCommunication.Instance.CommunicationUnconditionalFromPrinter.RegisterEvent(currentEePromSettings.Add, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationUnconditionalFromPrinter.RegisterEvent(currentEePromSettings.Add, ref unregisterEvents);
currentEePromSettings.eventAdded += NewSettingReadFromPrinter;
currentEePromSettings.AskPrinterForSettings();
diff --git a/MatterControl.csproj b/MatterControl.csproj
index 2215e771e..e7835c74a 100644
--- a/MatterControl.csproj
+++ b/MatterControl.csproj
@@ -113,6 +113,9 @@
+
+
+
@@ -181,8 +184,8 @@
-
-
+
+
diff --git a/MatterControlApplication.cs b/MatterControlApplication.cs
index b25ea90aa..c313e5c2a 100644
--- a/MatterControlApplication.cs
+++ b/MatterControlApplication.cs
@@ -36,14 +36,15 @@ using System.Text;
using System.Threading;
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
+using MatterHackers.Localizations;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.PartPreviewWindow;
using MatterHackers.MatterControl.PluginSystem;
+using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.MatterControl.PrintQueue;
-using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.MatterControl.SettingsManagement;
+using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.VectorMath;
-using MatterHackers.Localizations;
namespace MatterHackers.MatterControl
{
@@ -199,7 +200,7 @@ namespace MatterHackers.MatterControl
void CheckOnPrinter(object state)
{
- PrinterCommunication.Instance.OnIdle();
+ PrinterConnectionAndCommunication.Instance.OnIdle();
UiThread.RunOnIdle(CheckOnPrinter);
}
@@ -327,10 +328,10 @@ namespace MatterHackers.MatterControl
// save the last size of the window so we can restore it next time.
ApplicationSettings.Instance.set("WindowSize", string.Format("{0},{1}", Width, Height));
ApplicationSettings.Instance.set("DesktopPosition", string.Format("{0},{1}", DesktopPosition.x, DesktopPosition.y));
- PrinterCommunication.Instance.Disable();
+ PrinterConnectionAndCommunication.Instance.Disable();
//Close connection to the local datastore
Datastore.Instance.Exit();
- PrinterCommunication.Instance.HaltConnectionThread();
+ PrinterConnectionAndCommunication.Instance.HaltConnectionThread();
SlicingQueue.Instance.ShutDownSlicingThread();
if (RestartOnClose)
{
@@ -357,7 +358,7 @@ namespace MatterHackers.MatterControl
//Save a snapshot of the prints in queue
QueueData.Instance.SaveDefaultQueue();
- if (PrinterCommunication.Instance.PrinterIsPrinting)
+ if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
{
StyledMessageBox.ShowMessageBox(unableToExitMessage, unableToExitTitle);
CancelClose = true;
diff --git a/PartPreviewWindow/View3DTransfromPart.cs b/PartPreviewWindow/View3DTransfromPart.cs
index e5dd069da..64f65262a 100644
--- a/PartPreviewWindow/View3DTransfromPart.cs
+++ b/PartPreviewWindow/View3DTransfromPart.cs
@@ -35,8 +35,11 @@ using System.Globalization;
using System.IO;
using System.Threading;
using MatterHackers.Agg;
+using MatterHackers.Agg.Image;
using MatterHackers.Agg.UI;
using MatterHackers.Localizations; //Added Namespace
+using MatterHackers.MatterControl.DataStorage;
+using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.MatterControl.PrintQueue;
using MatterHackers.MeshVisualizer;
using MatterHackers.PolygonMesh;
@@ -45,9 +48,6 @@ using MatterHackers.RayTracer;
using MatterHackers.RayTracer.Traceable;
using MatterHackers.RenderOpenGl;
using MatterHackers.VectorMath;
-using MatterHackers.Agg.Image;
-using MatterHackers.MatterControl.DataStorage;
-using MatterHackers.Agg.ImageProcessing;
namespace MatterHackers.MatterControl.PartPreviewWindow
{
@@ -453,17 +453,17 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if (windowType == WindowType.Embeded)
{
- PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(SetEditControlsBasedOnPrinterState, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(SetEditControlsBasedOnPrinterState, ref unregisterEvents);
}
SetEditControlsBasedOnPrinterState(this, null);
}
void SetEditControlsBasedOnPrinterState(object sender, EventArgs e)
{
- switch (PrinterCommunication.Instance.CommunicationState)
+ switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
{
- case PrinterCommunication.CommunicationStates.Printing:
- case PrinterCommunication.CommunicationStates.Paused:
+ case PrinterConnectionAndCommunication.CommunicationStates.Printing:
+ case PrinterConnectionAndCommunication.CommunicationStates.Paused:
LockEditControls();
break;
@@ -803,10 +803,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
void meshViewerWidget_LoadDone(object sender, EventArgs e)
{
- switch (PrinterCommunication.Instance.CommunicationState)
+ switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
{
- case PrinterCommunication.CommunicationStates.Printing:
- case PrinterCommunication.CommunicationStates.Paused:
+ case PrinterConnectionAndCommunication.CommunicationStates.Printing:
+ case PrinterConnectionAndCommunication.CommunicationStates.Paused:
break;
default:
diff --git a/PartPreviewWindow/ViewGcodeBasic.cs b/PartPreviewWindow/ViewGcodeBasic.cs
index 6e882a060..a24bf4d2c 100644
--- a/PartPreviewWindow/ViewGcodeBasic.cs
+++ b/PartPreviewWindow/ViewGcodeBasic.cs
@@ -33,10 +33,11 @@ using System.IO;
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.GCodeVisualizer;
-using MatterHackers.MeshVisualizer;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.MatterControl.PrintQueue;
using MatterHackers.MatterControl.SlicerConfiguration;
+using MatterHackers.MeshVisualizer;
using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl.PartPreviewWindow
@@ -250,11 +251,11 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
private void SetAnimationPosition()
{
- int currentLayer = PrinterCommunication.Instance.CurrentlyPrintingLayer;
+ int currentLayer = PrinterConnectionAndCommunication.Instance.CurrentlyPrintingLayer;
if (currentLayer >= 1)
{
selectLayerSlider.Value = currentLayer-1;
- layerEndRenderRatioSlider.Value = PrinterCommunication.Instance.RatioIntoCurrentLayer;
+ layerEndRenderRatioSlider.Value = PrinterConnectionAndCommunication.Instance.RatioIntoCurrentLayer;
layerStartRenderRatioSlider.Value = 0;
}
}
@@ -532,8 +533,8 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
// The idea here is we just got asked to rebuild the window (and it is being created now)
// because the gcode finished creating for the print that is printing.
// We don't want to be notified if any other updates happen to this gcode while it is printing.
- if (PrinterCommunication.Instance.PrinterIsPrinting
- && PrinterCommunication.Instance.ActivePrintItem == printItem)
+ if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
+ && PrinterConnectionAndCommunication.Instance.ActivePrintItem == printItem)
{
printItem.SlicingOutputMessage.UnregisterEvent(sliceItem_SlicingOutputMessage, ref unregisterEvents);
printItem.SlicingDone.UnregisterEvent(sliceItem_Done, ref unregisterEvents);
@@ -541,7 +542,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
generateGCodeButton.Visible = false;
// However if the print finished or is canceled we are going to want to get updates again. So, hook the status event
- PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(HookUpGCodeMessagesWhenDonePrinting, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(HookUpGCodeMessagesWhenDonePrinting, ref unregisterEvents);
}
}
@@ -554,7 +555,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
void HookUpGCodeMessagesWhenDonePrinting(object sender, EventArgs e)
{
- if(!PrinterCommunication.Instance.PrinterIsPaused && !PrinterCommunication.Instance.PrinterIsPrinting)
+ if(!PrinterConnectionAndCommunication.Instance.PrinterIsPaused && !PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
{
// unregister first to make sure we don't double up in error (should not be needed but no harm)
printItem.SlicingOutputMessage.UnregisterEvent(sliceItem_SlicingOutputMessage, ref unregisterEvents);
diff --git a/PrintHistory/PrintHistoryListControl.cs b/PrintHistory/PrintHistoryListControl.cs
index cc29e491c..8a995bd49 100644
--- a/PrintHistory/PrintHistoryListControl.cs
+++ b/PrintHistory/PrintHistoryListControl.cs
@@ -29,17 +29,12 @@ either expressed or implied, of the FreeBSD Project.
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.IO;
-
-using MatterHackers.Agg.Image;
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
-using MatterHackers.VectorMath;
-using MatterHackers.MatterControl;
using MatterHackers.MatterControl.DataStorage;
-using MatterHackers.MatterControl.PrintQueue;
+using MatterHackers.MatterControl.PrinterCommunication;
+using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl.PrintHistory
{
@@ -188,12 +183,15 @@ namespace MatterHackers.MatterControl.PrintHistory
void AddHandlers()
{
- PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(ReloadData, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(ReloadData, ref unregisterEvents);
}
void ReloadData(object sender, EventArgs e)
- {
- LoadHistoryItems(Count);
+ {
+ using (TimedLock.Lock(this, "ReloadData PrintHistory"))
+ {
+ LoadHistoryItems(Count);
+ }
}
event EventHandler unregisterEvents;
diff --git a/PrintQueue/OptionsMenu/ExportToFolderProcess.cs b/PrintQueue/OptionsMenu/ExportToFolderProcess.cs
index 51288625c..2ca53655b 100644
--- a/PrintQueue/OptionsMenu/ExportToFolderProcess.cs
+++ b/PrintQueue/OptionsMenu/ExportToFolderProcess.cs
@@ -192,7 +192,7 @@ namespace MatterHackers.MatterControl.PrintQueue
if (ActivePrinterProfile.Instance.DoPrintLeveling)
{
GCodeFile unleveledGCode = new GCodeFile(savedGcodeFileName);
- PrintLeveling.Instance.ApplyLeveling(unleveledGCode);
+ PrintLevelingPlane.Instance.ApplyLeveling(unleveledGCode);
unleveledGCode.Save(outputPathAndName);
}
else
diff --git a/PrintQueue/QueueData.cs b/PrintQueue/QueueData.cs
index 5c3eb0261..2f9f67a12 100644
--- a/PrintQueue/QueueData.cs
+++ b/PrintQueue/QueueData.cs
@@ -40,6 +40,7 @@ using MatterHackers.VectorMath;
using MatterHackers.MatterControl;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.Agg.ImageProcessing;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.PrintQueue
{
@@ -138,8 +139,8 @@ namespace MatterHackers.MatterControl.PrintQueue
{
if (index >= 0 && index < Count)
{
- bool ActiveItemMustStayInQueue = PrinterCommunication.Instance.PrinterIsPrinting || PrinterCommunication.Instance.PrinterIsPaused;
- bool PartMustStayInQueue = ActiveItemMustStayInQueue && PrintItems[index] == PrinterCommunication.Instance.ActivePrintItem;
+ bool ActiveItemMustStayInQueue = PrinterConnectionAndCommunication.Instance.PrinterIsPrinting || PrinterConnectionAndCommunication.Instance.PrinterIsPaused;
+ bool PartMustStayInQueue = ActiveItemMustStayInQueue && PrintItems[index] == PrinterConnectionAndCommunication.Instance.ActivePrintItem;
if (!PartMustStayInQueue)
{
PrintItems.RemoveAt(index);
diff --git a/PrintQueue/QueueDataView.cs b/PrintQueue/QueueDataView.cs
index b743b4930..b4c49f850 100644
--- a/PrintQueue/QueueDataView.cs
+++ b/PrintQueue/QueueDataView.cs
@@ -28,18 +28,13 @@ either expressed or implied, of the FreeBSD Project.
*/
using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.IO;
-
-using MatterHackers.Agg.Image;
using MatterHackers.Agg;
+using MatterHackers.Agg.Image;
using MatterHackers.Agg.UI;
-using MatterHackers.VectorMath;
-using MatterHackers.MatterControl;
using MatterHackers.MatterControl.DataStorage;
-using MatterHackers.Agg.ImageProcessing;
+using MatterHackers.MatterControl.PrinterCommunication;
+using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl.PrintQueue
{
@@ -200,12 +195,12 @@ namespace MatterHackers.MatterControl.PrintQueue
if (index == selectedIndex)
{
((QueueRowItem)child.Children[0]).isSelectedItem = true;
- if (!PrinterCommunication.Instance.PrinterIsPrinting && !PrinterCommunication.Instance.PrinterIsPaused)
+ if (!PrinterConnectionAndCommunication.Instance.PrinterIsPrinting && !PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
{
((QueueRowItem)child.Children[0]).isActivePrint = true;
- PrinterCommunication.Instance.ActivePrintItem = ((QueueRowItem)child.Children[0]).PrintItemWrapper;
+ PrinterConnectionAndCommunication.Instance.ActivePrintItem = ((QueueRowItem)child.Children[0]).PrintItemWrapper;
}
- else if (((QueueRowItem)child.Children[0]).PrintItemWrapper == PrinterCommunication.Instance.ActivePrintItem)
+ else if (((QueueRowItem)child.Children[0]).PrintItemWrapper == PrinterConnectionAndCommunication.Instance.ActivePrintItem)
{
// the selection must be the active print item
((QueueRowItem)child.Children[0]).isActivePrint = true;
@@ -217,7 +212,7 @@ namespace MatterHackers.MatterControl.PrintQueue
{
((QueueRowItem)child.Children[0]).isSelectedItem = false;
}
- if (!PrinterCommunication.Instance.PrinterIsPrinting && !PrinterCommunication.Instance.PrinterIsPaused)
+ if (!PrinterConnectionAndCommunication.Instance.PrinterIsPrinting && !PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
{
if (((QueueRowItem)child.Children[0]).isActivePrint)
{
@@ -232,7 +227,7 @@ namespace MatterHackers.MatterControl.PrintQueue
if (QueueData.Instance.Count == 0)
{
- PrinterCommunication.Instance.ActivePrintItem = null;
+ PrinterConnectionAndCommunication.Instance.ActivePrintItem = null;
}
}
}
diff --git a/PrinterCommunication/ActivePrinterProfile.cs b/PrinterCommunication/ActivePrinterProfile.cs
index 6df3309d5..566e8da01 100644
--- a/PrinterCommunication/ActivePrinterProfile.cs
+++ b/PrinterCommunication/ActivePrinterProfile.cs
@@ -47,6 +47,7 @@ using MatterHackers.MatterControl.DataStorage;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl
{
@@ -130,7 +131,7 @@ namespace MatterHackers.MatterControl
{
if (activePrinter != value)
{
- PrinterCommunication.Instance.Disable();
+ PrinterConnectionAndCommunication.Instance.Disable();
activePrinter = value;
ValidateMaterialSettings();
@@ -342,7 +343,7 @@ namespace MatterHackers.MatterControl
if (DoPrintLeveling)
{
PrintLevelingData levelingData = PrintLevelingData.GetForPrinter(ActivePrinterProfile.Instance.ActivePrinter);
- PrintLeveling.Instance.SetPrintLevelingEquation(
+ PrintLevelingPlane.Instance.SetPrintLevelingEquation(
levelingData.sampledPosition0,
levelingData.sampledPosition1,
levelingData.sampledPosition2,
@@ -358,8 +359,8 @@ namespace MatterHackers.MatterControl
if (autoConnectProfile != null)
{
ActivePrinterProfile.Instance.ActivePrinter = autoConnectProfile;
- PrinterCommunication.Instance.HaltConnectionThread();
- PrinterCommunication.Instance.ConnectToActivePrinter();
+ PrinterConnectionAndCommunication.Instance.HaltConnectionThread();
+ PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter();
}
}
diff --git a/PrinterCommunication/Io/PrinterIoBase.cs b/PrinterCommunication/Io/PrinterIoBase.cs
new file mode 100644
index 000000000..b76959b76
--- /dev/null
+++ b/PrinterCommunication/Io/PrinterIoBase.cs
@@ -0,0 +1,67 @@
+/*
+Copyright (c) 2014, Lars Brubaker
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The views and conclusions contained in the software and documentation are those
+of the authors and should not be interpreted as representing official policies,
+either expressed or implied, of the FreeBSD Project.
+*/
+
+// This is the base class for translators and sources to the printer communication. Things like bed leveling,
+// temperature injection, etc.
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+
+namespace MatterHackers.MatterControl.PrinterCommunication.Io
+{
+ public abstract class PrinterIoBase
+ {
+ PrinterIoBase source;
+
+ public PrinterIoBase(PrinterIoBase source)
+ {
+ this.source = source;
+ }
+
+ public string PeekNextLine()
+ {
+ throw new NotImplementedException();
+ }
+
+ public string PopNextLine()
+ {
+ throw new NotImplementedException();
+ }
+
+ public int NumberOfLines
+ {
+ get
+ {
+ throw new NotImplementedException();
+ }
+ }
+ }
+}
diff --git a/PrinterCommunication/Io/PrinterIoGCodeFile.cs b/PrinterCommunication/Io/PrinterIoGCodeFile.cs
new file mode 100644
index 000000000..56530e10b
--- /dev/null
+++ b/PrinterCommunication/Io/PrinterIoGCodeFile.cs
@@ -0,0 +1,47 @@
+/*
+Copyright (c) 2014, Lars Brubaker
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The views and conclusions contained in the software and documentation are those
+of the authors and should not be interpreted as representing official policies,
+either expressed or implied, of the FreeBSD Project.
+*/
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using MatterHackers.GCodeVisualizer;
+
+namespace MatterHackers.MatterControl.PrinterCommunication.Io
+{
+ public class PrinterIoGCodeFile : PrinterIoBase
+ {
+ GCodeFile loadedGCode = new GCodeFile();
+ public PrinterIoGCodeFile(GCodeFile loadedGCode)
+ : base(null)
+ {
+ this.loadedGCode = loadedGCode;
+ }
+ }
+}
diff --git a/PrinterCommunication/Io/PrinterIoInjectionFifo.cs b/PrinterCommunication/Io/PrinterIoInjectionFifo.cs
new file mode 100644
index 000000000..0074908fb
--- /dev/null
+++ b/PrinterCommunication/Io/PrinterIoInjectionFifo.cs
@@ -0,0 +1,41 @@
+/*
+Copyright (c) 2014, Lars Brubaker
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following disclaimer in the documentation
+ and/or other materials provided with the distribution.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The views and conclusions contained in the software and documentation are those
+of the authors and should not be interpreted as representing official policies,
+either expressed or implied, of the FreeBSD Project.
+*/
+
+using System.Collections.Generic;
+
+namespace MatterHackers.MatterControl.PrinterCommunication.Io
+{
+ public class PrinterIoInjectionFifo : PrinterIoBase
+ {
+ public PrinterIoInjectionFifo(PrinterIoBase source)
+ : base(source)
+ {
+ }
+ }
+}
diff --git a/PrinterCommunication/PrinterCommunication.cs b/PrinterCommunication/PrinterConnectionAndCommunication.cs
similarity index 97%
rename from PrinterCommunication/PrinterCommunication.cs
rename to PrinterCommunication/PrinterConnectionAndCommunication.cs
index ad3db8f57..c79b0f7b9 100644
--- a/PrinterCommunication/PrinterCommunication.cs
+++ b/PrinterCommunication/PrinterConnectionAndCommunication.cs
@@ -27,6 +27,8 @@ of the authors and should not be interpreted as representing official policies,
either expressed or implied, of the FreeBSD Project.
*/
+// This should split into Connection and Communication eventually and use PrinterIo for the sourc of data.
+
#define USE_FROSTED_SERIAL_PORT
using System;
@@ -38,21 +40,21 @@ using System.IO.Ports;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
-
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.GCodeVisualizer;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
using MatterHackers.MatterControl.DataStorage;
+using MatterHackers.MatterControl.PrinterCommunication.Io;
using MatterHackers.MatterControl.PrintQueue;
+using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.SerialPortCommunication;
using MatterHackers.SerialPortCommunication.FrostedSerial;
-using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.VectorMath;
-
using Microsoft.Win32.SafeHandles;
-namespace MatterHackers.MatterControl
+namespace MatterHackers.MatterControl.PrinterCommunication
{
///
/// This is a class to pass temperatures to callbacks that expect them.
@@ -94,7 +96,7 @@ namespace MatterHackers.MatterControl
/// It handles opening and closing the serial port and does quite a bit of gcode parsing.
/// It should be refactoried into better moduals at some point.
///
- public class PrinterCommunication
+ public class PrinterConnectionAndCommunication
{
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
internal static extern SafeFileHandle CreateFile(string lpFileName, int dwDesiredAccess, int dwShareMode, IntPtr securityAttrs, int dwCreationDisposition, int dwFlagsAndAttributes, IntPtr hTemplateFile);
@@ -113,7 +115,7 @@ namespace MatterHackers.MatterControl
get { return firmwareVersion; }
}
- static PrinterCommunication globalInstance;
+ static PrinterConnectionAndCommunication globalInstance;
string connectionFailureMessage = "Unknown Reason";
public string ConnectionFailureMessage { get { return connectionFailureMessage; } }
@@ -325,7 +327,7 @@ namespace MatterHackers.MatterControl
}
set
{
- if (!PrinterCommunication.Instance.PrinterIsPrinting)
+ if (!PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
{
if (this.activePrintItem != value)
{
@@ -378,20 +380,20 @@ namespace MatterHackers.MatterControl
}
}
- public static PrinterCommunication Instance
+ public static PrinterConnectionAndCommunication Instance
{
get
{
if (globalInstance == null)
{
- globalInstance = new PrinterCommunication();
+ globalInstance = new PrinterConnectionAndCommunication();
}
return globalInstance;
}
}
- PrinterCommunication()
+ PrinterConnectionAndCommunication()
{
MonitorPrinterTemperature = true;
@@ -1125,9 +1127,9 @@ namespace MatterHackers.MatterControl
public void ConnectToActivePrinter()
{
- if (PrinterCommunication.Instance.ActivePrinter != null)
+ if (PrinterConnectionAndCommunication.Instance.ActivePrinter != null)
{
- ConnectToPrinter(PrinterCommunication.Instance.ActivePrinter);
+ ConnectToPrinter(PrinterConnectionAndCommunication.Instance.ActivePrinter);
}
}
@@ -1413,10 +1415,16 @@ namespace MatterHackers.MatterControl
if (ActivePrinter.DoPrintLeveling)
{
string inputLine = lineBeingSent;
- lineBeingSent = PrintLeveling.Instance.ApplyLeveling(currentDestination, movementMode, inputLine);
+ lineBeingSent = PrintLevelingPlane.Instance.ApplyLeveling(currentDestination, movementMode, inputLine);
}
}
+ PrintLevelingData levelingData = PrintLevelingData.GetForPrinter(ActivePrinterProfile.Instance.ActivePrinter);
+ if(levelingData != null && levelingData.levelingSystem == PrintLevelingData.LevelingSystem.Probe2Points)
+ {
+ lineBeingSent = LevelWizard2Point.ProcesssCommand(lineBeingSent);
+ }
+
return lineBeingSent;
}
@@ -1604,7 +1612,7 @@ namespace MatterHackers.MatterControl
{
serialPort = FrostedSerialPort.Create(this.ActivePrinter.ComPort);
serialPort.BaudRate = this.BaudRate;
- if (PrinterCommunication.Instance.DtrEnableOnConnect)
+ if (PrinterConnectionAndCommunication.Instance.DtrEnableOnConnect)
{
serialPort.DtrEnable = true;
}
@@ -2112,12 +2120,12 @@ namespace MatterHackers.MatterControl
public void SetMovementToAbsolute()
{
- PrinterCommunication.Instance.SendLineToPrinterNow("G90");
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G90");
}
public void SetMovementToRelative()
{
- PrinterCommunication.Instance.SendLineToPrinterNow("G91");
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G91");
}
public void MoveRelative(Axis axis, double moveAmountMm, double feedRateMmPerMinute)
@@ -2125,8 +2133,8 @@ namespace MatterHackers.MatterControl
if (moveAmountMm != 0)
{
SetMovementToRelative();
- PrinterCommunication.Instance.SendLineToPrinterNow("G1 F{0}".FormatWith(feedRateMmPerMinute));
- PrinterCommunication.Instance.SendLineToPrinterNow("G1 {0}{1}".FormatWith(axis, moveAmountMm));
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G1 F{0}".FormatWith(feedRateMmPerMinute));
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G1 {0}{1}".FormatWith(axis, moveAmountMm));
SetMovementToAbsolute();
}
}
@@ -2134,15 +2142,15 @@ namespace MatterHackers.MatterControl
public void MoveAbsolute(Axis axis, double axisPositionMm, double feedRateMmPerMinute)
{
SetMovementToAbsolute();
- PrinterCommunication.Instance.SendLineToPrinterNow("G1 F{0}".FormatWith(feedRateMmPerMinute));
- PrinterCommunication.Instance.SendLineToPrinterNow("G1 {0}{1}".FormatWith(axis, axisPositionMm));
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G1 F{0}".FormatWith(feedRateMmPerMinute));
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G1 {0}{1}".FormatWith(axis, axisPositionMm));
}
public void MoveAbsolute(Vector3 position, double feedRateMmPerMinute)
{
SetMovementToAbsolute();
- 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));
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G1 F{0}".FormatWith(feedRateMmPerMinute));
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G1 X{0}Y{1}Z{2}".FormatWith(position.x, position.y, position.z));
}
public void ReadPosition()
diff --git a/PrinterControls/EditLevelingSettingsWindow.cs b/PrinterControls/EditLevelingSettingsWindow.cs
index 58902f267..697f53800 100644
--- a/PrinterControls/EditLevelingSettingsWindow.cs
+++ b/PrinterControls/EditLevelingSettingsWindow.cs
@@ -196,7 +196,7 @@ namespace MatterHackers.MatterControl
levelingData.sampledPosition1 = positions[1];
levelingData.sampledPosition2 = positions[2];
- PrintLeveling.Instance.SetPrintLevelingEquation(
+ PrintLevelingPlane.Instance.SetPrintLevelingEquation(
levelingData.sampledPosition0,
levelingData.sampledPosition1,
levelingData.sampledPosition2,
diff --git a/PrinterControls/MacroControls.cs b/PrinterControls/MacroControls.cs
index a4941906d..406bdd653 100644
--- a/PrinterControls/MacroControls.cs
+++ b/PrinterControls/MacroControls.cs
@@ -30,16 +30,10 @@ either expressed or implied, of the FreeBSD Project.
using System;
using System.Collections.Generic;
using System.Linq;
-using System.IO;
-using System.Text;
-
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
-using MatterHackers.VectorMath;
-using MatterHackers.Agg.Image;
-using MatterHackers.MatterControl.DataStorage;
-using MatterHackers.Agg.Font;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl
{
@@ -173,7 +167,7 @@ namespace MatterHackers.MatterControl
protected void SentCommandToPrinter(string command)
{
- PrinterCommunication.Instance.SendLineToPrinterNow(command);
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(command);
}
}
}
\ No newline at end of file
diff --git a/PrinterControls/ManualPrinterControls.cs b/PrinterControls/ManualPrinterControls.cs
index 8e56254ef..474701d9b 100644
--- a/PrinterControls/ManualPrinterControls.cs
+++ b/PrinterControls/ManualPrinterControls.cs
@@ -40,6 +40,7 @@ using MatterHackers.Agg.Image;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.CustomWidgets;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl
{
@@ -111,7 +112,7 @@ namespace MatterHackers.MatterControl
static string GetMovementSpeedsString()
{
string presets = "x,3000,y,3000,z,315,e0,150"; // stored x,value,y,value,z,value,e1,value,e2,value,e3,value,...
- if (PrinterCommunication.Instance != null && ActivePrinterProfile.Instance.ActivePrinter != null)
+ if (PrinterConnectionAndCommunication.Instance != null && ActivePrinterProfile.Instance.ActivePrinter != null)
{
string savedSettings = ActivePrinterProfile.Instance.ActivePrinter.ManualMovementSpeeds;
if (savedSettings != null && savedSettings != "")
@@ -262,13 +263,13 @@ namespace MatterHackers.MatterControl
#if false // This is to force the creation of the repetier window for testing when we don't have repetier firmware.
new MatterHackers.MatterControl.EeProm.EePromRepetierWidget();
#else
- switch(PrinterCommunication.Instance.FirmwareType)
+ switch(PrinterConnectionAndCommunication.Instance.FirmwareType)
{
- case PrinterCommunication.FirmwareTypes.Repetier:
+ case PrinterConnectionAndCommunication.FirmwareTypes.Repetier:
new MatterHackers.MatterControl.EeProm.EePromRepetierWidget();
break;
- case PrinterCommunication.FirmwareTypes.Marlin:
+ case PrinterConnectionAndCommunication.FirmwareTypes.Marlin:
new MatterHackers.MatterControl.EeProm.EePromMarlinWidget();
break;
@@ -365,7 +366,7 @@ namespace MatterHackers.MatterControl
EditableNumberDisplay fanSpeedDisplay;
private GuiWidget CreateFanControls()
{
- PrinterCommunication.Instance.FanSpeedSet.RegisterEvent(FanSpeedChanged_Event, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.FanSpeedSet.RegisterEvent(FanSpeedChanged_Event, ref unregisterEvents);
FlowLayoutWidget leftToRight = new FlowLayoutWidget();
leftToRight.Padding = new BorderDouble(3, 0, 0, 5);
@@ -374,10 +375,10 @@ namespace MatterHackers.MatterControl
fanSpeedDescription.VAnchor = Agg.UI.VAnchor.ParentCenter;
leftToRight.AddChild(fanSpeedDescription);
- fanSpeedDisplay = new EditableNumberDisplay(textImageButtonFactory, PrinterCommunication.Instance.FanSpeed0To255.ToString(), "100");
+ fanSpeedDisplay = new EditableNumberDisplay(textImageButtonFactory, PrinterConnectionAndCommunication.Instance.FanSpeed0To255.ToString(), "100");
fanSpeedDisplay.EditComplete += (sender, e) =>
{
- PrinterCommunication.Instance.FanSpeed0To255 = (int)(fanSpeedDisplay.GetValue() * 255.5 / 100);
+ PrinterConnectionAndCommunication.Instance.FanSpeed0To255 = (int)(fanSpeedDisplay.GetValue() * 255.5 / 100);
};
leftToRight.AddChild(fanSpeedDisplay);
@@ -391,7 +392,7 @@ namespace MatterHackers.MatterControl
void FanSpeedChanged_Event(object sender, EventArgs e)
{
- int printerFanSpeed = PrinterCommunication.Instance.FanSpeed0To255;
+ int printerFanSpeed = PrinterConnectionAndCommunication.Instance.FanSpeed0To255;
fanSpeedDisplay.SetDisplayString(((int)(printerFanSpeed * 100.5 / 255)).ToString());
}
@@ -429,7 +430,7 @@ namespace MatterHackers.MatterControl
FlowLayoutWidget feedRateLeftToRight;
{
feedRateValue = new NumberEdit(0, allowDecimals: true, minValue: minFeedRateRatio, maxValue: maxFeedRateRatio, pixelWidth: 40);
- feedRateValue.Value = ((int)(PrinterCommunication.Instance.FeedRateRatio * 100 + .5)) / 100.0;
+ feedRateValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.FeedRateRatio * 100 + .5)) / 100.0;
feedRateLeftToRight = new FlowLayoutWidget();
@@ -439,13 +440,13 @@ namespace MatterHackers.MatterControl
feedRateLeftToRight.AddChild(feedRateDescription);
feedRateRatioSlider = new Slider(new Vector2(), 300, minFeedRateRatio, maxFeedRateRatio);
feedRateRatioSlider.Margin = new BorderDouble(5, 0);
- feedRateRatioSlider.Value = PrinterCommunication.Instance.FeedRateRatio;
+ feedRateRatioSlider.Value = PrinterConnectionAndCommunication.Instance.FeedRateRatio;
feedRateRatioSlider.View.BackgroundColor = new RGBA_Bytes();
feedRateRatioSlider.ValueChanged += (sender, e) =>
{
- PrinterCommunication.Instance.FeedRateRatio = feedRateRatioSlider.Value;
+ PrinterConnectionAndCommunication.Instance.FeedRateRatio = feedRateRatioSlider.Value;
};
- PrinterCommunication.Instance.FeedRateRatioChanged.RegisterEvent(FeedRateRatioChanged_Event, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.FeedRateRatioChanged.RegisterEvent(FeedRateRatioChanged_Event, ref unregisterEvents);
feedRateValue.EditComplete += (sender, e) =>
{
feedRateRatioSlider.Value = feedRateValue.Value;
@@ -467,7 +468,7 @@ namespace MatterHackers.MatterControl
TextWidget extrusionDescription;
{
extrusionValue = new NumberEdit(0, allowDecimals: true, minValue: minExtrutionRatio, maxValue: maxExtrusionRatio, pixelWidth: 40);
- extrusionValue.Value = ((int)(PrinterCommunication.Instance.ExtrusionRatio * 100 + .5)) / 100.0;
+ extrusionValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.ExtrusionRatio * 100 + .5)) / 100.0;
FlowLayoutWidget leftToRight = new FlowLayoutWidget();
leftToRight.Margin = new BorderDouble(top: 10);
@@ -478,13 +479,13 @@ namespace MatterHackers.MatterControl
leftToRight.AddChild(extrusionDescription);
extrusionRatioSlider = new Slider(new Vector2(), 300, minExtrutionRatio, maxExtrusionRatio);
extrusionRatioSlider.Margin = new BorderDouble(5, 0);
- extrusionRatioSlider.Value = PrinterCommunication.Instance.ExtrusionRatio;
+ extrusionRatioSlider.Value = PrinterConnectionAndCommunication.Instance.ExtrusionRatio;
extrusionRatioSlider.View.BackgroundColor = new RGBA_Bytes();
extrusionRatioSlider.ValueChanged += (sender, e) =>
{
- PrinterCommunication.Instance.ExtrusionRatio = extrusionRatioSlider.Value;
+ PrinterConnectionAndCommunication.Instance.ExtrusionRatio = extrusionRatioSlider.Value;
};
- PrinterCommunication.Instance.ExtrusionRatioChanged.RegisterEvent(ExtrusionRatioChanged_Event, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.ExtrusionRatioChanged.RegisterEvent(ExtrusionRatioChanged_Event, ref unregisterEvents);
extrusionValue.EditComplete += (sender, e) =>
{
extrusionRatioSlider.Value = extrusionValue.Value;
@@ -516,8 +517,8 @@ namespace MatterHackers.MatterControl
void ExtrusionRatioChanged_Event(object sender, EventArgs e)
{
- extrusionRatioSlider.Value = PrinterCommunication.Instance.ExtrusionRatio;
- extrusionValue.Value = ((int)(PrinterCommunication.Instance.ExtrusionRatio * 100 + .5)) / 100.0;
+ extrusionRatioSlider.Value = PrinterConnectionAndCommunication.Instance.ExtrusionRatio;
+ extrusionValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.ExtrusionRatio * 100 + .5)) / 100.0;
}
public override void OnClosed(EventArgs e)
@@ -532,8 +533,8 @@ namespace MatterHackers.MatterControl
void FeedRateRatioChanged_Event(object sender, EventArgs e)
{
- feedRateRatioSlider.Value = PrinterCommunication.Instance.FeedRateRatio;
- feedRateValue.Value = ((int)(PrinterCommunication.Instance.FeedRateRatio * 100 + .5)) / 100.0;
+ feedRateRatioSlider.Value = PrinterConnectionAndCommunication.Instance.FeedRateRatio;
+ feedRateValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.FeedRateRatio * 100 + .5)) / 100.0;
}
private GuiWidget CreateSdCardManagerContainer()
@@ -602,13 +603,13 @@ namespace MatterHackers.MatterControl
}
else // we at least have a printer selected
{
- switch (PrinterCommunication.Instance.CommunicationState)
+ switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
{
- case PrinterCommunication.CommunicationStates.Disconnecting:
- case PrinterCommunication.CommunicationStates.ConnectionLost:
- case PrinterCommunication.CommunicationStates.Disconnected:
- case PrinterCommunication.CommunicationStates.AttemptingToConnect:
- case PrinterCommunication.CommunicationStates.FailedToConnect:
+ case PrinterConnectionAndCommunication.CommunicationStates.Disconnecting:
+ case PrinterConnectionAndCommunication.CommunicationStates.ConnectionLost:
+ case PrinterConnectionAndCommunication.CommunicationStates.Disconnected:
+ case PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect:
+ case PrinterConnectionAndCommunication.CommunicationStates.FailedToConnect:
extruderTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
bedTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
movementControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
@@ -618,8 +619,8 @@ namespace MatterHackers.MatterControl
macroControls.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
break;
- case PrinterCommunication.CommunicationStates.FinishedPrint:
- case PrinterCommunication.CommunicationStates.Connected:
+ case PrinterConnectionAndCommunication.CommunicationStates.FinishedPrint:
+ case PrinterConnectionAndCommunication.CommunicationStates.Connected:
extruderTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
bedTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
movementControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
@@ -629,14 +630,14 @@ namespace MatterHackers.MatterControl
tuningAdjustmentControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
break;
- case PrinterCommunication.CommunicationStates.PreparingToPrint:
- case PrinterCommunication.CommunicationStates.Printing:
- switch (PrinterCommunication.Instance.PrintingState)
+ case PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint:
+ case PrinterConnectionAndCommunication.CommunicationStates.Printing:
+ switch (PrinterConnectionAndCommunication.Instance.PrintingState)
{
- case PrinterCommunication.DetailedPrintingState.HomingAxis:
- case PrinterCommunication.DetailedPrintingState.HeatingBed:
- case PrinterCommunication.DetailedPrintingState.HeatingExtruder:
- case PrinterCommunication.DetailedPrintingState.Printing:
+ case PrinterConnectionAndCommunication.DetailedPrintingState.HomingAxis:
+ case PrinterConnectionAndCommunication.DetailedPrintingState.HeatingBed:
+ case PrinterConnectionAndCommunication.DetailedPrintingState.HeatingExtruder:
+ case PrinterConnectionAndCommunication.DetailedPrintingState.Printing:
extruderTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
bedTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
movementControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
@@ -651,7 +652,7 @@ namespace MatterHackers.MatterControl
}
break;
- case PrinterCommunication.CommunicationStates.Paused:
+ case PrinterConnectionAndCommunication.CommunicationStates.Paused:
extruderTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
bedTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
movementControlsContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
@@ -783,8 +784,8 @@ namespace MatterHackers.MatterControl
private void AddHandlers()
{
ActiveTheme.Instance.ThemeChanged.RegisterEvent(onThemeChanged, ref unregisterEvents);
- PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
- PrinterCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
}
private void onPrinterStatusChanged(object sender, EventArgs e)
@@ -802,27 +803,27 @@ namespace MatterHackers.MatterControl
void disableMotors_Click(object sender, MouseEventArgs mouseEvent)
{
- PrinterCommunication.Instance.ReleaseMotors();
+ PrinterConnectionAndCommunication.Instance.ReleaseMotors();
}
void homeXButton_Click(object sender, MouseEventArgs mouseEvent)
{
- PrinterCommunication.Instance.HomeAxis(PrinterCommunication.Axis.X);
+ PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.X);
}
void homeYButton_Click(object sender, MouseEventArgs mouseEvent)
{
- PrinterCommunication.Instance.HomeAxis(PrinterCommunication.Axis.Y);
+ PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Y);
}
void homeZButton_Click(object sender, MouseEventArgs mouseEvent)
{
- PrinterCommunication.Instance.HomeAxis(PrinterCommunication.Axis.Z);
+ PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Z);
}
void homeAll_Click(object sender, MouseEventArgs mouseEvent)
{
- PrinterCommunication.Instance.HomeAxis(PrinterCommunication.Axis.XYZ);
+ PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.XYZ);
}
public override void OnClosing(out bool CancelClose)
diff --git a/PrinterControls/OutputScrollWindow.cs b/PrinterControls/OutputScrollWindow.cs
index 55ef85fff..41e706ecf 100644
--- a/PrinterControls/OutputScrollWindow.cs
+++ b/PrinterControls/OutputScrollWindow.cs
@@ -28,13 +28,11 @@ either expressed or implied, of the FreeBSD Project.
*/
using System;
using System.Collections.Generic;
-
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
-using MatterHackers.VectorMath;
-using MatterHackers.MatterControl.PrinterControls.PrinterConnections;
-using MatterHackers.SerialPortCommunication;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.PrinterCommunication;
+using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl
{
@@ -116,7 +114,7 @@ namespace MatterHackers.MatterControl
monitorPrinterTemperature = new CheckBox("Monitor Temperature");
monitorPrinterTemperature.Margin = new BorderDouble(5, 5, 5, 2);
- monitorPrinterTemperature.Checked = PrinterCommunication.Instance.MonitorPrinterTemperature;
+ monitorPrinterTemperature.Checked = PrinterConnectionAndCommunication.Instance.MonitorPrinterTemperature;
monitorPrinterTemperature.TextColor = this.textColor;
monitorPrinterTemperature.CheckedStateChanged += new CheckBox.CheckedStateChangedEventHandler(monitorPrinterTemperature_CheckedStateChanged);
@@ -177,7 +175,7 @@ namespace MatterHackers.MatterControl
event EventHandler unregisterEvents;
void AddHandlers()
{
- PrinterCommunication.Instance.ConnectionFailed.RegisterEvent(Instance_ConnectionFailed, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.ConnectionFailed.RegisterEvent(Instance_ConnectionFailed, ref unregisterEvents);
}
public override void OnClosed(EventArgs e)
@@ -192,7 +190,7 @@ namespace MatterHackers.MatterControl
void monitorPrinterTemperature_CheckedStateChanged(object sender, EventArgs e)
{
- PrinterCommunication.Instance.MonitorPrinterTemperature = ((CheckBox)sender).Checked;
+ PrinterConnectionAndCommunication.Instance.MonitorPrinterTemperature = ((CheckBox)sender).Checked;
}
List commandHistory = new List();
@@ -246,7 +244,7 @@ namespace MatterHackers.MatterControl
}
commandHistory.Add(textToSend);
commandHistoryIndex = commandHistory.Count;
- PrinterCommunication.Instance.SendLineToPrinterNow(textToSend);
+ PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(textToSend);
if (!filterOutput.Checked)
{
outputScrollWidget.WriteLine(this, new StringEventArgs(textToSend));
@@ -258,15 +256,15 @@ namespace MatterHackers.MatterControl
{
if (filterOutput.Checked)
{
- PrinterCommunication.Instance.CommunicationUnconditionalFromPrinter.UnregisterEvent(FromPrinter, ref unregisterEvents);
- PrinterCommunication.Instance.CommunicationUnconditionalToPrinter.UnregisterEvent(ToPrinter, ref unregisterEvents);
- PrinterCommunication.Instance.ReadLine.RegisterEvent(outputScrollWidget.WriteLine, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationUnconditionalFromPrinter.UnregisterEvent(FromPrinter, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationUnconditionalToPrinter.UnregisterEvent(ToPrinter, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.ReadLine.RegisterEvent(outputScrollWidget.WriteLine, ref unregisterEvents);
}
else
{
- PrinterCommunication.Instance.CommunicationUnconditionalFromPrinter.RegisterEvent(FromPrinter, ref unregisterEvents);
- PrinterCommunication.Instance.CommunicationUnconditionalToPrinter.RegisterEvent(ToPrinter, ref unregisterEvents);
- PrinterCommunication.Instance.ReadLine.UnregisterEvent(outputScrollWidget.WriteLine, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationUnconditionalFromPrinter.RegisterEvent(FromPrinter, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationUnconditionalToPrinter.RegisterEvent(ToPrinter, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.ReadLine.UnregisterEvent(outputScrollWidget.WriteLine, ref unregisterEvents);
}
}
diff --git a/PrinterControls/PrintLeveling.cs b/PrinterControls/PrintLevelingPlane.cs
similarity index 92%
rename from PrinterControls/PrintLeveling.cs
rename to PrinterControls/PrintLevelingPlane.cs
index 87f7002ee..4a27feb3b 100644
--- a/PrinterControls/PrintLeveling.cs
+++ b/PrinterControls/PrintLevelingPlane.cs
@@ -11,23 +11,23 @@ using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
namespace MatterHackers.MatterControl
{
- public class PrintLeveling
+ public class PrintLevelingPlane
{
Matrix4X4 bedLevelMatrix = Matrix4X4.Identity;
// private constructor
- private PrintLeveling()
+ private PrintLevelingPlane()
{
}
- static private PrintLeveling instance;
- static public PrintLeveling Instance
+ static private PrintLevelingPlane instance;
+ static public PrintLevelingPlane Instance
{
get
{
if (instance == null)
{
- instance = new PrintLeveling();
+ instance = new PrintLevelingPlane();
}
return instance;
@@ -94,14 +94,14 @@ namespace MatterHackers.MatterControl
if (lineBeingSent.Contains('X') || lineBeingSent.Contains('Y') || lineBeingSent.Contains('Z'))
{
- Vector3 outPosition = PrintLeveling.Instance.ApplyLeveling(currentDestination);
+ Vector3 outPosition = PrintLevelingPlane.Instance.ApplyLeveling(currentDestination);
if (movementMode == PrinterMachineInstruction.MovementTypes.Relative)
{
Vector3 relativeMove = Vector3.Zero;
GCodeFile.GetFirstNumberAfter("X", lineBeingSent, ref relativeMove.x);
GCodeFile.GetFirstNumberAfter("Y", lineBeingSent, ref relativeMove.y);
GCodeFile.GetFirstNumberAfter("Z", lineBeingSent, ref relativeMove.z);
- outPosition = PrintLeveling.Instance.ApplyLevelingRotation(relativeMove);
+ outPosition = PrintLevelingPlane.Instance.ApplyLevelingRotation(relativeMove);
}
newLine = newLine + String.Format("X{0:0.##} Y{1:0.##} Z{2:0.##}", outPosition.x, outPosition.y, outPosition.z);
diff --git a/PrinterControls/PrinterConnections/AddConnectionWidget.cs b/PrinterControls/PrinterConnections/AddConnectionWidget.cs
index 6383cf3a1..fb09acd75 100644
--- a/PrinterControls/PrinterConnections/AddConnectionWidget.cs
+++ b/PrinterControls/PrinterConnections/AddConnectionWidget.cs
@@ -1,19 +1,11 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.IO;
using System.IO.Ports;
-using System.Diagnostics;
-
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
-using MatterHackers.Agg.OpenGlGui;
-using MatterHackers.PolygonMesh;
-using MatterHackers.RenderOpenGl;
-using MatterHackers.VectorMath;
-using MatterHackers.MatterControl.DataStorage;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.DataStorage;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
@@ -435,7 +427,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
void CloseWindow(object o, MouseEventArgs e)
{
- PrinterCommunication.Instance.HaltConnectionThread();
+ PrinterConnectionAndCommunication.Instance.HaltConnectionThread();
this.containerWindowToClose.Close();
}
diff --git a/PrinterControls/PrinterConnections/PrinterListItems.cs b/PrinterControls/PrinterConnections/PrinterListItems.cs
index b17b589cb..b21b7d72d 100644
--- a/PrinterControls/PrinterConnections/PrinterListItems.cs
+++ b/PrinterControls/PrinterConnections/PrinterListItems.cs
@@ -8,6 +8,7 @@ using MatterHackers.Agg;
using MatterHackers.Agg.UI;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
@@ -62,7 +63,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
int printerOptionHash = printerRecord.GetHashCode();
if (connectedPrinterHash == printerOptionHash)
{
- availableText = PrinterCommunication.Instance.PrinterConnectionStatusVerbose;
+ availableText = PrinterConnectionAndCommunication.Instance.PrinterConnectionStatusVerbose;
availableColor = new RGBA_Bytes(0,95,107);
}
}
@@ -181,7 +182,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
//Disconnect printer if the printer being removed is currently connected
if (connectedPrinterHash == printerOptionHash)
{
- PrinterCommunication.Instance.Disable();
+ PrinterConnectionAndCommunication.Instance.Disable();
ActivePrinterProfile.Instance.ActivePrinter = null;
}
}
diff --git a/PrinterControls/PrinterConnections/SetupConnectionWidgetBase.cs b/PrinterControls/PrinterConnections/SetupConnectionWidgetBase.cs
index ef1be895e..6a4beaa9d 100644
--- a/PrinterControls/PrinterConnections/SetupConnectionWidgetBase.cs
+++ b/PrinterControls/PrinterConnections/SetupConnectionWidgetBase.cs
@@ -1,20 +1,13 @@
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
using System.IO;
-using System.IO.Ports;
-using System.Diagnostics;
-
using MatterHackers.Agg;
using MatterHackers.Agg.UI;
-using MatterHackers.Agg.OpenGlGui;
-using MatterHackers.PolygonMesh;
-using MatterHackers.RenderOpenGl;
-using MatterHackers.VectorMath;
-using MatterHackers.MatterControl.DataStorage;
-using MatterHackers.MatterControl.PrintQueue;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.DataStorage;
+using MatterHackers.MatterControl.PrinterCommunication;
+using MatterHackers.MatterControl.PrintQueue;
+
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
@@ -192,13 +185,13 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
void CloseWindow(object o, MouseEventArgs e)
{
- PrinterCommunication.Instance.HaltConnectionThread();
+ PrinterConnectionAndCommunication.Instance.HaltConnectionThread();
this.containerWindowToClose.Close();
}
void CancelButton_Click(object sender, MouseEventArgs mouseEvent)
{
- PrinterCommunication.Instance.HaltConnectionThread();
+ PrinterConnectionAndCommunication.Instance.HaltConnectionThread();
if (GetPrinterRecordCount() > 0)
{
this.windowController.ChangeToChoosePrinter();
diff --git a/PrinterControls/PrinterConnections/SetupStepComPortManual.cs b/PrinterControls/PrinterConnections/SetupStepComPortManual.cs
index 24a9ddf71..d7a45faaa 100644
--- a/PrinterControls/PrinterConnections/SetupStepComPortManual.cs
+++ b/PrinterControls/PrinterConnections/SetupStepComPortManual.cs
@@ -14,6 +14,7 @@ using MatterHackers.RenderOpenGl;
using MatterHackers.VectorMath;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
@@ -45,7 +46,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
connectButton = textImageButtonFactory.Generate(LocalizedString.Get("Connect"));
connectButton.Click += new ButtonBase.ButtonEventHandler(ConnectButton_Click);
- PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
refreshButton = textImageButtonFactory.Generate(LocalizedString.Get("Refresh"));
refreshButton.Click += new ButtonBase.ButtonEventHandler(RefreshButton_Click);
@@ -191,11 +192,11 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
void onPrinterStatusChanged(object sender, EventArgs e)
{
- if (PrinterCommunication.Instance.PrinterIsConnected)
+ if (PrinterConnectionAndCommunication.Instance.PrinterIsConnected)
{
onConnectionSuccess();
}
- else if (PrinterCommunication.Instance.CommunicationState != PrinterCommunication.CommunicationStates.AttemptingToConnect)
+ else if (PrinterConnectionAndCommunication.Instance.CommunicationState != PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect)
{
onConnectionFailed();
}
@@ -268,7 +269,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
printerComPortError.TextColor = ActiveTheme.Instance.PrimaryTextColor;
ActivePrinterProfile.Instance.ActivePrinter = this.ActivePrinter;
- PrinterCommunication.Instance.ConnectToActivePrinter();
+ PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter();
connectButton.Visible = false;
refreshButton.Visible = false;
}
diff --git a/PrinterControls/PrinterConnections/SetupStepComPortOne.cs b/PrinterControls/PrinterConnections/SetupStepComPortOne.cs
index 5c041c057..0d663ed6c 100644
--- a/PrinterControls/PrinterConnections/SetupStepComPortOne.cs
+++ b/PrinterControls/PrinterConnections/SetupStepComPortOne.cs
@@ -14,6 +14,7 @@ using MatterHackers.RenderOpenGl;
using MatterHackers.VectorMath;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
@@ -135,7 +136,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
void SkipConnectionLink_Click(object sender, MouseEventArgs mouseEvent)
{
- PrinterCommunication.Instance.HaltConnectionThread();
+ PrinterConnectionAndCommunication.Instance.HaltConnectionThread();
if (GetPrinterRecordCount () > 0)
{
this.windowController.ChangeToChoosePrinter ();
diff --git a/PrinterControls/PrinterConnections/SetupStepComPortTwo.cs b/PrinterControls/PrinterConnections/SetupStepComPortTwo.cs
index 63f01989e..b4507007f 100644
--- a/PrinterControls/PrinterConnections/SetupStepComPortTwo.cs
+++ b/PrinterControls/PrinterConnections/SetupStepComPortTwo.cs
@@ -14,6 +14,7 @@ using MatterHackers.RenderOpenGl;
using MatterHackers.VectorMath;
using MatterHackers.MatterControl.DataStorage;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
{
@@ -41,7 +42,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
connectButton = textImageButtonFactory.Generate(LocalizedString.Get("Connect"));
connectButton.Click += new ButtonBase.ButtonEventHandler(ConnectButton_Click);
- PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
GuiWidget hSpacer = new GuiWidget();
hSpacer.HAnchor = HAnchor.ParentLeftRight;
@@ -173,7 +174,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
printerErrorMessage.Text = printerErrorMessageLabelTwoFull;
this.ActivePrinter.Commit();
ActivePrinterProfile.Instance.ActivePrinter = this.ActivePrinter;
- PrinterCommunication.Instance.ConnectToActivePrinter();
+ PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter();
connectButton.Visible = false;
}
}
@@ -181,11 +182,11 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
void onPrinterStatusChanged(object sender, EventArgs e)
{
- if (PrinterCommunication.Instance.PrinterIsConnected)
+ if (PrinterConnectionAndCommunication.Instance.PrinterIsConnected)
{
onConnectionSuccess();
}
- else if (PrinterCommunication.Instance.CommunicationState != PrinterCommunication.CommunicationStates.AttemptingToConnect)
+ else if (PrinterConnectionAndCommunication.Instance.CommunicationState != PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect)
{
onConnectionFailed();
}
diff --git a/PrinterControls/TemperatureIndicator.cs b/PrinterControls/TemperatureIndicator.cs
index c0f28e796..a828d8a86 100644
--- a/PrinterControls/TemperatureIndicator.cs
+++ b/PrinterControls/TemperatureIndicator.cs
@@ -29,17 +29,12 @@ either expressed or implied, of the FreeBSD Project.
using System;
using System.Collections.Generic;
-using System.Linq;
-using System.IO;
-using System.Text;
-
using MatterHackers.Agg;
-using MatterHackers.Agg.UI;
-using MatterHackers.VectorMath;
-using MatterHackers.Agg.Image;
-using MatterHackers.MatterControl.DataStorage;
using MatterHackers.Agg.Font;
+using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.PrinterCommunication;
+using MatterHackers.VectorMath;
namespace MatterHackers.MatterControl
{
@@ -418,8 +413,8 @@ namespace MatterHackers.MatterControl
event EventHandler unregisterEvents;
void AddHandlers()
{
- PrinterCommunication.Instance.ExtruderTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents);
- PrinterCommunication.Instance.ExtruderTemperatureSet.RegisterEvent(onTemperatureSet, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.ExtruderTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.ExtruderTemperatureSet.RegisterEvent(onTemperatureSet, ref unregisterEvents);
tempOffButton.Click += new ButtonBase.ButtonEventHandler(onOffButtonClicked);
}
@@ -464,29 +459,29 @@ namespace MatterHackers.MatterControl
protected override double GetTargetTemperature()
{
- return PrinterCommunication.Instance.TargetExtruderTemperature;
+ return PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature;
}
protected override double GetActualTemperature()
{
- return PrinterCommunication.Instance.ActualExtruderTemperature;
+ return PrinterConnectionAndCommunication.Instance.ActualExtruderTemperature;
}
protected override void SetTargetTemperature(double targetTemp)
{
double goalTemp = (int)(targetTemp + .5);
- if (PrinterCommunication.Instance.PrinterIsPrinting
- && PrinterCommunication.Instance.PrintingState == PrinterCommunication.DetailedPrintingState.HeatingExtruder
- && goalTemp != PrinterCommunication.Instance.TargetExtruderTemperature)
+ if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
+ && PrinterConnectionAndCommunication.Instance.PrintingState == PrinterConnectionAndCommunication.DetailedPrintingState.HeatingExtruder
+ && goalTemp != PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature)
{
string sliceSettingsNote = "Note: Slice Settings are applied before the print actually starts. Changes while printing will not effect the active print.";
- string message = string.Format("The extruder is currently heating and its target temperature cannot be changed until it reaches {0}°C.\n\nYou can set the starting extruder temperature in 'Slice Settings' -> 'Filament'.\n\n{1}", PrinterCommunication.Instance.TargetExtruderTemperature, sliceSettingsNote);
+ string message = string.Format("The extruder is currently heating and its target temperature cannot be changed until it reaches {0}°C.\n\nYou can set the starting extruder temperature in 'Slice Settings' -> 'Filament'.\n\n{1}", PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature, sliceSettingsNote);
StyledMessageBox.ShowMessageBox(message, "Waiting For Extruder To Heat");
}
else
{
- PrinterCommunication.Instance.TargetExtruderTemperature = (int)(targetTemp + .5);
- string displayString = string.Format("{0:0.0}°C", PrinterCommunication.Instance.TargetExtruderTemperature);
+ PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature = (int)(targetTemp + .5);
+ string displayString = string.Format("{0:0.0}°C", PrinterConnectionAndCommunication.Instance.TargetExtruderTemperature);
targetTemperatureDisplay.SetDisplayString(displayString);
}
}
@@ -508,8 +503,8 @@ namespace MatterHackers.MatterControl
event EventHandler unregisterEvents;
void AddHandlers()
{
- PrinterCommunication.Instance.BedTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents);
- PrinterCommunication.Instance.BedTemperatureSet.RegisterEvent(onTemperatureSet, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.BedTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.BedTemperatureSet.RegisterEvent(onTemperatureSet, ref unregisterEvents);
tempOffButton.Click += new ButtonBase.ButtonEventHandler(onOffButtonClicked);
}
@@ -553,29 +548,29 @@ namespace MatterHackers.MatterControl
protected override double GetActualTemperature()
{
- return PrinterCommunication.Instance.ActualBedTemperature;
+ return PrinterConnectionAndCommunication.Instance.ActualBedTemperature;
}
protected override double GetTargetTemperature()
{
- return PrinterCommunication.Instance.TargetBedTemperature;
+ return PrinterConnectionAndCommunication.Instance.TargetBedTemperature;
}
protected override void SetTargetTemperature(double targetTemp)
{
double goalTemp = (int)(targetTemp + .5);
- if (PrinterCommunication.Instance.PrinterIsPrinting
- && PrinterCommunication.Instance.PrintingState == PrinterCommunication.DetailedPrintingState.HeatingBed
- && goalTemp != PrinterCommunication.Instance.TargetBedTemperature)
+ if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
+ && PrinterConnectionAndCommunication.Instance.PrintingState == PrinterConnectionAndCommunication.DetailedPrintingState.HeatingBed
+ && goalTemp != PrinterConnectionAndCommunication.Instance.TargetBedTemperature)
{
string sliceSettingsNote = "Note: Slice Settings are applied before the print actually starts. Changes while printing will not effect the active print.";
- string message = string.Format("The bed is currently heating and its target temperature cannot be changed until it reaches {0}°C.\n\nYou can set the starting bed temperature in 'Slice Settings' -> 'Filament'.\n\n{1}", PrinterCommunication.Instance.TargetBedTemperature, sliceSettingsNote);
+ string message = string.Format("The bed is currently heating and its target temperature cannot be changed until it reaches {0}°C.\n\nYou can set the starting bed temperature in 'Slice Settings' -> 'Filament'.\n\n{1}", PrinterConnectionAndCommunication.Instance.TargetBedTemperature, sliceSettingsNote);
StyledMessageBox.ShowMessageBox(message, "Waiting For Bed To Heat");
}
else
{
- PrinterCommunication.Instance.TargetBedTemperature = goalTemp;
- string displayString = string.Format("{0:0.0}°C", PrinterCommunication.Instance.TargetBedTemperature);
+ PrinterConnectionAndCommunication.Instance.TargetBedTemperature = goalTemp;
+ string displayString = string.Format("{0:0.0}°C", PrinterConnectionAndCommunication.Instance.TargetBedTemperature);
targetTemperatureDisplay.SetDisplayString(displayString);
}
}
diff --git a/PrinterControls/XYZJogControls.cs b/PrinterControls/XYZJogControls.cs
index 7dd094620..a0b3ce8d1 100644
--- a/PrinterControls/XYZJogControls.cs
+++ b/PrinterControls/XYZJogControls.cs
@@ -38,6 +38,7 @@ using MatterHackers.Agg.Image;
using MatterHackers.Agg;
using MatterHackers.Agg.VertexSource;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.PrinterCommunication;
namespace MatterHackers.MatterControl
{
@@ -184,7 +185,7 @@ namespace MatterHackers.MatterControl
FlowLayoutWidget eButtons = new FlowLayoutWidget(FlowDirection.TopToBottom);
{
FlowLayoutWidget eMinusButtonAndText = new FlowLayoutWidget();
- eMinusControl = moveButtonFactory.Generate("E-", PrinterCommunication.Axis.E, ManualPrinterControls.EFeedRate(0));
+ eMinusControl = moveButtonFactory.Generate("E-", PrinterConnectionAndCommunication.Axis.E, ManualPrinterControls.EFeedRate(0));
eMinusControl.Margin = new BorderDouble(0, 0, 5, 0);
eMinusButtonAndText.AddChild(eMinusControl);
TextWidget eMinusControlLabel = new TextWidget(LocalizedString.Get("Retract"), pointSize: 11);
@@ -204,7 +205,7 @@ namespace MatterHackers.MatterControl
eButtons.AddChild(eSpacer);
FlowLayoutWidget ePlusButtonAndText = new FlowLayoutWidget();
- ePlusControl = moveButtonFactory.Generate("E+", PrinterCommunication.Axis.E, ManualPrinterControls.EFeedRate(0));
+ ePlusControl = moveButtonFactory.Generate("E+", PrinterConnectionAndCommunication.Axis.E, ManualPrinterControls.EFeedRate(0));
ePlusControl.Margin = new BorderDouble(0, 0, 5, 0);
ePlusButtonAndText.AddChild(ePlusControl);
TextWidget ePlusControlLabel = new TextWidget(LocalizedString.Get("Extrude"), pointSize: 11);
@@ -269,7 +270,7 @@ namespace MatterHackers.MatterControl
{
MoveButtonFactory moveButtonFactory = new MoveButtonFactory();
moveButtonFactory.normalFillColor = color;
- zPlusControl = moveButtonFactory.Generate("Z+", PrinterCommunication.Axis.Z, ManualPrinterControls.ZSpeed);
+ zPlusControl = moveButtonFactory.Generate("Z+", PrinterConnectionAndCommunication.Axis.Z, ManualPrinterControls.ZSpeed);
zButtons.AddChild(zPlusControl);
GuiWidget spacer = new GuiWidget(2, buttonSeparationDistance);
@@ -277,7 +278,7 @@ namespace MatterHackers.MatterControl
spacer.BackgroundColor = XYZColors.zColor;
zButtons.AddChild(spacer);
- zMinusControl = moveButtonFactory.Generate("Z-", PrinterCommunication.Axis.Z, ManualPrinterControls.ZSpeed);
+ zMinusControl = moveButtonFactory.Generate("Z-", PrinterConnectionAndCommunication.Axis.Z, ManualPrinterControls.ZSpeed);
zButtons.AddChild(zMinusControl);
}
zButtons.Margin = new BorderDouble(0, 5);
@@ -293,7 +294,7 @@ namespace MatterHackers.MatterControl
moveButtonFactory.normalFillColor = XYZColors.xColor;
xButtons.HAnchor |= Agg.UI.HAnchor.ParentCenter;
xButtons.VAnchor |= Agg.UI.VAnchor.ParentCenter;
- xMinusControl = moveButtonFactory.Generate("X-", PrinterCommunication.Axis.X, ManualPrinterControls.XSpeed);
+ xMinusControl = moveButtonFactory.Generate("X-", PrinterConnectionAndCommunication.Axis.X, ManualPrinterControls.XSpeed);
xButtons.AddChild(xMinusControl);
GuiWidget spacer = new GuiWidget(xMinusControl.Width + buttonSeparationDistance * 2, 2);
@@ -301,7 +302,7 @@ namespace MatterHackers.MatterControl
spacer.BackgroundColor = XYZColors.xColor;
xButtons.AddChild(spacer);
- xPlusControl = moveButtonFactory.Generate("X+", PrinterCommunication.Axis.X, ManualPrinterControls.XSpeed);
+ xPlusControl = moveButtonFactory.Generate("X+", PrinterConnectionAndCommunication.Axis.X, ManualPrinterControls.XSpeed);
xButtons.AddChild(xPlusControl);
}
xyGrid.AddChild(xButtons);
@@ -311,7 +312,7 @@ namespace MatterHackers.MatterControl
moveButtonFactory.normalFillColor = XYZColors.yColor;
yButtons.HAnchor |= Agg.UI.HAnchor.ParentCenter;
yButtons.VAnchor |= Agg.UI.VAnchor.ParentCenter;
- yPlusControl = moveButtonFactory.Generate("Y+", PrinterCommunication.Axis.Y, ManualPrinterControls.YSpeed);
+ yPlusControl = moveButtonFactory.Generate("Y+", PrinterConnectionAndCommunication.Axis.Y, ManualPrinterControls.YSpeed);
yButtons.AddChild(yPlusControl);
GuiWidget spacer = new GuiWidget(2, buttonSeparationDistance);
@@ -319,7 +320,7 @@ namespace MatterHackers.MatterControl
spacer.BackgroundColor = XYZColors.yColor;
yButtons.AddChild(spacer);
- yMinusControl = moveButtonFactory.Generate("Y-", PrinterCommunication.Axis.Y, ManualPrinterControls.YSpeed);
+ yMinusControl = moveButtonFactory.Generate("Y-", PrinterConnectionAndCommunication.Axis.Y, ManualPrinterControls.YSpeed);
yButtons.AddChild(yMinusControl);
}
xyGrid.AddChild(yButtons);
@@ -333,13 +334,13 @@ namespace MatterHackers.MatterControl
public class MoveButton : Button
{
- PrinterCommunication.Axis moveAxis;
+ PrinterConnectionAndCommunication.Axis moveAxis;
//Amounts in millimeters
public double MoveAmount = 10;
private double movementFeedRate;
- public MoveButton(double x, double y, GuiWidget buttonView, PrinterCommunication.Axis axis, double movementFeedRate)
+ public MoveButton(double x, double y, GuiWidget buttonView, PrinterConnectionAndCommunication.Axis axis, double movementFeedRate)
: base(x, y, buttonView)
{
this.moveAxis = axis;
@@ -353,7 +354,7 @@ namespace MatterHackers.MatterControl
MoveButton moveButton = (MoveButton)sender;
//Add more fancy movement here
- PrinterCommunication.Instance.MoveRelative(this.moveAxis, this.MoveAmount, movementFeedRate);
+ PrinterConnectionAndCommunication.Instance.MoveRelative(this.moveAxis, this.MoveAmount, movementFeedRate);
}
}
@@ -402,7 +403,7 @@ namespace MatterHackers.MatterControl
public RGBA_Bytes pressedTextColor = RGBA_Bytes.White;
public RGBA_Bytes disabledTextColor = RGBA_Bytes.White;
- public MoveButton Generate(string label, PrinterCommunication.Axis axis, double movementFeedRate)
+ public MoveButton Generate(string label, PrinterConnectionAndCommunication.Axis axis, double movementFeedRate)
{
//Create button based on view container widget
ButtonViewStates buttonViewWidget = getButtonView(label);
diff --git a/SlicerConfiguration/ActiveSliceSettings.cs b/SlicerConfiguration/ActiveSliceSettings.cs
index f8eb8cb06..2a14f9bf9 100644
--- a/SlicerConfiguration/ActiveSliceSettings.cs
+++ b/SlicerConfiguration/ActiveSliceSettings.cs
@@ -129,7 +129,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
{
PrintLevelingData levelingData = PrintLevelingData.GetForPrinter(ActivePrinterProfile.Instance.ActivePrinter);
- PrintLeveling.Instance.SetPrintLevelingEquation(
+ PrintLevelingPlane.Instance.SetPrintLevelingEquation(
levelingData.sampledPosition0,
levelingData.sampledPosition1,
levelingData.sampledPosition2,
diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs
index 969f7eb78..7eb04e67d 100644
--- a/SlicerConfiguration/SliceSettingsWidget.cs
+++ b/SlicerConfiguration/SliceSettingsWidget.cs
@@ -34,9 +34,8 @@ using MatterHackers.Agg.Font;
using MatterHackers.Agg.UI;
using MatterHackers.Agg.VertexSource;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.PrinterCommunication;
using MatterHackers.VectorMath;
-using MatterHackers.MatterControl;
-using MatterHackers.MatterControl.SlicerConfiguration;
namespace MatterHackers.MatterControl.SlicerConfiguration
{
@@ -276,9 +275,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
event EventHandler unregisterEvents;
private void AddHandlers()
{
- PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(APP_onPrinterStatusChanged, ref unregisterEvents);
- PrinterCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
+ PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
}
public override void OnClosed(EventArgs e)
diff --git a/SlicerConfiguration/SlicingQueue.cs b/SlicerConfiguration/SlicingQueue.cs
index 7ca68f01e..4f042df7f 100644
--- a/SlicerConfiguration/SlicingQueue.cs
+++ b/SlicerConfiguration/SlicingQueue.cs
@@ -29,20 +29,17 @@ either expressed or implied, of the FreeBSD Project.
//#define RUN_MATTER_SLICE_IN_PROCESS
using System;
-using System.IO;
using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading;
-using System.Runtime.InteropServices;
using System.Diagnostics;
using System.Globalization;
-
+using System.IO;
+using System.Threading;
using MatterHackers.Agg;
-using MatterHackers.MatterControl.DataStorage;
-using MatterHackers.MatterControl.PrintQueue;
using MatterHackers.Agg.UI;
using MatterHackers.Localizations;
+using MatterHackers.MatterControl.DataStorage;
+using MatterHackers.MatterControl.PrinterCommunication;
+using MatterHackers.MatterControl.PrintQueue;
namespace MatterHackers.MatterControl.SlicerConfiguration
{
@@ -200,7 +197,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
while (!haltSlicingThread)
{
- if (PrinterCommunication.Instance.ActivePrintItem != null && listOfSlicingItems.Count > 0)
+ if (PrinterConnectionAndCommunication.Instance.ActivePrintItem != null && listOfSlicingItems.Count > 0)
{
PrintItemWrapper itemToSlice = listOfSlicingItems[0];
// check that the STL file is currently on disk