Rename PrinterConnectionAndCommunication
This commit is contained in:
parent
6c0e78eef6
commit
9aaf0f6311
71 changed files with 504 additions and 504 deletions
|
|
@ -80,8 +80,8 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
AddChildElements(buttonFactory, parentWidget);
|
||||
|
||||
// Add Handlers
|
||||
PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onStateChanged, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onStateChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.ActivePrintItemChanged.RegisterEvent(onStateChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(onStateChanged, ref unregisterEvents);
|
||||
ProfileManager.ProfilesListChanged.RegisterEvent(onStateChanged, ref unregisterEvents);
|
||||
}
|
||||
|
||||
|
|
@ -124,8 +124,8 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
else
|
||||
#endif
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.HaltConnectionThread();
|
||||
PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter(true);
|
||||
PrinterConnection.Instance.HaltConnectionThread();
|
||||
PrinterConnection.Instance.ConnectToActivePrinter(true);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -149,13 +149,13 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
resetConnectionButton = buttonFactory.GenerateTooltipButton("Reset".Localize().ToUpper(), StaticData.Instance.LoadIcon("e_stop4.png", 32,32).InvertLightness());
|
||||
resetConnectionButton.ToolTipText = "Reboots the firmware on the controller".Localize();
|
||||
resetConnectionButton.Margin = new BorderDouble(6, 6, 6, 3);
|
||||
resetConnectionButton.Click += (s, e) => UiThread.RunOnIdle(PrinterConnectionAndCommunication.Instance.RebootBoard);
|
||||
resetConnectionButton.Click += (s, e) => UiThread.RunOnIdle(PrinterConnection.Instance.RebootBoard);
|
||||
|
||||
pauseButton = buttonFactory.GenerateTooltipButton("Pause".Localize().ToUpper());
|
||||
pauseButton.ToolTipText = "Pause the current print".Localize();
|
||||
pauseButton.Click += (s, e) =>
|
||||
{
|
||||
UiThread.RunOnIdle(PrinterConnectionAndCommunication.Instance.RequestPause);
|
||||
UiThread.RunOnIdle(PrinterConnection.Instance.RequestPause);
|
||||
pauseButton.Enabled = false;
|
||||
};
|
||||
parentWidget.AddChild(pauseButton);
|
||||
|
|
@ -184,9 +184,9 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
resumeButton.Name = "Resume Button";
|
||||
resumeButton.Click += (s, e) =>
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
|
||||
if (PrinterConnection.Instance.PrinterIsPaused)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.Resume();
|
||||
PrinterConnection.Instance.Resume();
|
||||
}
|
||||
pauseButton.Enabled = true;
|
||||
};
|
||||
|
|
@ -248,8 +248,8 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
protected void SetButtonStates()
|
||||
{
|
||||
this.activePrintButtons.Clear();
|
||||
if (!PrinterConnectionAndCommunication.Instance.PrinterIsConnected
|
||||
&& PrinterConnectionAndCommunication.Instance.CommunicationState != PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect)
|
||||
if (!PrinterConnection.Instance.PrinterIsConnected
|
||||
&& PrinterConnection.Instance.CommunicationState != PrinterConnection.CommunicationStates.AttemptingToConnect)
|
||||
{
|
||||
if (!ProfileManager.Instance.ActiveProfiles.Any())
|
||||
{
|
||||
|
|
@ -273,14 +273,14 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
}
|
||||
else
|
||||
{
|
||||
switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
|
||||
switch (PrinterConnection.Instance.CommunicationState)
|
||||
{
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect:
|
||||
case PrinterConnection.CommunicationStates.AttemptingToConnect:
|
||||
this.activePrintButtons.Add(cancelConnectButton);
|
||||
EnableActiveButtons();
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Connected:
|
||||
case PrinterConnection.CommunicationStates.Connected:
|
||||
PrintLevelingData levelingData = ActiveSliceSettings.Instance.Helpers.GetPrintLevelingData();
|
||||
if (levelingData != null && ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.print_leveling_required_to_print)
|
||||
&& !levelingData.HasBeenRunAndEnabled())
|
||||
|
|
@ -295,14 +295,14 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
EnableActiveButtons();
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint:
|
||||
case PrinterConnection.CommunicationStates.PreparingToPrint:
|
||||
this.activePrintButtons.Add(cancelButton);
|
||||
EnableActiveButtons();
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.PrintingFromSd:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Printing:
|
||||
if (!PrinterConnectionAndCommunication.Instance.PrintWasCanceled)
|
||||
case PrinterConnection.CommunicationStates.PrintingFromSd:
|
||||
case PrinterConnection.CommunicationStates.Printing:
|
||||
if (!PrinterConnection.Instance.PrintWasCanceled)
|
||||
{
|
||||
this.activePrintButtons.Add(pauseButton);
|
||||
this.activePrintButtons.Add(cancelButton);
|
||||
|
|
@ -315,13 +315,13 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
EnableActiveButtons();
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Paused:
|
||||
case PrinterConnection.CommunicationStates.Paused:
|
||||
this.activePrintButtons.Add(resumeButton);
|
||||
this.activePrintButtons.Add(cancelButton);
|
||||
EnableActiveButtons();
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.FinishedPrint:
|
||||
case PrinterConnection.CommunicationStates.FinishedPrint:
|
||||
this.activePrintButtons.Add(startButton);
|
||||
EnableActiveButtons();
|
||||
break;
|
||||
|
|
@ -332,7 +332,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
}
|
||||
}
|
||||
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsConnected
|
||||
if (PrinterConnection.Instance.PrinterIsConnected
|
||||
&& ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.show_reset_connection)
|
||||
&& UserSettings.Instance.IsTouchScreen)
|
||||
{
|
||||
|
|
@ -383,7 +383,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible();
|
||||
PrinterConnection.Instance.PrintActivePartIfPossible();
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,18 +59,18 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
|
||||
AddChildElements();
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent((s, e) =>
|
||||
PrinterConnection.Instance.ActivePrintItemChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
UpdatePrintItemName();
|
||||
UpdatePrintStatus();
|
||||
}, ref unregisterEvents);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent((s, e) =>
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
UpdatePrintStatus();
|
||||
}, ref unregisterEvents);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.WroteLine.RegisterEvent((s, e) =>
|
||||
PrinterConnection.Instance.WroteLine.RegisterEvent((s, e) =>
|
||||
{
|
||||
UpdatePrintStatus();
|
||||
}, ref unregisterEvents);
|
||||
|
|
@ -168,7 +168,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
|
||||
private void OnIdle()
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
||||
if (PrinterConnection.Instance.PrinterIsPrinting)
|
||||
{
|
||||
UpdatePrintStatus();
|
||||
}
|
||||
|
|
@ -201,9 +201,9 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
|
||||
private void UpdatePrintItemName()
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.ActivePrintItem != null)
|
||||
if (PrinterConnection.Instance.ActivePrintItem != null)
|
||||
{
|
||||
this.activePrintName.Text = PrinterConnectionAndCommunication.Instance.ActivePrintItem.GetFriendlyName();
|
||||
this.activePrintName.Text = PrinterConnection.Instance.ActivePrintItem.GetFriendlyName();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -216,9 +216,9 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
string printLabel = "Next Print".Localize() + ":";
|
||||
string printerStatus = activePrintStatus.Text;
|
||||
|
||||
if (PrinterConnectionAndCommunication.Instance.ActivePrintItem != null)
|
||||
if (PrinterConnection.Instance.ActivePrintItem != null)
|
||||
{
|
||||
int totalSecondsInPrint = PrinterConnectionAndCommunication.Instance.TotalSecondsInPrint;
|
||||
int totalSecondsInPrint = PrinterConnection.Instance.TotalSecondsInPrint;
|
||||
|
||||
int totalHoursInPrint = (int)(totalSecondsInPrint / (60 * 60));
|
||||
int totalMinutesInPrint = (int)(totalSecondsInPrint / 60 - totalHoursInPrint * 60);
|
||||
|
|
@ -251,38 +251,38 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
}
|
||||
}
|
||||
|
||||
switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
|
||||
switch (PrinterConnection.Instance.CommunicationState)
|
||||
{
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint:
|
||||
case PrinterConnection.CommunicationStates.PreparingToPrint:
|
||||
printLabel = "Preparing To Print".Localize() + ":";
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Printing:
|
||||
printLabel = PrinterConnectionAndCommunication.Instance.PrintingStateString;
|
||||
case PrinterConnection.CommunicationStates.Printing:
|
||||
printLabel = PrinterConnection.Instance.PrintingStateString;
|
||||
printerStatus = totalPrintTimeText;
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Paused:
|
||||
case PrinterConnection.CommunicationStates.Paused:
|
||||
printLabel = "Printing Paused".Localize() + ":";
|
||||
printerStatus = totalPrintTimeText;
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.FinishedPrint:
|
||||
case PrinterConnection.CommunicationStates.FinishedPrint:
|
||||
printLabel = "Done Printing".Localize() + ":";
|
||||
printerStatus = totalPrintTimeText;
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Disconnected:
|
||||
case PrinterConnection.CommunicationStates.Disconnected:
|
||||
printerStatus = "Not connected. Press 'Connect' to enable printing.".Localize();
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect:
|
||||
case PrinterConnection.CommunicationStates.AttemptingToConnect:
|
||||
printerStatus = "Attempting to Connect".Localize() + "...";
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.ConnectionLost:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.FailedToConnect:
|
||||
printerStatus = "Connection Failed".Localize() + ": " + PrinterConnectionAndCommunication.Instance.ConnectionFailureMessage;
|
||||
case PrinterConnection.CommunicationStates.ConnectionLost:
|
||||
case PrinterConnection.CommunicationStates.FailedToConnect:
|
||||
printerStatus = "Connection Failed".Localize() + ": " + PrinterConnection.Instance.ConnectionFailureMessage;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -68,8 +68,8 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
};
|
||||
this.AddChild(printerSelectorAndEditOverlay);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(SetVisibleStates, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(SetVisibleStates, ref unregisterEvents);
|
||||
PrinterConnection.Instance.EnableChanged.RegisterEvent(SetVisibleStates, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(SetVisibleStates, ref unregisterEvents);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -93,8 +93,8 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
bool printerIsPrintingOrPaused = PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|
||||
|| PrinterConnectionAndCommunication.Instance.PrinterIsPaused;
|
||||
bool printerIsPrintingOrPaused = PrinterConnection.Instance.PrinterIsPrinting
|
||||
|| PrinterConnection.Instance.PrinterIsPaused;
|
||||
|
||||
editPrinterButton.Enabled = ActiveSliceSettings.Instance.PrinterSelected && !printerIsPrintingOrPaused;
|
||||
printerSelector.Enabled = !printerIsPrintingOrPaused;
|
||||
|
|
@ -125,7 +125,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
resetConnectionButton.Visible = ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.show_reset_connection);
|
||||
resetConnectionButton.Click += (s, e) =>
|
||||
{
|
||||
UiThread.RunOnIdle(PrinterConnectionAndCommunication.Instance.RebootBoard);
|
||||
UiThread.RunOnIdle(PrinterConnection.Instance.RebootBoard);
|
||||
};
|
||||
this.AddChild(resetConnectionButton);
|
||||
|
||||
|
|
@ -272,15 +272,15 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
disconnectButton.ToolTipText = "Disconnect from current printer".Localize();
|
||||
disconnectButton.Click += (s, e) => UiThread.RunOnIdle(() =>
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
||||
if (PrinterConnection.Instance.PrinterIsPrinting)
|
||||
{
|
||||
StyledMessageBox.ShowMessageBox(
|
||||
(bool disconnectCancel) =>
|
||||
{
|
||||
if (disconnectCancel)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.Stop(false);
|
||||
PrinterConnectionAndCommunication.Instance.Disable();
|
||||
PrinterConnection.Instance.Stop(false);
|
||||
PrinterConnection.Instance.Disable();
|
||||
}
|
||||
},
|
||||
disconnectAndCancelMessage,
|
||||
|
|
@ -291,7 +291,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
}
|
||||
else
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.Disable();
|
||||
PrinterConnection.Instance.Disable();
|
||||
}
|
||||
});
|
||||
this.AddChild(disconnectButton);
|
||||
|
|
@ -306,8 +306,8 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
// Bind connect button states to active printer state
|
||||
this.SetVisibleStates(null, null);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(SetVisibleStates, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(SetVisibleStates, ref unregisterEvents);
|
||||
PrinterConnection.Instance.EnableChanged.RegisterEvent(SetVisibleStates, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(SetVisibleStates, ref unregisterEvents);
|
||||
}
|
||||
|
||||
public override void OnClosed(ClosedEventArgs e)
|
||||
|
|
@ -318,15 +318,15 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
|
||||
static public void UserRequestedConnectToActivePrinter()
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.HaltConnectionThread();
|
||||
PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter(true);
|
||||
PrinterConnection.Instance.HaltConnectionThread();
|
||||
PrinterConnection.Instance.ConnectToActivePrinter(true);
|
||||
}
|
||||
|
||||
private void SetVisibleStates(object sender, EventArgs e)
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsConnected)
|
||||
if (PrinterConnection.Instance.PrinterIsConnected)
|
||||
{
|
||||
disconnectButton.Visible = true;
|
||||
connectButton.Visible = false;
|
||||
|
|
@ -337,13 +337,13 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
connectButton.Visible = true;
|
||||
}
|
||||
|
||||
var communicationState = PrinterConnectionAndCommunication.Instance.CommunicationState;
|
||||
var communicationState = PrinterConnection.Instance.CommunicationState;
|
||||
|
||||
// Ensure connect buttons are locked while long running processes are executing to prevent duplicate calls into said actions
|
||||
connectButton.Enabled = ActiveSliceSettings.Instance.PrinterSelected
|
||||
&& communicationState != PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect;
|
||||
&& communicationState != PrinterConnection.CommunicationStates.AttemptingToConnect;
|
||||
|
||||
disconnectButton.Enabled = communicationState != PrinterConnectionAndCommunication.CommunicationStates.Disconnecting;
|
||||
disconnectButton.Enabled = communicationState != PrinterConnection.CommunicationStates.Disconnecting;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -61,8 +61,8 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
else
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|
||||
|| PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
|
||||
if (PrinterConnection.Instance.PrinterIsPrinting
|
||||
|| PrinterConnection.Instance.PrinterIsPaused)
|
||||
{
|
||||
if (this.SelectedIndex != lastSelectedIndex)
|
||||
{
|
||||
|
|
@ -109,8 +109,8 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
if (AddPrinter != null)
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|
||||
|| PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
|
||||
if (PrinterConnection.Instance.PrinterIsPrinting
|
||||
|| PrinterConnection.Instance.PrinterIsPaused)
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
StyledMessageBox.ShowMessageBox(null, "Please wait until the print has finished and try again.".Localize(), "Can't add printers while printing".Localize())
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
public override void OnMouseEnterBounds(MouseEventArgs mouseEvent)
|
||||
{
|
||||
temperatureTypeName.Visible = true;
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsConnected && !PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
||||
if (PrinterConnection.Instance.PrinterIsConnected && !PrinterConnection.Instance.PrinterIsPrinting)
|
||||
{
|
||||
preheatButton.Visible = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,26 +52,26 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
ToolTipText = "Current bed temperature".Localize();
|
||||
preheatButton.ToolTipText = "Preheat the Bed".Localize();
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.BedTemperatureRead.RegisterEvent((s, e) => DisplayCurrentTemperature(), ref unregisterEvents);
|
||||
PrinterConnection.Instance.BedTemperatureRead.RegisterEvent((s, e) => DisplayCurrentTemperature(), ref unregisterEvents);
|
||||
}
|
||||
|
||||
private void DisplayCurrentTemperature()
|
||||
{
|
||||
string tempDirectionIndicator = "";
|
||||
|
||||
if (PrinterConnectionAndCommunication.Instance.TargetBedTemperature > 0)
|
||||
if (PrinterConnection.Instance.TargetBedTemperature > 0)
|
||||
{
|
||||
if ((int)(PrinterConnectionAndCommunication.Instance.TargetBedTemperature + 0.5) < (int)(PrinterConnectionAndCommunication.Instance.ActualBedTemperature + 0.5))
|
||||
if ((int)(PrinterConnection.Instance.TargetBedTemperature + 0.5) < (int)(PrinterConnection.Instance.ActualBedTemperature + 0.5))
|
||||
{
|
||||
tempDirectionIndicator = "↓";
|
||||
}
|
||||
else if ((int)(PrinterConnectionAndCommunication.Instance.TargetBedTemperature + 0.5) > (int)(PrinterConnectionAndCommunication.Instance.ActualBedTemperature + 0.5))
|
||||
else if ((int)(PrinterConnection.Instance.TargetBedTemperature + 0.5) > (int)(PrinterConnection.Instance.ActualBedTemperature + 0.5))
|
||||
{
|
||||
tempDirectionIndicator = "↑";
|
||||
}
|
||||
}
|
||||
|
||||
this.IndicatorValue = string.Format(" {0:0.#}°{1}", PrinterConnectionAndCommunication.Instance.ActualBedTemperature, tempDirectionIndicator);
|
||||
this.IndicatorValue = string.Format(" {0:0.#}°{1}", PrinterConnection.Instance.ActualBedTemperature, tempDirectionIndicator);
|
||||
}
|
||||
|
||||
protected override void SetTargetTemperature()
|
||||
|
|
@ -80,16 +80,16 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
if (targetTemp != 0)
|
||||
{
|
||||
double goalTemp = (int)(targetTemp + .5);
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|
||||
&& PrinterConnectionAndCommunication.Instance.PrintingState == PrinterConnectionAndCommunication.DetailedPrintingState.HeatingBed
|
||||
&& goalTemp != PrinterConnectionAndCommunication.Instance.TargetBedTemperature)
|
||||
if (PrinterConnection.Instance.PrinterIsPrinting
|
||||
&& PrinterConnection.Instance.PrintingState == PrinterConnection.DetailedPrintingState.HeatingBed
|
||||
&& goalTemp != PrinterConnection.Instance.TargetBedTemperature)
|
||||
{
|
||||
string message = string.Format(waitingForBedToHeatMessage, PrinterConnectionAndCommunication.Instance.TargetBedTemperature, sliceSettingsNote);
|
||||
string message = string.Format(waitingForBedToHeatMessage, PrinterConnection.Instance.TargetBedTemperature, sliceSettingsNote);
|
||||
StyledMessageBox.ShowMessageBox(null, message, waitingForBedToHeatTitle);
|
||||
}
|
||||
else
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.TargetBedTemperature = (int)(targetTemp + .5);
|
||||
PrinterConnection.Instance.TargetBedTemperature = (int)(targetTemp + .5);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -53,24 +53,24 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
ToolTipText = "Current extruder temperature".Localize();
|
||||
preheatButton.ToolTipText = "Preheat the Extruder".Localize();
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.ExtruderTemperatureRead.RegisterEvent((s, e) => DisplayCurrentTemperature(), ref unregisterEvents);
|
||||
PrinterConnection.Instance.ExtruderTemperatureRead.RegisterEvent((s, e) => DisplayCurrentTemperature(), ref unregisterEvents);
|
||||
}
|
||||
|
||||
private void DisplayCurrentTemperature()
|
||||
{
|
||||
string tempDirectionIndicator = "";
|
||||
if (PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderIndex) > 0)
|
||||
if (PrinterConnection.Instance.GetTargetExtruderTemperature(extruderIndex) > 0)
|
||||
{
|
||||
if ((int)(PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderIndex) + 0.5) < (int)(PrinterConnectionAndCommunication.Instance.GetActualExtruderTemperature(extruderIndex) + 0.5))
|
||||
if ((int)(PrinterConnection.Instance.GetTargetExtruderTemperature(extruderIndex) + 0.5) < (int)(PrinterConnection.Instance.GetActualExtruderTemperature(extruderIndex) + 0.5))
|
||||
{
|
||||
tempDirectionIndicator = "↓";
|
||||
}
|
||||
else if ((int)(PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderIndex) + 0.5) > (int)(PrinterConnectionAndCommunication.Instance.GetActualExtruderTemperature(extruderIndex) + 0.5))
|
||||
else if ((int)(PrinterConnection.Instance.GetTargetExtruderTemperature(extruderIndex) + 0.5) > (int)(PrinterConnection.Instance.GetActualExtruderTemperature(extruderIndex) + 0.5))
|
||||
{
|
||||
tempDirectionIndicator = "↑";
|
||||
}
|
||||
}
|
||||
this.IndicatorValue = string.Format(" {0:0.#}°{1}", PrinterConnectionAndCommunication.Instance.GetActualExtruderTemperature(extruderIndex), tempDirectionIndicator);
|
||||
this.IndicatorValue = string.Format(" {0:0.#}°{1}", PrinterConnection.Instance.GetActualExtruderTemperature(extruderIndex), tempDirectionIndicator);
|
||||
}
|
||||
|
||||
protected override void SetTargetTemperature()
|
||||
|
|
@ -79,16 +79,16 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
if (double.TryParse(ActiveSliceSettings.Instance.GetValue(SettingsKey.temperature), out targetTemp))
|
||||
{
|
||||
double goalTemp = (int)(targetTemp + .5);
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|
||||
&& PrinterConnectionAndCommunication.Instance.PrintingState == PrinterConnectionAndCommunication.DetailedPrintingState.HeatingExtruder
|
||||
&& goalTemp != PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderIndex))
|
||||
if (PrinterConnection.Instance.PrinterIsPrinting
|
||||
&& PrinterConnection.Instance.PrintingState == PrinterConnection.DetailedPrintingState.HeatingExtruder
|
||||
&& goalTemp != PrinterConnection.Instance.GetTargetExtruderTemperature(extruderIndex))
|
||||
{
|
||||
string message = string.Format(waitingForExtruderToHeatMessage, PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderIndex), sliceSettingsNote);
|
||||
string message = string.Format(waitingForExtruderToHeatMessage, PrinterConnection.Instance.GetTargetExtruderTemperature(extruderIndex), sliceSettingsNote);
|
||||
StyledMessageBox.ShowMessageBox(null, message, "Waiting For Extruder To Heat".Localize());
|
||||
}
|
||||
else
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.SetTargetExtruderTemperature(extruderIndex, (int)(targetTemp + .5));
|
||||
PrinterConnection.Instance.SetTargetExtruderTemperature(extruderIndex, (int)(targetTemp + .5));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,23 +64,23 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
|
||||
AddChildElements();
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent((s, e) =>
|
||||
PrinterConnection.Instance.ActivePrintItemChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
UpdatePrintItemName();
|
||||
UpdatePrintStatus();
|
||||
}, ref unregisterEvents);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent((s, e) =>
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
UpdatePrintStatus();
|
||||
}, ref unregisterEvents);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.WroteLine.RegisterEvent((s, e) =>
|
||||
PrinterConnection.Instance.WroteLine.RegisterEvent((s, e) =>
|
||||
{
|
||||
UpdatePrintStatus();
|
||||
}, ref unregisterEvents);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents);
|
||||
|
||||
onActivePrintItemChanged(null, null);
|
||||
}
|
||||
|
|
@ -245,7 +245,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
activePrintPreviewImage.ItemWrapper.SlicingOutputMessage -= PrintItem_SlicingOutputMessage;
|
||||
}
|
||||
|
||||
activePrintPreviewImage.ItemWrapper = PrinterConnectionAndCommunication.Instance.ActivePrintItem;
|
||||
activePrintPreviewImage.ItemWrapper = PrinterConnection.Instance.ActivePrintItem;
|
||||
|
||||
// then hook up our new part
|
||||
if (activePrintPreviewImage.ItemWrapper != null)
|
||||
|
|
@ -258,7 +258,7 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
|
||||
private void OnIdle()
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
||||
if (PrinterConnection.Instance.PrinterIsPrinting)
|
||||
{
|
||||
UpdatePrintStatus();
|
||||
}
|
||||
|
|
@ -291,9 +291,9 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
|
||||
private void UpdatePrintItemName()
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.ActivePrintItem != null)
|
||||
if (PrinterConnection.Instance.ActivePrintItem != null)
|
||||
{
|
||||
this.activePrintName.Text = PrinterConnectionAndCommunication.Instance.ActivePrintItem.GetFriendlyName();
|
||||
this.activePrintName.Text = PrinterConnection.Instance.ActivePrintItem.GetFriendlyName();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -303,9 +303,9 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
|
||||
private void UpdatePrintStatus()
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.ActivePrintItem != null)
|
||||
if (PrinterConnection.Instance.ActivePrintItem != null)
|
||||
{
|
||||
int totalSecondsInPrint = PrinterConnectionAndCommunication.Instance.TotalSecondsInPrint;
|
||||
int totalSecondsInPrint = PrinterConnection.Instance.TotalSecondsInPrint;
|
||||
|
||||
int totalHoursInPrint = (int)(totalSecondsInPrint / (60 * 60));
|
||||
int totalMinutesInPrint = (int)(totalSecondsInPrint / 60 - totalHoursInPrint * 60);
|
||||
|
|
@ -340,38 +340,38 @@ namespace MatterHackers.MatterControl.ActionBar
|
|||
|
||||
activePrintLabel.Text = "Next Print".Localize() + ":";
|
||||
|
||||
switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
|
||||
switch (PrinterConnection.Instance.CommunicationState)
|
||||
{
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint:
|
||||
case PrinterConnection.CommunicationStates.PreparingToPrint:
|
||||
activePrintLabel.Text = "Preparing To Print".Localize() + ":";
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Printing:
|
||||
activePrintLabel.Text = PrinterConnectionAndCommunication.Instance.PrintingStateString;
|
||||
case PrinterConnection.CommunicationStates.Printing:
|
||||
activePrintLabel.Text = PrinterConnection.Instance.PrintingStateString;
|
||||
activePrintStatus.Text = totalPrintTimeText;
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Paused:
|
||||
case PrinterConnection.CommunicationStates.Paused:
|
||||
activePrintLabel.Text = "Printing Paused".Localize() + ":";
|
||||
activePrintStatus.Text = totalPrintTimeText;
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.FinishedPrint:
|
||||
case PrinterConnection.CommunicationStates.FinishedPrint:
|
||||
activePrintLabel.Text = "Done Printing".Localize() + ":";
|
||||
activePrintStatus.Text = totalPrintTimeText;
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Disconnected:
|
||||
case PrinterConnection.CommunicationStates.Disconnected:
|
||||
activePrintStatus.Text = "Not connected. Press 'Connect' to enable printing.".Localize();
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect:
|
||||
case PrinterConnection.CommunicationStates.AttemptingToConnect:
|
||||
activePrintStatus.Text = "Attempting to Connect".Localize() + "...";
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.ConnectionLost:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.FailedToConnect:
|
||||
activePrintStatus.Text = "Connection Failed".Localize() + ": " + PrinterConnectionAndCommunication.Instance.ConnectionFailureMessage;
|
||||
case PrinterConnection.CommunicationStates.ConnectionLost:
|
||||
case PrinterConnection.CommunicationStates.FailedToConnect:
|
||||
activePrintStatus.Text = "Connection Failed".Localize() + ": " + PrinterConnection.Instance.ConnectionFailureMessage;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
string mcxPath = Path.Combine(platingDirectory, now + ".mcx");
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.ActivePrintItem = new PrintItemWrapper(new PrintItem(now, mcxPath));
|
||||
PrinterConnection.Instance.ActivePrintItem = new PrintItemWrapper(new PrintItem(now, mcxPath));
|
||||
|
||||
File.WriteAllText(mcxPath, new Object3D().ToJson());
|
||||
}
|
||||
|
|
@ -468,7 +468,7 @@ namespace MatterHackers.MatterControl
|
|||
() => new SDCardContainer(),
|
||||
() =>
|
||||
{
|
||||
var printer = PrinterConnectionAndCommunication.Instance;
|
||||
var printer = PrinterConnection.Instance;
|
||||
|
||||
return ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.has_sd_card_reader)
|
||||
&& printer.PrinterIsConnected
|
||||
|
|
@ -499,11 +499,11 @@ namespace MatterHackers.MatterControl
|
|||
thumbGenResetEvent?.Set();
|
||||
};
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent((s, e) =>
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
|
||||
switch (PrinterConnection.Instance.CommunicationState)
|
||||
{
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Printing:
|
||||
case PrinterConnection.CommunicationStates.Printing:
|
||||
if (UserSettings.Instance.IsTouchScreen)
|
||||
{
|
||||
UiThread.RunOnIdle(PrintingWindow.Show);
|
||||
|
|
@ -520,8 +520,8 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public void StartSignIn()
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|
||||
|| PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
|
||||
if (PrinterConnection.Instance.PrinterIsPrinting
|
||||
|| PrinterConnection.Instance.PrinterIsPaused)
|
||||
{
|
||||
// can't sign in while printing
|
||||
UiThread.RunOnIdle(() =>
|
||||
|
|
@ -636,8 +636,8 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public void StartSignOut()
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|
||||
|| PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
|
||||
if (PrinterConnection.Instance.PrinterIsPrinting
|
||||
|| PrinterConnection.Instance.PrinterIsPaused)
|
||||
{
|
||||
// can't log out while printing
|
||||
UiThread.RunOnIdle(() =>
|
||||
|
|
@ -907,7 +907,7 @@ namespace MatterHackers.MatterControl
|
|||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
//PrinterConnectionAndCommunication.Instance.HaltConnectionThread();
|
||||
PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter();
|
||||
PrinterConnection.Instance.ConnectToActivePrinter();
|
||||
}, 2);
|
||||
}
|
||||
}
|
||||
|
|
@ -927,13 +927,13 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
QueueData.Instance.RemoveAll();
|
||||
QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem("LaunchTestPrint", @"/storage/sdcard0/Download/LaunchTestPrint.stl")));
|
||||
PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter();
|
||||
PrinterConnection.Instance.ConnectToActivePrinter();
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent((sender, e) =>
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent((sender, e) =>
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.Connected)
|
||||
if (PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Connected)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible();
|
||||
PrinterConnection.Instance.PrintActivePartIfPossible();
|
||||
}
|
||||
}, ref unregisterEvent);
|
||||
}
|
||||
|
|
@ -1021,14 +1021,14 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
bool canceled = false;
|
||||
|
||||
if (PrinterConnectionAndCommunication.Instance.SecondsPrinted > 120)
|
||||
if (PrinterConnection.Instance.SecondsPrinted > 120)
|
||||
{
|
||||
StyledMessageBox.ShowMessageBox(
|
||||
(bool response) =>
|
||||
{
|
||||
if (response)
|
||||
{
|
||||
UiThread.RunOnIdle(() => PrinterConnectionAndCommunication.Instance.Stop());
|
||||
UiThread.RunOnIdle(() => PrinterConnection.Instance.Stop());
|
||||
canceled = true;
|
||||
}
|
||||
|
||||
|
|
@ -1042,7 +1042,7 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
else
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.Stop();
|
||||
PrinterConnection.Instance.Stop();
|
||||
canceled = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
Name = "Actions Menu";
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent((s,e) => SetEnabledState(), ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent((s,e) => SetEnabledState(), ref unregisterEvents);
|
||||
}
|
||||
|
||||
public override void OnLoad(EventArgs args)
|
||||
|
|
@ -64,8 +64,8 @@ namespace MatterHackers.MatterControl
|
|||
for(int i=0; i<MenuDropList.MenuItems.Count; i++)
|
||||
{
|
||||
MenuDropList.MenuItems[i].Enabled = ActiveSliceSettings.Instance.PrinterSelected
|
||||
&& PrinterConnectionAndCommunication.Instance.PrinterIsConnected
|
||||
&& !PrinterConnectionAndCommunication.Instance.PrinterIsPrinting;
|
||||
&& PrinterConnection.Instance.PrinterIsConnected
|
||||
&& !PrinterConnection.Instance.PrinterIsPrinting;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -72,8 +72,8 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private void AddPrinter_Click()
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|
||||
|| PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
|
||||
if (PrinterConnection.Instance.PrinterIsPrinting
|
||||
|| PrinterConnection.Instance.PrinterIsPaused)
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
StyledMessageBox.ShowMessageBox(null, "Please wait until the print has finished and try again.".Localize(), "Can't add printers while printing".Localize())
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ namespace MatterHackers.MatterControl
|
|||
"Preview".Localize().ToUpper(),
|
||||
generator: () =>
|
||||
{
|
||||
partPreviewContainer = new PartPreviewContent(PrinterConnectionAndCommunication.Instance.ActivePrintItem, View3DWidget.WindowMode.Embeded, View3DWidget.AutoRotate.Enabled, View3DWidget.OpenMode.Viewing);
|
||||
partPreviewContainer = new PartPreviewContent(PrinterConnection.Instance.ActivePrintItem, View3DWidget.WindowMode.Embeded, View3DWidget.AutoRotate.Enabled, View3DWidget.OpenMode.Viewing);
|
||||
return partPreviewContainer;
|
||||
});
|
||||
|
||||
|
|
@ -178,12 +178,12 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
SetUpdateNotification(this, null);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent((s, e) =>
|
||||
PrinterConnection.Instance.ActivePrintItemChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
// ReloadPartPreview
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
partPreviewContainer?.Reload(PrinterConnectionAndCommunication.Instance.ActivePrintItem);
|
||||
partPreviewContainer?.Reload(PrinterConnection.Instance.ActivePrintItem);
|
||||
}, 1);
|
||||
|
||||
}, ref unregisterEvents);
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ namespace MatterHackers.MatterControl
|
|||
this.Name = "WidescreenPanel";
|
||||
|
||||
// HACK: Long term we need a better solution which does not rely on ActivePrintItem/PrintItemWrapper
|
||||
if (PrinterConnectionAndCommunication.Instance.ActivePrintItem == null)
|
||||
if (PrinterConnection.Instance.ActivePrintItem == null)
|
||||
{
|
||||
ApplicationController.Instance.ClearPlate();
|
||||
}
|
||||
|
|
@ -75,7 +75,7 @@ namespace MatterHackers.MatterControl
|
|||
});
|
||||
|
||||
// put in the right column
|
||||
library3DViewSplitter.Panel2.AddChild(new PartPreviewContent(PrinterConnectionAndCommunication.Instance.ActivePrintItem, View3DWidget.WindowMode.Embeded, View3DWidget.AutoRotate.Disabled)
|
||||
library3DViewSplitter.Panel2.AddChild(new PartPreviewContent(PrinterConnection.Instance.ActivePrintItem, View3DWidget.WindowMode.Embeded, View3DWidget.AutoRotate.Disabled)
|
||||
{
|
||||
VAnchor = VAnchor.ParentBottom | VAnchor.ParentTop,
|
||||
HAnchor = HAnchor.ParentLeft | HAnchor.ParentRight
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
displayControlRestartButton.Margin = new BorderDouble(right: 6);
|
||||
displayControlRestartButton.Click += (sender, e) =>
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
||||
if (PrinterConnection.Instance.PrinterIsPrinting)
|
||||
{
|
||||
StyledMessageBox.ShowMessageBox(null, cannotRestartWhilePrintIsActiveMessage, cannotRestartWhileActive);
|
||||
}
|
||||
|
|
@ -435,7 +435,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
|
||||
languageRestartButton.Click += (sender, e) =>
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
||||
if (PrinterConnection.Instance.PrinterIsPrinting)
|
||||
{
|
||||
StyledMessageBox.ShowMessageBox(null, cannotRestartWhilePrintIsActiveMessage, cannotRestartWhileActive);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
|
||||
AddChild(mainContainer);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(PrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(PrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(PrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.EnableChanged.RegisterEvent(PrinterStatusChanged, ref unregisterEvents);
|
||||
|
||||
SetVisibleControls();
|
||||
}
|
||||
|
|
@ -151,8 +151,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
private void SetVisibleControls()
|
||||
{
|
||||
if (!ActiveSliceSettings.Instance.PrinterSelected
|
||||
|| PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.Printing
|
||||
|| PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
|
||||
|| PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Printing
|
||||
|| PrinterConnection.Instance.PrinterIsPaused)
|
||||
{
|
||||
printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
runPrintLevelingButton.Enabled = true; // setting this true when the element is disabled makes the colors stay correct
|
||||
|
|
@ -160,7 +160,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
else
|
||||
{
|
||||
printLevelingContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
runPrintLevelingButton.Enabled = PrinterConnectionAndCommunication.Instance.PrinterIsConnected;
|
||||
runPrintLevelingButton.Enabled = PrinterConnection.Instance.PrinterIsConnected;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -187,8 +187,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
|
||||
private void AddHandlers()
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
}
|
||||
|
||||
private void onPrinterStatusChanged(object sender, EventArgs e)
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
this.BedCenter = bedCenter;
|
||||
this.NumberOfRadialSamples = numberOfRadialSamples;
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.PositionRead.RegisterEvent(PrinterReportedPosition, ref unregisterEvents);
|
||||
PrinterConnection.Instance.PositionRead.RegisterEvent(PrinterReportedPosition, ref unregisterEvents);
|
||||
}
|
||||
|
||||
public Vector2 BedCenter
|
||||
|
|
@ -291,7 +291,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
|
||||
private void PrinterReportedPosition(object sender, EventArgs e)
|
||||
{
|
||||
lastDestinationWithLevelingApplied = GetPositionWithZOffset(PrinterConnectionAndCommunication.Instance.LastReportedPosition);
|
||||
lastDestinationWithLevelingApplied = GetPositionWithZOffset(PrinterConnection.Instance.LastReportedPosition);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -181,7 +181,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
// make sure the servo is retracted
|
||||
var servoRetract = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.z_servo_retracted_angle);
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow($"M280 S{servoRetract}");
|
||||
PrinterConnection.Instance.SendLineToPrinterNow($"M280 S{servoRetract}");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,7 +237,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
this.SampledPositions = new List<Vector3>(levelingData.SampledPositions);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.PositionRead.RegisterEvent(PrinterReportedPosition, ref unregisterEvents);
|
||||
PrinterConnection.Instance.PositionRead.RegisterEvent(PrinterReportedPosition, ref unregisterEvents);
|
||||
|
||||
for (int y = 0; y < gridHeight - 1; y++)
|
||||
{
|
||||
|
|
@ -385,7 +385,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
|
||||
private void PrinterReportedPosition(object sender, EventArgs e)
|
||||
{
|
||||
lastDestinationWithLevelingApplied = GetPositionWithZOffset(PrinterConnectionAndCommunication.Instance.LastReportedPosition);
|
||||
lastDestinationWithLevelingApplied = GetPositionWithZOffset(PrinterConnection.Instance.LastReportedPosition);
|
||||
}
|
||||
|
||||
public class Region
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
|
||||
if (ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.z_homes_to_max))
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.XYZ);
|
||||
PrinterConnection.Instance.HomeAxis(PrinterConnection.Axis.XYZ);
|
||||
}
|
||||
|
||||
container.backButton.Enabled = false;
|
||||
|
|
@ -112,14 +112,14 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
public override void PageIsBecomingActive()
|
||||
{
|
||||
// first make sure there is no leftover FinishedProbe event
|
||||
PrinterConnectionAndCommunication.Instance.ReadLine.UnregisterEvent(FinishedProbe, ref unregisterEvents);
|
||||
PrinterConnection.Instance.ReadLine.UnregisterEvent(FinishedProbe, ref unregisterEvents);
|
||||
|
||||
var feedRates = ActiveSliceSettings.Instance.Helpers.ManualMovementSpeeds();
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.MoveAbsolute(PrinterConnectionAndCommunication.Axis.Z, probeStartPosition.z, feedRates.z);
|
||||
PrinterConnectionAndCommunication.Instance.MoveAbsolute(probeStartPosition, feedRates.x);
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G30");
|
||||
PrinterConnectionAndCommunication.Instance.ReadLine.RegisterEvent(FinishedProbe, ref unregisterEvents);
|
||||
PrinterConnection.Instance.MoveAbsolute(PrinterConnection.Axis.Z, probeStartPosition.z, feedRates.z);
|
||||
PrinterConnection.Instance.MoveAbsolute(probeStartPosition, feedRates.x);
|
||||
PrinterConnection.Instance.SendLineToPrinterNow("G30");
|
||||
PrinterConnection.Instance.ReadLine.RegisterEvent(FinishedProbe, ref unregisterEvents);
|
||||
|
||||
base.PageIsBecomingActive();
|
||||
|
||||
|
|
@ -134,12 +134,12 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
if (currentEvent.Data.Contains("endstops hit"))
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.ReadLine.UnregisterEvent(FinishedProbe, ref unregisterEvents);
|
||||
PrinterConnection.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));
|
||||
PrinterConnectionAndCommunication.Instance.MoveAbsolute(probeStartPosition, ActiveSliceSettings.Instance.Helpers.ManualMovementSpeeds().z);
|
||||
PrinterConnectionAndCommunication.Instance.ReadPosition();
|
||||
PrinterConnection.Instance.MoveAbsolute(probeStartPosition, ActiveSliceSettings.Instance.Helpers.ManualMovementSpeeds().z);
|
||||
PrinterConnection.Instance.ReadPosition();
|
||||
|
||||
container.nextButton.ClickButton(new MouseEventArgs(MouseButtons.Left, 1, 0, 0, 0));
|
||||
}
|
||||
|
|
@ -156,7 +156,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
|
||||
public override void PageIsBecomingActive()
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.XYZ);
|
||||
PrinterConnection.Instance.HomeAxis(PrinterConnection.Axis.XYZ);
|
||||
base.PageIsBecomingActive();
|
||||
}
|
||||
}
|
||||
|
|
@ -180,7 +180,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
this.allowLessThan0 = allowLessThan0;
|
||||
this.probePositions = probePositions;
|
||||
this.moveAmount = moveDistance;
|
||||
this.lastReportedPosition = PrinterConnectionAndCommunication.Instance.LastReportedPosition;
|
||||
this.lastReportedPosition = PrinterConnection.Instance.LastReportedPosition;
|
||||
this.probePositionsBeingEditedIndex = probePositionsBeingEditedIndex;
|
||||
|
||||
GuiWidget spacer = new GuiWidget(15, 15);
|
||||
|
|
@ -225,7 +225,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
public override void PageIsBecomingInactive()
|
||||
{
|
||||
this.Parents<SystemWindow>().First().KeyDown -= TopWindowKeyDown;
|
||||
probePositions[probePositionsBeingEditedIndex].position = PrinterConnectionAndCommunication.Instance.LastReportedPosition;
|
||||
probePositions[probePositionsBeingEditedIndex].position = PrinterConnection.Instance.LastReportedPosition;
|
||||
base.PageIsBecomingInactive();
|
||||
}
|
||||
|
||||
|
|
@ -278,7 +278,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
private void zMinusControl_Click(object sender, EventArgs mouseEvent)
|
||||
{
|
||||
if (!allowLessThan0
|
||||
&& PrinterConnectionAndCommunication.Instance.LastReportedPosition.z - moveAmount < 0)
|
||||
&& PrinterConnection.Instance.LastReportedPosition.z - moveAmount < 0)
|
||||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
|
|
@ -288,14 +288,14 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
return;
|
||||
}
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, -moveAmount, ActiveSliceSettings.Instance.Helpers.ManualMovementSpeeds().z);
|
||||
PrinterConnectionAndCommunication.Instance.ReadPosition();
|
||||
PrinterConnection.Instance.MoveRelative(PrinterConnection.Axis.Z, -moveAmount, ActiveSliceSettings.Instance.Helpers.ManualMovementSpeeds().z);
|
||||
PrinterConnection.Instance.ReadPosition();
|
||||
}
|
||||
|
||||
private void zPlusControl_Click(object sender, EventArgs mouseEvent)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmount, ActiveSliceSettings.Instance.Helpers.ManualMovementSpeeds().z);
|
||||
PrinterConnectionAndCommunication.Instance.ReadPosition();
|
||||
PrinterConnection.Instance.MoveRelative(PrinterConnection.Axis.Z, moveAmount, ActiveSliceSettings.Instance.Helpers.ManualMovementSpeeds().z);
|
||||
PrinterConnection.Instance.ReadPosition();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -319,7 +319,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
this.allowLessThan0 = allowLessThan0;
|
||||
this.probePositions = probePositions;
|
||||
|
||||
this.lastReportedPosition = PrinterConnectionAndCommunication.Instance.LastReportedPosition;
|
||||
this.lastReportedPosition = PrinterConnection.Instance.LastReportedPosition;
|
||||
this.probePositionsBeingEditedIndex = probePositionsBeingEditedIndex;
|
||||
|
||||
GuiWidget spacer = new GuiWidget(15, 15);
|
||||
|
|
@ -396,7 +396,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
// make sure the servo is deployed
|
||||
var servoDeploy = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.z_servo_depolyed_angle);
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow($"M280 S{servoDeploy}");
|
||||
PrinterConnection.Instance.SendLineToPrinterNow($"M280 S{servoDeploy}");
|
||||
}
|
||||
|
||||
var feedRates = ActiveSliceSettings.Instance.Helpers.ManualMovementSpeeds();
|
||||
|
|
@ -406,29 +406,29 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
var probeOffset = ActiveSliceSettings.Instance.GetValue<Vector2>(SettingsKey.z_probe_xy_offset);
|
||||
adjustedProbePosition -= new Vector3(probeOffset);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.MoveAbsolute(PrinterConnectionAndCommunication.Axis.Z, probeStartPosition.z, feedRates.z);
|
||||
PrinterConnectionAndCommunication.Instance.MoveAbsolute(adjustedProbePosition, feedRates.x);
|
||||
PrinterConnection.Instance.MoveAbsolute(PrinterConnection.Axis.Z, probeStartPosition.z, feedRates.z);
|
||||
PrinterConnection.Instance.MoveAbsolute(adjustedProbePosition, feedRates.x);
|
||||
|
||||
int numberOfSamples = ActiveSliceSettings.Instance.GetValue<int>(SettingsKey.z_probe_samples);
|
||||
for (int i = 0; i < numberOfSamples; i++)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("G30"); // probe the current position
|
||||
PrinterConnection.Instance.SendLineToPrinterNow("G30"); // probe the current position
|
||||
}
|
||||
|
||||
container.backButton.Enabled = false;
|
||||
container.nextButton.Enabled = false;
|
||||
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsConnected
|
||||
&& !(PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|
||||
|| PrinterConnectionAndCommunication.Instance.PrinterIsPaused))
|
||||
if (PrinterConnection.Instance.PrinterIsConnected
|
||||
&& !(PrinterConnection.Instance.PrinterIsPrinting
|
||||
|| PrinterConnection.Instance.PrinterIsPaused))
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.ReadLine.RegisterEvent(GetZProbeHeight, ref unregisterEvents);
|
||||
PrinterConnection.Instance.ReadLine.RegisterEvent(GetZProbeHeight, ref unregisterEvents);
|
||||
}
|
||||
}
|
||||
|
||||
public override void PageIsBecomingInactive()
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.ReadLine.UnregisterEvent(GetZProbeHeight, ref unregisterEvents);
|
||||
PrinterConnection.Instance.ReadLine.UnregisterEvent(GetZProbeHeight, ref unregisterEvents);
|
||||
base.PageIsBecomingInactive();
|
||||
}
|
||||
}
|
||||
|
|
@ -458,9 +458,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
|
||||
var feedRates = ActiveSliceSettings.Instance.Helpers.ManualMovementSpeeds();
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.MoveAbsolute(PrinterConnectionAndCommunication.Axis.Z, probeStartPosition.z, feedRates.z);
|
||||
PrinterConnectionAndCommunication.Instance.MoveAbsolute(probeStartPosition, feedRates.x);
|
||||
PrinterConnectionAndCommunication.Instance.ReadPosition();
|
||||
PrinterConnection.Instance.MoveAbsolute(PrinterConnection.Axis.Z, probeStartPosition.z, feedRates.z);
|
||||
PrinterConnection.Instance.MoveAbsolute(probeStartPosition, feedRates.x);
|
||||
PrinterConnection.Instance.ReadPosition();
|
||||
|
||||
container.backButton.Enabled = false;
|
||||
container.nextButton.Enabled = false;
|
||||
|
|
@ -521,7 +521,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
if (haveDrawn)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, 2, ActiveSliceSettings.Instance.Helpers.ManualMovementSpeeds().z);
|
||||
PrinterConnection.Instance.MoveRelative(PrinterConnection.Axis.Z, 2, ActiveSliceSettings.Instance.Helpers.ManualMovementSpeeds().z);
|
||||
}
|
||||
base.PageIsBecomingInactive();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -239,8 +239,8 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private void AddHandlers()
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
}
|
||||
|
||||
private void onPrinterStatusChanged(object sender, EventArgs e)
|
||||
|
|
|
|||
|
|
@ -100,8 +100,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
|
||||
private void AddHandlers()
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent((e, s) => SetEnabledStates(), ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent((e,s) => SetEnabledStates(), ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent((e, s) => SetEnabledStates(), ref unregisterEvents);
|
||||
PrinterConnection.Instance.EnableChanged.RegisterEvent((e,s) => SetEnabledStates(), ref unregisterEvents);
|
||||
}
|
||||
|
||||
private void openCameraPreview_Click(object sender, EventArgs e)
|
||||
|
|
@ -118,30 +118,30 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
else // we at least have a printer selected
|
||||
{
|
||||
//cloudMonitorContainer.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
|
||||
switch (PrinterConnection.Instance.CommunicationState)
|
||||
{
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Disconnecting:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.ConnectionLost:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Disconnected:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.FailedToConnect:
|
||||
case PrinterConnection.CommunicationStates.Disconnecting:
|
||||
case PrinterConnection.CommunicationStates.ConnectionLost:
|
||||
case PrinterConnection.CommunicationStates.Disconnected:
|
||||
case PrinterConnection.CommunicationStates.AttemptingToConnect:
|
||||
case PrinterConnection.CommunicationStates.FailedToConnect:
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.FinishedPrint:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Connected:
|
||||
case PrinterConnection.CommunicationStates.FinishedPrint:
|
||||
case PrinterConnection.CommunicationStates.Connected:
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.PrintingFromSd:
|
||||
case PrinterConnection.CommunicationStates.PrintingFromSd:
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Printing:
|
||||
switch (PrinterConnectionAndCommunication.Instance.PrintingState)
|
||||
case PrinterConnection.CommunicationStates.PreparingToPrint:
|
||||
case PrinterConnection.CommunicationStates.Printing:
|
||||
switch (PrinterConnection.Instance.PrintingState)
|
||||
{
|
||||
case PrinterConnectionAndCommunication.DetailedPrintingState.HomingAxis:
|
||||
case PrinterConnectionAndCommunication.DetailedPrintingState.HeatingBed:
|
||||
case PrinterConnectionAndCommunication.DetailedPrintingState.HeatingExtruder:
|
||||
case PrinterConnectionAndCommunication.DetailedPrintingState.Printing:
|
||||
case PrinterConnection.DetailedPrintingState.HomingAxis:
|
||||
case PrinterConnection.DetailedPrintingState.HeatingBed:
|
||||
case PrinterConnection.DetailedPrintingState.HeatingExtruder:
|
||||
case PrinterConnection.DetailedPrintingState.Printing:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -149,7 +149,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage
|
|||
}
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Paused:
|
||||
case PrinterConnection.CommunicationStates.Paused:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
|
||||
cancelButton.Click += (s, e) =>
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.MacroCancel();
|
||||
PrinterConnection.Instance.MacroCancel();
|
||||
};
|
||||
|
||||
if (macroData.showMaterialSelector)
|
||||
|
|
@ -69,7 +69,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
contentRow.AddChild(materialSelector);
|
||||
}
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.WroteLine.RegisterEvent(LookForTempRequest, ref unregisterEvents);
|
||||
PrinterConnection.Instance.WroteLine.RegisterEvent(LookForTempRequest, ref unregisterEvents);
|
||||
|
||||
if (macroData.waitOk | macroData.expireTime > 0)
|
||||
{
|
||||
|
|
@ -77,7 +77,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
|
||||
okButton.Click += (s, e) =>
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.MacroContinue();
|
||||
PrinterConnection.Instance.MacroContinue();
|
||||
UiThread.RunOnIdle(() => WizardWindow?.Close());
|
||||
};
|
||||
|
||||
|
|
@ -146,7 +146,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
{
|
||||
if(e.OsEvent)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.MacroCancel();
|
||||
PrinterConnection.Instance.MacroCancel();
|
||||
}
|
||||
unregisterEvents?.Invoke(this, null);
|
||||
|
||||
|
|
@ -173,7 +173,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
if(stringEvent != null
|
||||
&& stringEvent.Data.Contains("M104"))
|
||||
{
|
||||
startingTemp = PrinterConnectionAndCommunication.Instance.GetActualExtruderTemperature(0);
|
||||
startingTemp = PrinterConnection.Instance.GetActualExtruderTemperature(0);
|
||||
UiThread.RunOnIdle(ShowTempChangeProgress);
|
||||
}
|
||||
}
|
||||
|
|
@ -181,8 +181,8 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
private void ShowTempChangeProgress()
|
||||
{
|
||||
progressBar.Visible = true;
|
||||
double targetTemp = PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(0);
|
||||
double actualTemp = PrinterConnectionAndCommunication.Instance.GetActualExtruderTemperature(0);
|
||||
double targetTemp = PrinterConnection.Instance.GetTargetExtruderTemperature(0);
|
||||
double actualTemp = PrinterConnection.Instance.GetActualExtruderTemperature(0);
|
||||
double totalDelta = targetTemp - startingTemp;
|
||||
double currentDelta = actualTemp - startingTemp;
|
||||
double ratioDone = totalDelta != 0 ? (currentDelta / totalDelta) : 1;
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public static void OpenEditPrinterWizard(string widgetNameToHighlight)
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance?.ActivePrinter?.ID != null
|
||||
if (PrinterConnection.Instance?.ActivePrinter?.ID != null
|
||||
&& ActiveSliceSettings.Instance.PrinterSelected
|
||||
&& !WizardWindow.IsOpen("PrinterSetup"))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -131,8 +131,8 @@ namespace MatterHackers.MatterControl
|
|||
};
|
||||
AddChild(clickOverlay);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.ActivePrintItemChanged.RegisterEvent(Instance_PrintItemChanged, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(Instance_PrintItemChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.ActivePrintItemChanged.RegisterEvent(Instance_PrintItemChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(Instance_PrintItemChanged, ref unregisterEvents);
|
||||
|
||||
SetThemedColors();
|
||||
|
||||
|
|
@ -171,7 +171,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private void OnIdle()
|
||||
{
|
||||
currentPercent = PrinterConnectionAndCommunication.Instance.PercentComplete;
|
||||
currentPercent = PrinterConnection.Instance.PercentComplete;
|
||||
UpdatePrintStatus();
|
||||
|
||||
if (!HasBeenClosed)
|
||||
|
|
@ -182,14 +182,14 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private void UpdatePrintStatus()
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.ActivePrintItem == null)
|
||||
if (PrinterConnection.Instance.ActivePrintItem == null)
|
||||
{
|
||||
printTimeElapsed.Text = string.Format("");
|
||||
printTimeRemaining.Text = string.Format("");
|
||||
}
|
||||
else
|
||||
{
|
||||
int secondsPrinted = PrinterConnectionAndCommunication.Instance.SecondsPrinted;
|
||||
int secondsPrinted = PrinterConnection.Instance.SecondsPrinted;
|
||||
int hoursPrinted = (int)(secondsPrinted / (60 * 60));
|
||||
int minutesPrinted = (int)(secondsPrinted / 60 - hoursPrinted * 60);
|
||||
secondsPrinted = secondsPrinted % 60;
|
||||
|
|
@ -217,11 +217,11 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
string printPercentRemainingText = string.Format("{0:0.0}%", currentPercent);
|
||||
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting || PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
|
||||
if (PrinterConnection.Instance.PrinterIsPrinting || PrinterConnection.Instance.PrinterIsPaused)
|
||||
{
|
||||
printTimeRemaining.Text = printPercentRemainingText;
|
||||
}
|
||||
else if (PrinterConnectionAndCommunication.Instance.PrintIsFinished)
|
||||
else if (PrinterConnection.Instance.PrintIsFinished)
|
||||
{
|
||||
printTimeRemaining.Text = "Done!";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,7 +55,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
public BedStatusWidget(bool smallScreen)
|
||||
: base(smallScreen ? "Bed".Localize() : "Bed Temperature".Localize())
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.BedTemperatureRead.RegisterEvent((s, e) =>
|
||||
PrinterConnection.Instance.BedTemperatureRead.RegisterEvent((s, e) =>
|
||||
{
|
||||
UpdateTemperatures();
|
||||
}, ref unregisterEvents);
|
||||
|
|
@ -63,8 +63,8 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
|
||||
public override void UpdateTemperatures()
|
||||
{
|
||||
double targetValue = PrinterConnectionAndCommunication.Instance.TargetBedTemperature;
|
||||
double actualValue = Math.Max(0, PrinterConnectionAndCommunication.Instance.ActualBedTemperature);
|
||||
double targetValue = PrinterConnection.Instance.TargetBedTemperature;
|
||||
double actualValue = Math.Max(0, PrinterConnection.Instance.ActualBedTemperature);
|
||||
|
||||
progressBar.RatioComplete = targetValue != 0 ? actualValue / targetValue : 1;
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
{
|
||||
this.extruderIndex = extruderIndex;
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.ExtruderTemperatureRead.RegisterEvent((s, e) =>
|
||||
PrinterConnection.Instance.ExtruderTemperatureRead.RegisterEvent((s, e) =>
|
||||
{
|
||||
UpdateTemperatures();
|
||||
}, ref unregisterEvents);
|
||||
|
|
@ -90,8 +90,8 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
|
||||
public override void UpdateTemperatures()
|
||||
{
|
||||
double targetValue = PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderIndex);
|
||||
double actualValue = Math.Max(0, PrinterConnectionAndCommunication.Instance.GetActualExtruderTemperature(extruderIndex));
|
||||
double targetValue = PrinterConnection.Instance.GetTargetExtruderTemperature(extruderIndex);
|
||||
double actualValue = Math.Max(0, PrinterConnection.Instance.GetActualExtruderTemperature(extruderIndex));
|
||||
|
||||
progressBar.RatioComplete = targetValue != 0 ? actualValue / targetValue : 1;
|
||||
|
||||
|
|
@ -250,11 +250,11 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.RequestPause();
|
||||
PrinterConnection.Instance.RequestPause();
|
||||
});
|
||||
};
|
||||
pauseButton.Enabled = PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|
||||
&& !PrinterConnectionAndCommunication.Instance.PrinterIsPaused;
|
||||
pauseButton.Enabled = PrinterConnection.Instance.PrinterIsPrinting
|
||||
&& !PrinterConnection.Instance.PrinterIsPaused;
|
||||
|
||||
actionBar.AddChild(pauseButton);
|
||||
|
||||
|
|
@ -265,9 +265,9 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
|
||||
if (PrinterConnection.Instance.PrinterIsPaused)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.Resume();
|
||||
PrinterConnection.Instance.Resume();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
@ -285,7 +285,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
this.Close();
|
||||
}
|
||||
};
|
||||
cancelButton.Enabled = PrinterConnectionAndCommunication.Instance.PrinterIsPrinting || PrinterConnectionAndCommunication.Instance.PrinterIsPaused;
|
||||
cancelButton.Enabled = PrinterConnection.Instance.PrinterIsPrinting || PrinterConnection.Instance.PrinterIsPaused;
|
||||
actionBar.AddChild(cancelButton);
|
||||
|
||||
actionBar.AddChild(CreateVerticalLine());
|
||||
|
|
@ -296,7 +296,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
resetButton.Visible = ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.show_reset_connection);
|
||||
resetButton.Click += (s, e) =>
|
||||
{
|
||||
UiThread.RunOnIdle(PrinterConnectionAndCommunication.Instance.RebootBoard);
|
||||
UiThread.RunOnIdle(PrinterConnection.Instance.RebootBoard);
|
||||
};
|
||||
actionBar.AddChild(resetButton);
|
||||
|
||||
|
|
@ -330,12 +330,12 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
}
|
||||
};
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent((s, e) =>
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
pauseButton.Enabled = PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|
||||
&& !PrinterConnectionAndCommunication.Instance.PrinterIsPaused;
|
||||
pauseButton.Enabled = PrinterConnection.Instance.PrinterIsPrinting
|
||||
&& !PrinterConnection.Instance.PrinterIsPaused;
|
||||
|
||||
if(PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
|
||||
if(PrinterConnection.Instance.PrinterIsPaused)
|
||||
{
|
||||
resumeButton.Visible = true;
|
||||
pauseButton.Visible = false;
|
||||
|
|
@ -347,11 +347,11 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
}
|
||||
|
||||
// Close if not Preparing, Printing or Paused
|
||||
switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
|
||||
switch (PrinterConnection.Instance.CommunicationState)
|
||||
{
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Printing:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Paused:
|
||||
case PrinterConnection.CommunicationStates.PreparingToPrint:
|
||||
case PrinterConnection.CommunicationStates.Printing:
|
||||
case PrinterConnection.CommunicationStates.Paused:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -360,9 +360,9 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
}
|
||||
}, ref unregisterEvents);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent((s, e) =>
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
cancelButton.Enabled = PrinterConnectionAndCommunication.Instance.PrinterIsPrinting || PrinterConnectionAndCommunication.Instance.PrinterIsPaused;
|
||||
cancelButton.Enabled = PrinterConnection.Instance.PrinterIsPrinting || PrinterConnection.Instance.PrinterIsPaused;
|
||||
}, ref unregisterEvents);
|
||||
|
||||
return actionBar;
|
||||
|
|
@ -495,11 +495,11 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
GetProgressInfo();
|
||||
|
||||
// Here for safety
|
||||
switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
|
||||
switch (PrinterConnection.Instance.CommunicationState)
|
||||
{
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Printing:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Paused:
|
||||
case PrinterConnection.CommunicationStates.PreparingToPrint:
|
||||
case PrinterConnection.CommunicationStates.Printing:
|
||||
case PrinterConnection.CommunicationStates.Paused:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -513,7 +513,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
|
||||
private void GetProgressInfo()
|
||||
{
|
||||
int secondsPrinted = PrinterConnectionAndCommunication.Instance.SecondsPrinted;
|
||||
int secondsPrinted = PrinterConnection.Instance.SecondsPrinted;
|
||||
int hoursPrinted = (int)(secondsPrinted / (60 * 60));
|
||||
int minutesPrinted = (secondsPrinted / 60 - hoursPrinted * 60);
|
||||
secondsPrinted = secondsPrinted % 60;
|
||||
|
|
@ -521,9 +521,9 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
// TODO: Consider if the consistency of a common time format would look and feel better than changing formats based on elapsed duration
|
||||
timeWidget.Text = (hoursPrinted <= 0) ? $"{minutesPrinted}:{secondsPrinted:00}" : $"{hoursPrinted}:{minutesPrinted:00}:{secondsPrinted:00}";
|
||||
|
||||
progressDial.LayerCount = PrinterConnectionAndCommunication.Instance.CurrentlyPrintingLayer;
|
||||
progressDial.LayerCompletedRatio = PrinterConnectionAndCommunication.Instance.RatioIntoCurrentLayer;
|
||||
progressDial.CompletedRatio = PrinterConnectionAndCommunication.Instance.PercentComplete / 100;
|
||||
progressDial.LayerCount = PrinterConnection.Instance.CurrentlyPrintingLayer;
|
||||
progressDial.LayerCompletedRatio = PrinterConnection.Instance.RatioIntoCurrentLayer;
|
||||
progressDial.CompletedRatio = PrinterConnection.Instance.PercentComplete / 100;
|
||||
}
|
||||
|
||||
public override void OnLoad(EventArgs args)
|
||||
|
|
@ -633,7 +633,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
|
||||
progressContainer.AddChild(printerName);
|
||||
|
||||
partName = new TextWidget(PrinterConnectionAndCommunication.Instance.ActivePrintItem.GetFriendlyName(), pointSize: 16, textColor: ActiveTheme.Instance.PrimaryTextColor)
|
||||
partName = new TextWidget(PrinterConnection.Instance.ActivePrintItem.GetFriendlyName(), pointSize: 16, textColor: ActiveTheme.Instance.PrimaryTextColor)
|
||||
{
|
||||
HAnchor = HAnchor.ParentCenter,
|
||||
MinimumSize = new Vector2(maxTextWidth, MinimumSize.y),
|
||||
|
|
@ -950,7 +950,7 @@ namespace MatterHackers.MatterControl.CustomWidgets
|
|||
|
||||
private Button CreateZMoveButton(double moveAmount, bool smallScreen)
|
||||
{
|
||||
var button = buttonFactory.GenerateMoveButton($"{Math.Abs(moveAmount):0.00} mm", PrinterConnectionAndCommunication.Axis.Z, MovementControls.ZSpeed);
|
||||
var button = buttonFactory.GenerateMoveButton($"{Math.Abs(moveAmount):0.00} mm", PrinterConnection.Axis.Z, MovementControls.ZSpeed);
|
||||
button.MoveAmount = moveAmount;
|
||||
button.HAnchor = HAnchor.Max_FitToChildren_ParentWidth;
|
||||
button.VAnchor = VAnchor.FitToChildren;
|
||||
|
|
|
|||
|
|
@ -243,15 +243,15 @@ namespace MatterHackers.MatterControl.EeProm
|
|||
string cmdho = "M206 X" + hox + " Y" + hoy + " Z" + hoz;
|
||||
string cmdpid = "M301 P" + ppid + " I" + ipid + " D" + dpid;
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(cmdsteps);
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(cmdfeed);
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(cmdmacc);
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(cmdacc);
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(cmdav);
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(cmdho);
|
||||
PrinterConnection.Instance.SendLineToPrinterNow(cmdsteps);
|
||||
PrinterConnection.Instance.SendLineToPrinterNow(cmdfeed);
|
||||
PrinterConnection.Instance.SendLineToPrinterNow(cmdmacc);
|
||||
PrinterConnection.Instance.SendLineToPrinterNow(cmdacc);
|
||||
PrinterConnection.Instance.SendLineToPrinterNow(cmdav);
|
||||
PrinterConnection.Instance.SendLineToPrinterNow(cmdho);
|
||||
if (hasPID)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(cmdpid);
|
||||
PrinterConnection.Instance.SendLineToPrinterNow(cmdpid);
|
||||
}
|
||||
|
||||
changed = false;
|
||||
|
|
@ -502,14 +502,14 @@ namespace MatterHackers.MatterControl.EeProm
|
|||
|
||||
public void SaveToEeProm()
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("M500");
|
||||
PrinterConnection.Instance.SendLineToPrinterNow("M500");
|
||||
}
|
||||
|
||||
// this does not save them to eeprom
|
||||
public void SetPrinterToFactorySettings()
|
||||
{
|
||||
hasPID = false;
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("M502");
|
||||
PrinterConnection.Instance.SendLineToPrinterNow("M502");
|
||||
}
|
||||
|
||||
public void Add(object sender, EventArgs e)
|
||||
|
|
@ -542,7 +542,7 @@ namespace MatterHackers.MatterControl.EeProm
|
|||
public void Update()
|
||||
{
|
||||
hasPID = false;
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("M503");
|
||||
PrinterConnection.Instance.SendLineToPrinterNow("M503");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -264,7 +264,7 @@ namespace MatterHackers.MatterControl.EeProm
|
|||
mainContainer.AddChild(bottomButtonBar);
|
||||
}
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationUnconditionalFromPrinter.RegisterEvent(currentEePromSettings.Add, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationUnconditionalFromPrinter.RegisterEvent(currentEePromSettings.Add, ref unregisterEvents);
|
||||
|
||||
AddChild(mainContainer);
|
||||
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ namespace MatterHackers.MatterControl.EeProm
|
|||
string cmd = "M206 T" + type + " P" + position + " ";
|
||||
if (type == 3) cmd += "X" + value;
|
||||
else cmd += "S" + value;
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(cmd);
|
||||
PrinterConnection.Instance.SendLineToPrinterNow(cmd);
|
||||
changed = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -100,7 +100,7 @@ namespace MatterHackers.MatterControl.EeProm
|
|||
|
||||
public void AskPrinterForSettings()
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("M205");
|
||||
PrinterConnection.Instance.SendLineToPrinterNow("M205");
|
||||
}
|
||||
|
||||
internal void Export(string fileName)
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ namespace MatterHackers.MatterControl.EeProm
|
|||
public CloseOnDisconnectWindow(double width, double height)
|
||||
: base(width, height)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent((s, e) =>
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
if(!PrinterConnectionAndCommunication.Instance.PrinterIsConnected)
|
||||
if(!PrinterConnection.Instance.PrinterIsConnected)
|
||||
{
|
||||
this.CloseOnIdle();
|
||||
}
|
||||
|
|
@ -217,7 +217,7 @@ namespace MatterHackers.MatterControl.EeProm
|
|||
ShowAsSystemWindow();
|
||||
|
||||
currentEePromSettings.Clear();
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationUnconditionalFromPrinter.RegisterEvent(currentEePromSettings.Add, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationUnconditionalFromPrinter.RegisterEvent(currentEePromSettings.Add, ref unregisterEvents);
|
||||
currentEePromSettings.eventAdded += NewSettingReadFromPrinter;
|
||||
currentEePromSettings.AskPrinterForSettings();
|
||||
|
||||
|
|
|
|||
|
|
@ -80,10 +80,10 @@ namespace MatterHackers.MatterControl.PrintHistory
|
|||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.Connected)
|
||||
if (PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Connected)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationState = PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint;
|
||||
PrinterConnectionAndCommunication.Instance.StartPrint(lastPrintTask.PrintingGCodeFileName, lastPrintTask);
|
||||
PrinterConnection.Instance.CommunicationState = PrinterConnection.CommunicationStates.PreparingToPrint;
|
||||
PrinterConnection.Instance.StartPrint(lastPrintTask.PrintingGCodeFileName, lastPrintTask);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -112,7 +112,7 @@ namespace MatterHackers.MatterControl.PrintHistory
|
|||
if (instance == null)
|
||||
{
|
||||
instance = new PrintHistoryData();
|
||||
PrinterConnectionAndCommunication.Instance.ConnectionSucceeded.RegisterEvent(PrintRecovery.CheckIfNeedToRecoverPrint, ref unregisterEvents);
|
||||
PrinterConnection.Instance.ConnectionSucceeded.RegisterEvent(PrintRecovery.CheckIfNeedToRecoverPrint, ref unregisterEvents);
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -235,11 +235,11 @@ namespace MatterHackers.MatterControl.PrintHistory
|
|||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
if (!PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintIsActive)
|
||||
if (!PrinterCommunication.PrinterConnection.Instance.PrintIsActive)
|
||||
{
|
||||
QueueData.Instance.AddItem(new PrintItemWrapper(printTask.PrintItemId), 0);
|
||||
|
||||
PrinterCommunication.PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible();
|
||||
PrinterCommunication.PrinterConnection.Instance.PrintActivePartIfPossible();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -153,7 +153,7 @@ namespace MatterHackers.MatterControl
|
|||
RenderOrthographic ? RenderType.ORTHOGROPHIC : RenderType.RAY_TRACE,
|
||||
BigRenderSize.x,
|
||||
BigRenderSize.y,
|
||||
allowMultiThreading: !PrinterConnectionAndCommunication.Instance.PrinterIsPrinting);
|
||||
allowMultiThreading: !PrinterConnection.Instance.PrinterIsPrinting);
|
||||
|
||||
if (thumbnail != null)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -53,7 +53,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
|
||||
public void LoadFilesFromSD()
|
||||
{
|
||||
var printer = PrinterConnectionAndCommunication.Instance;
|
||||
var printer = PrinterConnection.Instance;
|
||||
|
||||
if (printer.PrinterIsConnected
|
||||
&& !(printer.PrinterIsPrinting || printer.PrinterIsPaused))
|
||||
|
|
@ -106,7 +106,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
break;
|
||||
|
||||
case "End file list":
|
||||
PrinterConnectionAndCommunication.Instance.ReadLine.UnregisterEvent(Printer_LineRead, ref unregisterEvents);
|
||||
PrinterConnection.Instance.ReadLine.UnregisterEvent(Printer_LineRead, ref unregisterEvents);
|
||||
this.OnReloaded();
|
||||
break;
|
||||
}
|
||||
|
|
@ -117,7 +117,7 @@ namespace MatterHackers.MatterControl.Library
|
|||
public override void Dispose()
|
||||
{
|
||||
// In case "End file list" is never received
|
||||
PrinterConnectionAndCommunication.Instance.ReadLine.UnregisterEvent(Printer_LineRead, ref unregisterEvents);
|
||||
PrinterConnection.Instance.ReadLine.UnregisterEvent(Printer_LineRead, ref unregisterEvents);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -197,7 +197,7 @@ namespace MatterHackers.MatterControl
|
|||
case "CONNECT_TO_PRINTER":
|
||||
if (currentCommandIndex + 1 <= commandLineArgs.Length)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter();
|
||||
PrinterConnection.Instance.ConnectToActivePrinter();
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
@ -212,12 +212,12 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
string fileName = Path.GetFileNameWithoutExtension(fullPath);
|
||||
QueueData.Instance.AddItem(new PrintItemWrapper(new PrintItem(fileName, fullPath)));
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent((sender, e) =>
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent((sender, e) =>
|
||||
{
|
||||
if (!hasBeenRun && PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.Connected)
|
||||
if (!hasBeenRun && PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Connected)
|
||||
{
|
||||
hasBeenRun = true;
|
||||
PrinterConnectionAndCommunication.Instance.PrintActivePartIfPossible();
|
||||
PrinterConnection.Instance.PrintActivePartIfPossible();
|
||||
}
|
||||
}, ref unregisterEvent);
|
||||
}
|
||||
|
|
@ -539,12 +539,12 @@ namespace MatterHackers.MatterControl
|
|||
UserSettings.Instance.Fields.StartCountDurringExit = UserSettings.Instance.Fields.StartCount;
|
||||
|
||||
TerminalWindow.CloseIfOpen();
|
||||
if (PrinterConnectionAndCommunication.Instance.CommunicationState != PrinterConnectionAndCommunication.CommunicationStates.PrintingFromSd)
|
||||
if (PrinterConnection.Instance.CommunicationState != PrinterConnection.CommunicationStates.PrintingFromSd)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.Disable();
|
||||
PrinterConnection.Instance.Disable();
|
||||
}
|
||||
//Close connection to the local datastore
|
||||
PrinterConnectionAndCommunication.Instance.HaltConnectionThread();
|
||||
PrinterConnection.Instance.HaltConnectionThread();
|
||||
SlicingQueue.Instance.ShutDownSlicingThread();
|
||||
ApplicationController.Instance.OnApplicationClosed();
|
||||
|
||||
|
|
@ -589,13 +589,13 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
if (!closeHasBeenConfirmed
|
||||
&& !closeMessageBoxIsOpen
|
||||
&& PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
||||
&& PrinterConnection.Instance.PrinterIsPrinting)
|
||||
{
|
||||
cancelClose = true;
|
||||
// Record that we are waiting for a response to the request to close
|
||||
closeMessageBoxIsOpen = true;
|
||||
|
||||
if (PrinterConnectionAndCommunication.Instance.CommunicationState != PrinterConnectionAndCommunication.CommunicationStates.PrintingFromSd)
|
||||
if (PrinterConnection.Instance.CommunicationState != PrinterConnection.CommunicationStates.PrintingFromSd)
|
||||
{
|
||||
// Needed as we can't assign to CancelClose inside of the lambda below
|
||||
StyledMessageBox.ShowMessageBox(ConditionalyCloseNow,
|
||||
|
|
@ -632,12 +632,12 @@ namespace MatterHackers.MatterControl
|
|||
if (continueWithShutdown)
|
||||
{
|
||||
closeHasBeenConfirmed = true;
|
||||
bool printingFromSdCard = PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.PrintingFromSd
|
||||
|| (PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.Paused
|
||||
&& PrinterConnectionAndCommunication.Instance.PrePauseCommunicationState == PrinterConnectionAndCommunication.CommunicationStates.PrintingFromSd);
|
||||
bool printingFromSdCard = PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.PrintingFromSd
|
||||
|| (PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Paused
|
||||
&& PrinterConnection.Instance.PrePauseCommunicationState == PrinterConnection.CommunicationStates.PrintingFromSd);
|
||||
if (!printingFromSdCard)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.Disable();
|
||||
PrinterConnection.Instance.Disable();
|
||||
}
|
||||
|
||||
MatterControlApplication app = MatterControlApplication.Instance;
|
||||
|
|
@ -826,7 +826,7 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
try
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.OnIdle();
|
||||
PrinterConnection.Instance.OnIdle();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -147,9 +147,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
#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 (PrinterConnectionAndCommunication.Instance.FirmwareType)
|
||||
switch (PrinterConnection.Instance.FirmwareType)
|
||||
{
|
||||
case PrinterConnectionAndCommunication.FirmwareTypes.Repetier:
|
||||
case PrinterConnection.FirmwareTypes.Repetier:
|
||||
if (openEePromRepetierWidget != null)
|
||||
{
|
||||
openEePromRepetierWidget.BringToFront();
|
||||
|
|
@ -164,7 +164,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
}
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.FirmwareTypes.Marlin:
|
||||
case PrinterConnection.FirmwareTypes.Marlin:
|
||||
if (openEePromMarlinWidget != null)
|
||||
{
|
||||
openEePromMarlinWidget.BringToFront();
|
||||
|
|
@ -180,7 +180,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
break;
|
||||
|
||||
default:
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("M115");
|
||||
PrinterConnection.Instance.SendLineToPrinterNow("M115");
|
||||
StyledMessageBox.ShowMessageBox(null, noEepromMappingMessage, noEepromMappingTitle, StyledMessageBox.MessageType.OK);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -511,14 +511,14 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
if (windowType == WindowMode.Embeded)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(SetEditControlsBasedOnPrinterState, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(SetEditControlsBasedOnPrinterState, ref unregisterEvents);
|
||||
if (windowType == WindowMode.Embeded)
|
||||
{
|
||||
// make sure we lock the controls if we are printing or paused
|
||||
switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
|
||||
switch (PrinterConnection.Instance.CommunicationState)
|
||||
{
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Printing:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Paused:
|
||||
case PrinterConnection.CommunicationStates.Printing:
|
||||
case PrinterConnection.CommunicationStates.Paused:
|
||||
LockEditControls();
|
||||
break;
|
||||
}
|
||||
|
|
@ -2179,10 +2179,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
if (windowType == WindowMode.Embeded)
|
||||
{
|
||||
switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
|
||||
switch (PrinterConnection.Instance.CommunicationState)
|
||||
{
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Printing:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Paused:
|
||||
case PrinterConnection.CommunicationStates.Printing:
|
||||
case PrinterConnection.CommunicationStates.Paused:
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
@ -2297,10 +2297,10 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
if (windowType == WindowMode.Embeded)
|
||||
{
|
||||
switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
|
||||
switch (PrinterConnection.Instance.CommunicationState)
|
||||
{
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Printing:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Paused:
|
||||
case PrinterConnection.CommunicationStates.Printing:
|
||||
case PrinterConnection.CommunicationStates.Paused:
|
||||
LockEditControls();
|
||||
break;
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
private TextWidget gcodeProcessingStateInfoText;
|
||||
private ViewGcodeWidget gcodeViewWidget;
|
||||
private PrintItemWrapper printItem => PrinterConnectionAndCommunication.Instance.ActivePrintItem;
|
||||
private PrintItemWrapper printItem => PrinterConnection.Instance.ActivePrintItem;
|
||||
private bool startedSliceFromGenerateButton = false;
|
||||
private Button generateGCodeButton;
|
||||
private FlowLayoutWidget buttonBottomPanel;
|
||||
|
|
@ -441,7 +441,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
private void SetAnimationPosition()
|
||||
{
|
||||
int currentLayer = PrinterConnectionAndCommunication.Instance.CurrentlyPrintingLayer;
|
||||
int currentLayer = PrinterConnection.Instance.CurrentlyPrintingLayer;
|
||||
if (currentLayer <= 0)
|
||||
{
|
||||
selectLayerSlider.Value = 0;
|
||||
|
|
@ -451,7 +451,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
else
|
||||
{
|
||||
selectLayerSlider.Value = currentLayer - 1;
|
||||
layerRenderRatioSlider.SecondValue = PrinterConnectionAndCommunication.Instance.RatioIntoCurrentLayer;
|
||||
layerRenderRatioSlider.SecondValue = PrinterConnection.Instance.RatioIntoCurrentLayer;
|
||||
layerRenderRatioSlider.FirstValue = 0;
|
||||
}
|
||||
}
|
||||
|
|
@ -577,7 +577,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
modelInfoContainer.AddChild(GetEstimatedMassInfo());
|
||||
modelInfoContainer.AddChild(GetEstimatedCostInfo());
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(HookUpGCodeMessagesWhenDonePrinting, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(HookUpGCodeMessagesWhenDonePrinting, ref unregisterEvents);
|
||||
|
||||
buttonPanel.AddChild(modelInfoContainer);
|
||||
|
||||
|
|
@ -827,8 +827,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 (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|
||||
&& PrinterConnectionAndCommunication.Instance.ActivePrintItem == printItem)
|
||||
if (PrinterConnection.Instance.PrinterIsPrinting
|
||||
&& PrinterConnection.Instance.ActivePrintItem == printItem)
|
||||
{
|
||||
printItem.SlicingOutputMessage -= sliceItem_SlicingOutputMessage;
|
||||
printItem.SlicingDone -= sliceItem_Done;
|
||||
|
|
@ -836,7 +836,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
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(HookUpGCodeMessagesWhenDonePrinting, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(HookUpGCodeMessagesWhenDonePrinting, ref unregisterEvents);
|
||||
UiThread.RunOnIdle(SetSyncToPrintVisibility);
|
||||
}
|
||||
}
|
||||
|
|
@ -852,7 +852,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
{
|
||||
if (windowMode == WindowMode.Embeded)
|
||||
{
|
||||
bool printerIsRunningPrint = PrinterConnectionAndCommunication.Instance.PrinterIsPaused || PrinterConnectionAndCommunication.Instance.PrinterIsPrinting;
|
||||
bool printerIsRunningPrint = PrinterConnection.Instance.PrinterIsPaused || PrinterConnection.Instance.PrinterIsPrinting;
|
||||
|
||||
if (syncToPrint.Checked && printerIsRunningPrint)
|
||||
{
|
||||
|
|
@ -898,7 +898,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
private void HookUpGCodeMessagesWhenDonePrinting(object sender, EventArgs e)
|
||||
{
|
||||
if (!PrinterConnectionAndCommunication.Instance.PrinterIsPaused && !PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
||||
if (!PrinterConnection.Instance.PrinterIsPaused && !PrinterConnection.Instance.PrinterIsPrinting)
|
||||
{
|
||||
// unregister first to make sure we don't double up in error (should not be needed but no harm)
|
||||
printItem.SlicingOutputMessage -= sliceItem_SlicingOutputMessage;
|
||||
|
|
@ -930,7 +930,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
|
||||
public override void OnDraw(Graphics2D graphics2D)
|
||||
{
|
||||
bool printerIsRunningPrint = PrinterConnectionAndCommunication.Instance.PrinterIsPaused || PrinterConnectionAndCommunication.Instance.PrinterIsPrinting;
|
||||
bool printerIsRunningPrint = PrinterConnection.Instance.PrinterIsPaused || PrinterConnection.Instance.PrinterIsPrinting;
|
||||
if (syncToPrint != null
|
||||
&& syncToPrint.Checked
|
||||
&& printerIsRunningPrint)
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
public PauseHandlingStream(GCodeStream internalStream)
|
||||
: base(internalStream)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.ReadLine.RegisterEvent((s, e) =>
|
||||
PrinterConnection.Instance.ReadLine.RegisterEvent((s, e) =>
|
||||
{
|
||||
StringEventArgs currentEvent = e as StringEventArgs;
|
||||
if (currentEvent != null)
|
||||
|
|
@ -95,7 +95,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
|
||||
public void DoPause(PauseReason pauseReason, string layerNumber = "")
|
||||
{
|
||||
var pcc = PrinterConnectionAndCommunication.Instance;
|
||||
var pcc = PrinterConnection.Instance;
|
||||
switch (pauseReason)
|
||||
{
|
||||
case PauseReason.UserRequested:
|
||||
|
|
@ -129,9 +129,9 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
private void ResumePrint(bool clickedOk)
|
||||
{
|
||||
// They clicked either Resume or Ok
|
||||
if (!clickedOk && PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
|
||||
if (!clickedOk && PrinterConnection.Instance.PrinterIsPaused)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.Resume();
|
||||
PrinterConnection.Instance.Resume();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -150,7 +150,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
|
||||
if (lineToSend == null)
|
||||
{
|
||||
if (!PrinterConnectionAndCommunication.Instance.PrinterIsPaused)
|
||||
if (!PrinterConnection.Instance.PrinterIsPaused)
|
||||
{
|
||||
lineToSend = base.ReadLine();
|
||||
if (lineToSend == null)
|
||||
|
|
@ -164,7 +164,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
// request to read the endstop state
|
||||
if (!timeSinceLastEndstopRead.IsRunning || timeSinceLastEndstopRead.ElapsedMilliseconds > 5000)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow("M119");
|
||||
PrinterConnection.Instance.SendLineToPrinterNow("M119");
|
||||
timeSinceLastEndstopRead.Restart();
|
||||
}
|
||||
}
|
||||
|
|
@ -193,10 +193,10 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
{
|
||||
moveLocationAtEndOfPauseCode = LastDestination;
|
||||
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting)
|
||||
if (PrinterConnection.Instance.PrinterIsPrinting)
|
||||
{
|
||||
// remember where we were after we ran the pause gcode
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationState = PrinterConnectionAndCommunication.CommunicationStates.Paused;
|
||||
PrinterConnection.Instance.CommunicationState = PrinterConnection.CommunicationStates.Paused;
|
||||
}
|
||||
|
||||
lineToSend = "";
|
||||
|
|
|
|||
|
|
@ -58,8 +58,8 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
|
||||
if (lineFromChild != null
|
||||
&& PrintLevelingStream.Enabled
|
||||
&& PrinterConnectionAndCommunication.Instance.ActivePrinter.GetValue<bool>(SettingsKey.print_leveling_enabled)
|
||||
&& !PrinterConnectionAndCommunication.Instance.ActivePrinter.GetValue<bool>(SettingsKey.has_hardware_leveling))
|
||||
&& PrinterConnection.Instance.ActivePrinter.GetValue<bool>(SettingsKey.print_leveling_enabled)
|
||||
&& !PrinterConnection.Instance.ActivePrinter.GetValue<bool>(SettingsKey.has_hardware_leveling))
|
||||
{
|
||||
if (LineIsMovement(lineFromChild))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -173,12 +173,12 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
int extruderCount = ActiveSliceSettings.Instance.GetValue<int>(SettingsKey.extruder_count);
|
||||
for (int i = 0; i < extruderCount; i++)
|
||||
{
|
||||
startingExtruderTemps.Add(PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(i));
|
||||
startingExtruderTemps.Add(PrinterConnection.Instance.GetTargetExtruderTemperature(i));
|
||||
}
|
||||
|
||||
if (ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.has_heated_bed))
|
||||
{
|
||||
startingBedTemp = PrinterConnectionAndCommunication.Instance.TargetBedTemperature;
|
||||
startingBedTemp = PrinterConnection.Instance.TargetBedTemperature;
|
||||
}
|
||||
}
|
||||
int parensAfterCommand = lineToSend.IndexOf('(', MacroPrefix.Length);
|
||||
|
|
@ -270,12 +270,12 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
runningMacro = false;
|
||||
for (int i = 0; i < startingExtruderTemps.Count; i++)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.SetTargetExtruderTemperature(i, startingExtruderTemps[i]);
|
||||
PrinterConnection.Instance.SetTargetExtruderTemperature(i, startingExtruderTemps[i]);
|
||||
}
|
||||
|
||||
if (ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.has_heated_bed))
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.TargetBedTemperature = startingBedTemp;
|
||||
PrinterConnection.Instance.TargetBedTemperature = startingBedTemp;
|
||||
}
|
||||
}
|
||||
waitingForUserInput = false;
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
|
||||
public override string ReadLine()
|
||||
{
|
||||
if (!PrinterConnectionAndCommunication.Instance.WatingForPositionRead
|
||||
if (!PrinterConnection.Instance.WatingForPositionRead
|
||||
&& nextReadTimeMs < UiThread.CurrentTimerMs
|
||||
&& PrinterConnectionAndCommunication.Instance.PrinterIsConnected)
|
||||
&& PrinterConnection.Instance.PrinterIsConnected)
|
||||
{
|
||||
nextReadTimeMs = UiThread.CurrentTimerMs + 1000;
|
||||
return "M105";
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
|
||||
case State.waitingForExtruderTemp:
|
||||
{
|
||||
double extruderTemp = PrinterConnectionAndCommunication.Instance.GetActualExtruderTemperature((int)extruderIndex);
|
||||
double extruderTemp = PrinterConnection.Instance.GetActualExtruderTemperature((int)extruderIndex);
|
||||
bool tempWithinRange = extruderTemp >= targetTemp - sameTempRange && extruderTemp <= targetTemp + sameTempRange;
|
||||
if (tempWithinRange && !timeHaveBeenAtTemp.IsRunning)
|
||||
{
|
||||
|
|
@ -141,7 +141,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
}
|
||||
|
||||
if (timeHaveBeenAtTemp.Elapsed.TotalSeconds > waitAfterReachTempTime
|
||||
|| PrinterConnectionAndCommunication.Instance.PrintWasCanceled)
|
||||
|| PrinterConnection.Instance.PrintWasCanceled)
|
||||
{
|
||||
// switch to pass through and continue
|
||||
state = State.passthrough;
|
||||
|
|
@ -157,7 +157,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
|
||||
case State.waitingForBedTemp:
|
||||
{
|
||||
double bedTemp = PrinterConnectionAndCommunication.Instance.ActualBedTemperature;
|
||||
double bedTemp = PrinterConnection.Instance.ActualBedTemperature;
|
||||
bool tempWithinRange;
|
||||
if (waitWhenCooling)
|
||||
{
|
||||
|
|
@ -175,7 +175,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
|
|||
}
|
||||
|
||||
if (timeHaveBeenAtTemp.Elapsed.TotalSeconds > waitAfterReachTempTime
|
||||
|| PrinterConnectionAndCommunication.Instance.PrintWasCanceled)
|
||||
|| PrinterConnection.Instance.PrintWasCanceled)
|
||||
{
|
||||
// switch to pass through and continue
|
||||
state = State.passthrough;
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
/// It handles opening and closing the serial port and does quite a bit of gcode parsing.
|
||||
/// It should be refactored into better modules at some point.
|
||||
/// </summary>
|
||||
public class PrinterConnectionAndCommunication
|
||||
public class PrinterConnection
|
||||
{
|
||||
public RootedObjectEventHandler ActivePrintItemChanged = new RootedObjectEventHandler();
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
|
||||
private const int MAX_INVALID_CONNECTION_CHARS = 3;
|
||||
|
||||
private static PrinterConnectionAndCommunication globalInstance;
|
||||
private static PrinterConnection globalInstance;
|
||||
|
||||
private object locker = new object();
|
||||
|
||||
|
|
@ -268,7 +268,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
|
||||
private double feedRateRatio = 1;
|
||||
|
||||
private PrinterConnectionAndCommunication()
|
||||
private PrinterConnection()
|
||||
{
|
||||
MonitorPrinterTemperature = true;
|
||||
|
||||
|
|
@ -383,13 +383,13 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
|
||||
public enum FirmwareTypes { Unknown, Repetier, Marlin, Sprinter };
|
||||
|
||||
public static PrinterConnectionAndCommunication Instance
|
||||
public static PrinterConnection Instance
|
||||
{
|
||||
get
|
||||
{
|
||||
if (globalInstance == null)
|
||||
{
|
||||
globalInstance = new PrinterConnectionAndCommunication();
|
||||
globalInstance = new PrinterConnection();
|
||||
}
|
||||
return globalInstance;
|
||||
}
|
||||
|
|
@ -1393,7 +1393,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
}
|
||||
else
|
||||
{
|
||||
CommunicationState = PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint;
|
||||
CommunicationState = PrinterConnection.CommunicationStates.PreparingToPrint;
|
||||
PrintItemWrapper partToPrint = ActivePrintItem;
|
||||
SlicingQueue.Instance.QueuePartForSlicing(partToPrint);
|
||||
partToPrint.SlicingDone += partToPrint_SliceDone;
|
||||
|
|
@ -2539,7 +2539,7 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
{
|
||||
if (messageBoxResponse)
|
||||
{
|
||||
CommunicationState = PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint;
|
||||
CommunicationState = PrinterConnection.CommunicationStates.PreparingToPrint;
|
||||
PrintItemWrapper partToPrint = ActivePrintItem;
|
||||
SlicingQueue.Instance.QueuePartForSlicing(partToPrint);
|
||||
partToPrint.SlicingDone += partToPrint_SliceDone;
|
||||
|
|
@ -3017,13 +3017,13 @@ namespace MatterHackers.MatterControl.PrinterCommunication
|
|||
{
|
||||
try
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.ReadFromPrinter(this);
|
||||
PrinterConnection.Instance.ReadFromPrinter(this);
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationUnconditionalToPrinter.CallEvents(this, new StringEventArgs("Read Thread Has Exited.\n"));
|
||||
PrinterConnection.Instance.CommunicationUnconditionalToPrinter.CallEvents(this, new StringEventArgs("Read Thread Has Exited.\n"));
|
||||
numRunning--;
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,10 +66,10 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
leftToRight.AddChild(fanControlsLayout);
|
||||
SetDisplayAttributes();
|
||||
|
||||
fanSpeedDisplay = new EditableNumberDisplay(textImageButtonFactory, "{0}%".FormatWith(PrinterConnectionAndCommunication.Instance.FanSpeed0To255.ToString()), "100%");
|
||||
fanSpeedDisplay = new EditableNumberDisplay(textImageButtonFactory, "{0}%".FormatWith(PrinterConnection.Instance.FanSpeed0To255.ToString()), "100%");
|
||||
fanSpeedDisplay.EditComplete += (sender, e) =>
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.FanSpeed0To255 = (int)(fanSpeedDisplay.GetValue() * 255.5 / 100);
|
||||
PrinterConnection.Instance.FanSpeed0To255 = (int)(fanSpeedDisplay.GetValue() * 255.5 / 100);
|
||||
};
|
||||
leftToRight.AddChild(fanSpeedDisplay);
|
||||
|
||||
|
|
@ -106,13 +106,13 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
|
||||
private GuiWidget CreateFanControls()
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.FanSpeedSet.RegisterEvent(FanSpeedChanged_Event, ref unregisterEvents);
|
||||
PrinterConnection.Instance.FanSpeedSet.RegisterEvent(FanSpeedChanged_Event, ref unregisterEvents);
|
||||
|
||||
FlowLayoutWidget leftToRight = new FlowLayoutWidget();
|
||||
leftToRight.Padding = new BorderDouble(3, 0, 0, 5);
|
||||
|
||||
//Matt's test editing to add a on/off toggle switch
|
||||
bool fanActive = PrinterConnectionAndCommunication.Instance.FanSpeed0To255 != 0;
|
||||
bool fanActive = PrinterConnection.Instance.FanSpeed0To255 != 0;
|
||||
|
||||
toggleSwitch = ImageButtonFactory.CreateToggleSwitch(fanActive);
|
||||
toggleSwitch.VAnchor = VAnchor.ParentCenter;
|
||||
|
|
@ -128,7 +128,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
|
||||
private void FanSpeedChanged_Event(object sender, EventArgs e)
|
||||
{
|
||||
int printerFanSpeed = PrinterConnectionAndCommunication.Instance.FanSpeed0To255;
|
||||
int printerFanSpeed = PrinterConnection.Instance.FanSpeed0To255;
|
||||
|
||||
fanSpeedDisplay.SetDisplayString("{0}%".FormatWith((int)(printerFanSpeed * 100.5 / 255)));
|
||||
|
||||
|
|
@ -153,11 +153,11 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
CheckBox toggleSwitch = (CheckBox)sender;
|
||||
if (toggleSwitch.Checked)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.FanSpeed0To255 = 255;
|
||||
PrinterConnection.Instance.FanSpeed0To255 = 255;
|
||||
}
|
||||
else
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.FanSpeed0To255 = 0;
|
||||
PrinterConnection.Instance.FanSpeed0To255 = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -216,7 +216,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
disableMotors.Margin = new BorderDouble(0);
|
||||
disableMotors.Click += (s, e) =>
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.ReleaseMotors();
|
||||
PrinterConnection.Instance.ReleaseMotors();
|
||||
};
|
||||
|
||||
GuiWidget spacerReleaseShow = new GuiWidget(10 * GuiWidget.DeviceScale, 0);
|
||||
|
|
@ -271,7 +271,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
});
|
||||
});
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.DestinationChanged.RegisterEvent((object sender, EventArgs e) =>
|
||||
PrinterConnection.Instance.DestinationChanged.RegisterEvent((object sender, EventArgs e) =>
|
||||
{
|
||||
reportDestinationChanged.CallEvent();
|
||||
}, ref unregisterEvents);
|
||||
|
|
@ -281,7 +281,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
|
||||
private static void SetDestinationPositionText(TextWidget xPosition, TextWidget yPosition, TextWidget zPosition)
|
||||
{
|
||||
Vector3 destinationPosition = PrinterConnectionAndCommunication.Instance.CurrentDestination;
|
||||
Vector3 destinationPosition = PrinterConnection.Instance.CurrentDestination;
|
||||
xPosition.Text = "X: {0:0.00}".FormatWith(destinationPosition.x);
|
||||
yPosition.Text = "Y: {0:0.00}".FormatWith(destinationPosition.y);
|
||||
zPosition.Text = "Z: {0:0.00}".FormatWith(destinationPosition.z);
|
||||
|
|
@ -289,22 +289,22 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
|
||||
private void homeAll_Click(object sender, EventArgs mouseEvent)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.XYZ);
|
||||
PrinterConnection.Instance.HomeAxis(PrinterConnection.Axis.XYZ);
|
||||
}
|
||||
|
||||
private void homeXButton_Click(object sender, EventArgs mouseEvent)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.X);
|
||||
PrinterConnection.Instance.HomeAxis(PrinterConnection.Axis.X);
|
||||
}
|
||||
|
||||
private void homeYButton_Click(object sender, EventArgs mouseEvent)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Y);
|
||||
PrinterConnection.Instance.HomeAxis(PrinterConnection.Axis.Y);
|
||||
}
|
||||
|
||||
private void homeZButton_Click(object sender, EventArgs mouseEvent)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Z);
|
||||
PrinterConnection.Instance.HomeAxis(PrinterConnection.Axis.Z);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
atxPowertoggleSwitch.Margin = new BorderDouble(6, 0, 6, 6);
|
||||
atxPowertoggleSwitch.CheckedStateChanged += (sender, e) =>
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.AtxPowerEnabled = atxPowertoggleSwitch.Checked;
|
||||
PrinterConnection.Instance.AtxPowerEnabled = atxPowertoggleSwitch.Checked;
|
||||
};
|
||||
|
||||
FlowLayoutWidget paddingContainer = new FlowLayoutWidget();
|
||||
|
|
@ -66,8 +66,8 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
|
||||
UpdateControlVisibility(null, null);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(this.UpdateControlVisibility, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.AtxPowerStateChanged.RegisterEvent(this.UpdatePowerSwitch, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(this.UpdateControlVisibility, ref unregisterEvents);
|
||||
PrinterConnection.Instance.AtxPowerStateChanged.RegisterEvent(this.UpdatePowerSwitch, ref unregisterEvents);
|
||||
|
||||
this.HAnchor = Agg.UI.HAnchor.ParentLeftRight;
|
||||
this.HAnchor = HAnchor.ParentLeftRight;
|
||||
|
|
@ -77,12 +77,12 @@ namespace MatterHackers.MatterControl.PrinterControls
|
|||
private void UpdateControlVisibility(object sender, EventArgs args)
|
||||
{
|
||||
this.Visible = ActiveSliceSettings.Instance.GetValue<bool>(SettingsKey.has_power_control);
|
||||
this.SetEnableLevel(PrinterConnectionAndCommunication.Instance.PrinterIsConnected ? EnableLevel.Enabled : EnableLevel.Disabled);
|
||||
this.SetEnableLevel(PrinterConnection.Instance.PrinterIsConnected ? EnableLevel.Enabled : EnableLevel.Disabled);
|
||||
}
|
||||
|
||||
private void UpdatePowerSwitch(object sender, EventArgs args)
|
||||
{
|
||||
this.atxPowertoggleSwitch.Checked = PrinterConnectionAndCommunication.Instance.AtxPowerEnabled;
|
||||
this.atxPowertoggleSwitch.Checked = PrinterConnection.Instance.AtxPowerEnabled;
|
||||
}
|
||||
|
||||
private void SetDisplayAttributes()
|
||||
|
|
|
|||
|
|
@ -157,8 +157,8 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private void AddHandlers()
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
}
|
||||
|
||||
private void AddActionControls(FlowLayoutWidget controlsTopToBottomLayout)
|
||||
|
|
@ -213,13 +213,13 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
else // we at least have a printer selected
|
||||
{
|
||||
switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
|
||||
switch (PrinterConnection.Instance.CommunicationState)
|
||||
{
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Disconnecting:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.ConnectionLost:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Disconnected:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.FailedToConnect:
|
||||
case PrinterConnection.CommunicationStates.Disconnecting:
|
||||
case PrinterConnection.CommunicationStates.ConnectionLost:
|
||||
case PrinterConnection.CommunicationStates.Disconnected:
|
||||
case PrinterConnection.CommunicationStates.AttemptingToConnect:
|
||||
case PrinterConnection.CommunicationStates.FailedToConnect:
|
||||
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
|
||||
{
|
||||
extruderTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
|
||||
|
|
@ -239,8 +239,8 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.FinishedPrint:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Connected:
|
||||
case PrinterConnection.CommunicationStates.FinishedPrint:
|
||||
case PrinterConnection.CommunicationStates.Connected:
|
||||
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
|
||||
{
|
||||
extruderTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
|
|
@ -259,7 +259,7 @@ namespace MatterHackers.MatterControl
|
|||
movementControlsContainer?.jogControls.SetEnabledLevels(false, true);
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.PrintingFromSd:
|
||||
case PrinterConnection.CommunicationStates.PrintingFromSd:
|
||||
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
|
||||
{
|
||||
extruderTemperatureControlWidget?.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
|
|
@ -272,14 +272,14 @@ namespace MatterHackers.MatterControl
|
|||
tuningAdjustmentControlsContainer?.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Printing:
|
||||
switch (PrinterConnectionAndCommunication.Instance.PrintingState)
|
||||
case PrinterConnection.CommunicationStates.PreparingToPrint:
|
||||
case PrinterConnection.CommunicationStates.Printing:
|
||||
switch (PrinterConnection.Instance.PrintingState)
|
||||
{
|
||||
case PrinterConnectionAndCommunication.DetailedPrintingState.HomingAxis:
|
||||
case PrinterConnectionAndCommunication.DetailedPrintingState.HeatingBed:
|
||||
case PrinterConnectionAndCommunication.DetailedPrintingState.HeatingExtruder:
|
||||
case PrinterConnectionAndCommunication.DetailedPrintingState.Printing:
|
||||
case PrinterConnection.DetailedPrintingState.HomingAxis:
|
||||
case PrinterConnection.DetailedPrintingState.HeatingBed:
|
||||
case PrinterConnection.DetailedPrintingState.HeatingExtruder:
|
||||
case PrinterConnection.DetailedPrintingState.Printing:
|
||||
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
|
||||
{
|
||||
extruderTemperatureControlWidget?.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
|
|
@ -303,7 +303,7 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Paused:
|
||||
case PrinterConnection.CommunicationStates.Paused:
|
||||
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
|
||||
{
|
||||
extruderTemperatureControlWidget?.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
|
|
@ -480,8 +480,8 @@ namespace MatterHackers.MatterControl
|
|||
ActiveTheme.Instance.SecondaryAccentColor, new RGBA_Bytes(), unselectedTextColor, new RGBA_Bytes()));
|
||||
}
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
|
||||
SetVisibleControls();
|
||||
}
|
||||
|
|
@ -512,13 +512,13 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
else // we at least have a printer selected
|
||||
{
|
||||
switch (PrinterConnectionAndCommunication.Instance.CommunicationState)
|
||||
switch (PrinterConnection.Instance.CommunicationState)
|
||||
{
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Disconnecting:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.ConnectionLost:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Disconnected:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.FailedToConnect:
|
||||
case PrinterConnection.CommunicationStates.Disconnecting:
|
||||
case PrinterConnection.CommunicationStates.ConnectionLost:
|
||||
case PrinterConnection.CommunicationStates.Disconnected:
|
||||
case PrinterConnection.CommunicationStates.AttemptingToConnect:
|
||||
case PrinterConnection.CommunicationStates.FailedToConnect:
|
||||
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
|
||||
{
|
||||
extruderTemperatureControlWidget?.SetEnableLevel(DisableableWidget.EnableLevel.ConfigOnly);
|
||||
|
|
@ -538,8 +538,8 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.FinishedPrint:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Connected:
|
||||
case PrinterConnection.CommunicationStates.FinishedPrint:
|
||||
case PrinterConnection.CommunicationStates.Connected:
|
||||
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
|
||||
{
|
||||
extruderTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
|
|
@ -559,7 +559,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.PrintingFromSd:
|
||||
case PrinterConnection.CommunicationStates.PrintingFromSd:
|
||||
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
|
||||
{
|
||||
extruderTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
|
|
@ -572,14 +572,14 @@ namespace MatterHackers.MatterControl
|
|||
tuningAdjustmentControlsContainer?.SetEnableLevel(DisableableWidget.EnableLevel.Disabled);
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.PreparingToPrint:
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Printing:
|
||||
switch (PrinterConnectionAndCommunication.Instance.PrintingState)
|
||||
case PrinterConnection.CommunicationStates.PreparingToPrint:
|
||||
case PrinterConnection.CommunicationStates.Printing:
|
||||
switch (PrinterConnection.Instance.PrintingState)
|
||||
{
|
||||
case PrinterConnectionAndCommunication.DetailedPrintingState.HomingAxis:
|
||||
case PrinterConnectionAndCommunication.DetailedPrintingState.HeatingBed:
|
||||
case PrinterConnectionAndCommunication.DetailedPrintingState.HeatingExtruder:
|
||||
case PrinterConnectionAndCommunication.DetailedPrintingState.Printing:
|
||||
case PrinterConnection.DetailedPrintingState.HomingAxis:
|
||||
case PrinterConnection.DetailedPrintingState.HeatingBed:
|
||||
case PrinterConnection.DetailedPrintingState.HeatingExtruder:
|
||||
case PrinterConnection.DetailedPrintingState.Printing:
|
||||
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
|
||||
{
|
||||
extruderTemperatureControlWidget.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
|
|
@ -605,7 +605,7 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
break;
|
||||
|
||||
case PrinterConnectionAndCommunication.CommunicationStates.Paused:
|
||||
case PrinterConnection.CommunicationStates.Paused:
|
||||
foreach (DisableableWidget extruderTemperatureControlWidget in temperatureControlsContainer.ExtruderWidgetContainers)
|
||||
{
|
||||
extruderTemperatureControlWidget?.SetEnableLevel(DisableableWidget.EnableLevel.Enabled);
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
{
|
||||
public ConnectionWizardPage()
|
||||
{
|
||||
cancelButton.Click += (s, e) => PrinterConnectionAndCommunication.Instance.HaltConnectionThread();
|
||||
cancelButton.Click += (s, e) => PrinterConnection.Instance.HaltConnectionThread();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -52,7 +52,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
footerRow.AddChild(new HorizontalSpacer());
|
||||
footerRow.AddChild(cancelButton);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
}
|
||||
|
||||
public override void OnClosed(ClosedEventArgs e)
|
||||
|
|
@ -111,7 +111,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
|
||||
private void onPrinterStatusChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsConnected)
|
||||
if (PrinterConnection.Instance.PrinterIsConnected)
|
||||
{
|
||||
printerComPortHelpLink.Visible = false;
|
||||
printerComPortError.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
|
|
@ -120,7 +120,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
connectButton.Visible = false;
|
||||
UiThread.RunOnIdle(() => this?.Parent?.Close());
|
||||
}
|
||||
else if (PrinterConnectionAndCommunication.Instance.CommunicationState != PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect)
|
||||
else if (PrinterConnection.Instance.CommunicationState != PrinterConnection.CommunicationStates.AttemptingToConnect)
|
||||
{
|
||||
printerComPortHelpLink.Visible = false;
|
||||
printerComPortError.TextColor = RGBA_Bytes.Red;
|
||||
|
|
@ -146,7 +146,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
printerComPortError.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
|
||||
ActiveSliceSettings.Instance.Helpers.SetComPort(GetSelectedSerialPort());
|
||||
PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter();
|
||||
PrinterConnection.Instance.ConnectToActivePrinter();
|
||||
|
||||
connectButton.Visible = false;
|
||||
refreshButton.Visible = false;
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
private void SkipConnectionLink_Click(object sender, EventArgs mouseEvent)
|
||||
{
|
||||
UiThread.RunOnIdle(() => {
|
||||
PrinterConnectionAndCommunication.Instance.HaltConnectionThread();
|
||||
PrinterConnection.Instance.HaltConnectionThread();
|
||||
Parent.Close();
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
connectButton = textImageButtonFactory.Generate("Connect".Localize());
|
||||
connectButton.Click += ConnectButton_Click;
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
|
||||
//Add buttons to buttonContainer
|
||||
footerRow.AddChild(nextButton);
|
||||
|
|
@ -116,14 +116,14 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
printerErrorMessage.Text = "Attempting to connect".Localize() + "...";
|
||||
|
||||
ActiveSliceSettings.Instance.Helpers.SetComPort(candidatePort);
|
||||
PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter();
|
||||
PrinterConnection.Instance.ConnectToActivePrinter();
|
||||
connectButton.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void onPrinterStatusChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsConnected)
|
||||
if (PrinterConnection.Instance.PrinterIsConnected)
|
||||
{
|
||||
printerErrorMessage.TextColor = ActiveTheme.Instance.PrimaryTextColor;
|
||||
printerErrorMessage.Text = "Connection succeeded".Localize() + "!";
|
||||
|
|
@ -131,7 +131,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
|
|||
connectButton.Visible = false;
|
||||
UiThread.RunOnIdle(() => this?.Parent?.Close());
|
||||
}
|
||||
else if (PrinterConnectionAndCommunication.Instance.CommunicationState != PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect)
|
||||
else if (PrinterConnection.Instance.CommunicationState != PrinterConnection.CommunicationStates.AttemptingToConnect)
|
||||
{
|
||||
printerErrorMessage.TextColor = RGBA_Bytes.Red;
|
||||
printerErrorMessage.Text = "Uh-oh! Could not connect to printer.".Localize();
|
||||
|
|
|
|||
|
|
@ -447,8 +447,8 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private void AddHandlers()
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.ExtruderTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.ExtruderTemperatureSet.RegisterEvent(ExtruderTemperatureSet, ref unregisterEvents);
|
||||
PrinterConnection.Instance.ExtruderTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents);
|
||||
PrinterConnection.Instance.ExtruderTemperatureSet.RegisterEvent(ExtruderTemperatureSet, ref unregisterEvents);
|
||||
}
|
||||
|
||||
public override void OnClosed(ClosedEventArgs e)
|
||||
|
|
@ -488,12 +488,12 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
protected override double GetTargetTemperature()
|
||||
{
|
||||
return PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderIndex0Based);
|
||||
return PrinterConnection.Instance.GetTargetExtruderTemperature(extruderIndex0Based);
|
||||
}
|
||||
|
||||
protected override double GetActualTemperature()
|
||||
{
|
||||
return PrinterConnectionAndCommunication.Instance.GetActualExtruderTemperature(extruderIndex0Based);
|
||||
return PrinterConnection.Instance.GetActualExtruderTemperature(extruderIndex0Based);
|
||||
}
|
||||
|
||||
protected override void SetTargetTemperature(double targetTemp)
|
||||
|
|
@ -501,18 +501,18 @@ namespace MatterHackers.MatterControl
|
|||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
double goalTemp = (int)(targetTemp + .5);
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|
||||
&& PrinterConnectionAndCommunication.Instance.PrintingState == PrinterConnectionAndCommunication.DetailedPrintingState.HeatingExtruder
|
||||
&& goalTemp != PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderIndex0Based))
|
||||
if (PrinterConnection.Instance.PrinterIsPrinting
|
||||
&& PrinterConnection.Instance.PrintingState == PrinterConnection.DetailedPrintingState.HeatingExtruder
|
||||
&& goalTemp != PrinterConnection.Instance.GetTargetExtruderTemperature(extruderIndex0Based))
|
||||
{
|
||||
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}", PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderIndex0Based), 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}", PrinterConnection.Instance.GetTargetExtruderTemperature(extruderIndex0Based), sliceSettingsNote);
|
||||
StyledMessageBox.ShowMessageBox(null, message, "Waiting For Extruder To Heat");
|
||||
}
|
||||
else
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.SetTargetExtruderTemperature(extruderIndex0Based, (int)(targetTemp + .5));
|
||||
string displayString = string.Format("{0:0.0}°C", PrinterConnectionAndCommunication.Instance.GetTargetExtruderTemperature(extruderIndex0Based));
|
||||
PrinterConnection.Instance.SetTargetExtruderTemperature(extruderIndex0Based, (int)(targetTemp + .5));
|
||||
string displayString = string.Format("{0:0.0}°C", PrinterConnection.Instance.GetTargetExtruderTemperature(extruderIndex0Based));
|
||||
targetTemperatureDisplay.SetDisplayString(displayString);
|
||||
}
|
||||
});
|
||||
|
|
@ -538,8 +538,8 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private void AddHandlers()
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.BedTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.BedTemperatureSet.RegisterEvent(BedTemperatureSet, ref unregisterEvents);
|
||||
PrinterConnection.Instance.BedTemperatureRead.RegisterEvent(onTemperatureRead, ref unregisterEvents);
|
||||
PrinterConnection.Instance.BedTemperatureSet.RegisterEvent(BedTemperatureSet, ref unregisterEvents);
|
||||
}
|
||||
|
||||
public override void OnClosed(ClosedEventArgs e)
|
||||
|
|
@ -587,29 +587,29 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
protected override double GetActualTemperature()
|
||||
{
|
||||
return PrinterConnectionAndCommunication.Instance.ActualBedTemperature;
|
||||
return PrinterConnection.Instance.ActualBedTemperature;
|
||||
}
|
||||
|
||||
protected override double GetTargetTemperature()
|
||||
{
|
||||
return PrinterConnectionAndCommunication.Instance.TargetBedTemperature;
|
||||
return PrinterConnection.Instance.TargetBedTemperature;
|
||||
}
|
||||
|
||||
protected override void SetTargetTemperature(double targetTemp)
|
||||
{
|
||||
double goalTemp = (int)(targetTemp + .5);
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|
||||
&& PrinterConnectionAndCommunication.Instance.PrintingState == PrinterConnectionAndCommunication.DetailedPrintingState.HeatingBed
|
||||
&& goalTemp != PrinterConnectionAndCommunication.Instance.TargetBedTemperature)
|
||||
if (PrinterConnection.Instance.PrinterIsPrinting
|
||||
&& PrinterConnection.Instance.PrintingState == PrinterConnection.DetailedPrintingState.HeatingBed
|
||||
&& goalTemp != PrinterConnection.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}", PrinterConnectionAndCommunication.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}", PrinterConnection.Instance.TargetBedTemperature, sliceSettingsNote);
|
||||
StyledMessageBox.ShowMessageBox(null, message, "Waiting For Bed To Heat");
|
||||
}
|
||||
else
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.TargetBedTemperature = goalTemp;
|
||||
string displayString = string.Format("{0:0.0}°C", PrinterConnectionAndCommunication.Instance.TargetBedTemperature);
|
||||
PrinterConnection.Instance.TargetBedTemperature = goalTemp;
|
||||
string displayString = string.Format("{0:0.0}°C", PrinterConnection.Instance.TargetBedTemperature);
|
||||
targetTemperatureDisplay.SetDisplayString(displayString);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,9 +71,9 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
private PrinterOutputCache()
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.ConnectionFailed.RegisterEvent(Instance_ConnectionFailed, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationUnconditionalFromPrinter.RegisterEvent(FromPrinter, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationUnconditionalToPrinter.RegisterEvent(ToPrinter, ref unregisterEvents);
|
||||
PrinterConnection.Instance.ConnectionFailed.RegisterEvent(Instance_ConnectionFailed, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationUnconditionalFromPrinter.RegisterEvent(FromPrinter, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationUnconditionalToPrinter.RegisterEvent(ToPrinter, ref unregisterEvents);
|
||||
if (Is32Bit())
|
||||
{
|
||||
// About 10 megs worth. Average line length in gcode file is about 14 and we store strings as chars (16 bit) so 450,000 lines.
|
||||
|
|
|
|||
|
|
@ -305,7 +305,7 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
commandHistory.Add(textToSend);
|
||||
commandHistoryIndex = commandHistory.Count;
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(textToSend);
|
||||
PrinterConnection.Instance.SendLineToPrinterNow(textToSend);
|
||||
manualCommandTextEdit.Text = "";
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -328,58 +328,58 @@ namespace MatterHackers.MatterControl
|
|||
int eMoveAmountNegative = -EAxisMoveAmount;
|
||||
|
||||
// if we are not printing and on mac or PC
|
||||
if (PrinterConnectionAndCommunication.Instance.CommunicationState != PrinterConnectionAndCommunication.CommunicationStates.Printing
|
||||
if (PrinterConnection.Instance.CommunicationState != PrinterConnection.CommunicationStates.Printing
|
||||
&& (OsInformation.OperatingSystem == OSType.Windows || OsInformation.OperatingSystem == OSType.Mac))
|
||||
{
|
||||
if (e.KeyCode == Keys.Z)
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.CommunicationState != PrinterConnectionAndCommunication.CommunicationStates.Printing)
|
||||
if (PrinterConnection.Instance.CommunicationState != PrinterConnection.CommunicationStates.Printing)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Z);
|
||||
PrinterConnection.Instance.HomeAxis(PrinterConnection.Axis.Z);
|
||||
}
|
||||
}
|
||||
else if (e.KeyCode == Keys.Y)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.Y);
|
||||
PrinterConnection.Instance.HomeAxis(PrinterConnection.Axis.Y);
|
||||
}
|
||||
else if (e.KeyCode == Keys.X)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.X);
|
||||
PrinterConnection.Instance.HomeAxis(PrinterConnection.Axis.X);
|
||||
}
|
||||
if (e.KeyCode == Keys.Home)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.HomeAxis(PrinterConnectionAndCommunication.Axis.XYZ);
|
||||
PrinterConnection.Instance.HomeAxis(PrinterConnection.Axis.XYZ);
|
||||
}
|
||||
else if (e.KeyCode == Keys.Left)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountNegative, MovementControls.XSpeed);
|
||||
PrinterConnection.Instance.MoveRelative(PrinterConnection.Axis.X, moveAmountNegative, MovementControls.XSpeed);
|
||||
}
|
||||
else if (e.KeyCode == Keys.Right)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.X, moveAmountPositive, MovementControls.XSpeed);
|
||||
PrinterConnection.Instance.MoveRelative(PrinterConnection.Axis.X, moveAmountPositive, MovementControls.XSpeed);
|
||||
}
|
||||
else if (e.KeyCode == Keys.Up)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountPositive, MovementControls.YSpeed);
|
||||
PrinterConnection.Instance.MoveRelative(PrinterConnection.Axis.Y, moveAmountPositive, MovementControls.YSpeed);
|
||||
}
|
||||
else if (e.KeyCode == Keys.Down)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Y, moveAmountNegative, MovementControls.YSpeed);
|
||||
PrinterConnection.Instance.MoveRelative(PrinterConnection.Axis.Y, moveAmountNegative, MovementControls.YSpeed);
|
||||
}
|
||||
else if (e.KeyCode == Keys.E)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountPositive, MovementControls.EFeedRate(0));
|
||||
PrinterConnection.Instance.MoveRelative(PrinterConnection.Axis.E, eMoveAmountPositive, MovementControls.EFeedRate(0));
|
||||
}
|
||||
else if (e.KeyCode == Keys.R)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.E, eMoveAmountNegative, MovementControls.EFeedRate(0));
|
||||
PrinterConnection.Instance.MoveRelative(PrinterConnection.Axis.E, eMoveAmountNegative, MovementControls.EFeedRate(0));
|
||||
}
|
||||
}
|
||||
|
||||
if ((OsInformation.OperatingSystem == OSType.Windows && e.KeyCode == Keys.PageUp)
|
||||
|| (OsInformation.OperatingSystem == OSType.Mac && e.KeyCode == (Keys.Back | Keys.Cancel)))
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.Printing)
|
||||
if (PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Printing)
|
||||
{
|
||||
var currentZ = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.baby_step_z_offset);
|
||||
currentZ += moveAmountPositive;
|
||||
|
|
@ -387,13 +387,13 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
else
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountPositive, MovementControls.ZSpeed);
|
||||
PrinterConnection.Instance.MoveRelative(PrinterConnection.Axis.Z, moveAmountPositive, MovementControls.ZSpeed);
|
||||
}
|
||||
}
|
||||
else if ((OsInformation.OperatingSystem == OSType.Windows && e.KeyCode == Keys.PageDown)
|
||||
|| (OsInformation.OperatingSystem == OSType.Mac && e.KeyCode == Keys.Clear))
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.Printing)
|
||||
if (PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Printing)
|
||||
{
|
||||
var currentZ = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.baby_step_z_offset);
|
||||
currentZ += moveAmountNegative;
|
||||
|
|
@ -401,7 +401,7 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
else
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.MoveRelative(PrinterConnectionAndCommunication.Axis.Z, moveAmountNegative, MovementControls.ZSpeed);
|
||||
PrinterConnection.Instance.MoveRelative(PrinterConnection.Axis.Z, moveAmountNegative, MovementControls.ZSpeed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -539,7 +539,7 @@ namespace MatterHackers.MatterControl
|
|||
return eButtons;
|
||||
}
|
||||
|
||||
private static MoveButton CreateMoveButton(string label, PrinterConnectionAndCommunication.Axis axis, double moveSpeed, bool levelingButtons, MoveButtonFactory buttonFactory)
|
||||
private static MoveButton CreateMoveButton(string label, PrinterConnection.Axis axis, double moveSpeed, bool levelingButtons, MoveButtonFactory buttonFactory)
|
||||
{
|
||||
var button = buttonFactory.GenerateMoveButton(label, axis, moveSpeed);
|
||||
button.VAnchor = VAnchor.AbsolutePosition;
|
||||
|
|
@ -567,7 +567,7 @@ namespace MatterHackers.MatterControl
|
|||
MoveButtonFactory moveButtonFactory = new MoveButtonFactory();
|
||||
moveButtonFactory.Colors.Fill.Normal = color;
|
||||
|
||||
zPlusControl = CreateMoveButton("Z+", PrinterConnectionAndCommunication.Axis.Z, MovementControls.ZSpeed, levelingButtons, moveButtonFactory);
|
||||
zPlusControl = CreateMoveButton("Z+", PrinterConnection.Axis.Z, MovementControls.ZSpeed, levelingButtons, moveButtonFactory);
|
||||
zPlusControl.Name = "Move Z positive".Localize();
|
||||
zPlusControl.ToolTipText = "Move Z positive".Localize();
|
||||
zButtons.AddChild(zPlusControl);
|
||||
|
|
@ -577,7 +577,7 @@ namespace MatterHackers.MatterControl
|
|||
spacer.BackgroundColor = XYZColors.zColor;
|
||||
zButtons.AddChild(spacer);
|
||||
|
||||
zMinusControl = CreateMoveButton("Z-", PrinterConnectionAndCommunication.Axis.Z, MovementControls.ZSpeed, levelingButtons, moveButtonFactory);
|
||||
zMinusControl = CreateMoveButton("Z-", PrinterConnection.Axis.Z, MovementControls.ZSpeed, levelingButtons, moveButtonFactory);
|
||||
zMinusControl.ToolTipText = "Move Z negative".Localize();
|
||||
zButtons.AddChild(zMinusControl);
|
||||
}
|
||||
|
|
@ -595,7 +595,7 @@ namespace MatterHackers.MatterControl
|
|||
xButtons.HAnchor |= Agg.UI.HAnchor.ParentCenter;
|
||||
xButtons.VAnchor |= Agg.UI.VAnchor.ParentCenter;
|
||||
|
||||
xMinusControl = CreateMoveButton("X-", PrinterConnectionAndCommunication.Axis.X, MovementControls.XSpeed, false, moveButtonFactory);
|
||||
xMinusControl = CreateMoveButton("X-", PrinterConnection.Axis.X, MovementControls.XSpeed, false, moveButtonFactory);
|
||||
xMinusControl.ToolTipText = "Move X negative".Localize();
|
||||
xButtons.AddChild(xMinusControl);
|
||||
|
||||
|
|
@ -604,7 +604,7 @@ namespace MatterHackers.MatterControl
|
|||
spacer.BackgroundColor = XYZColors.xColor;
|
||||
xButtons.AddChild(spacer);
|
||||
|
||||
xPlusControl = CreateMoveButton("X+", PrinterConnectionAndCommunication.Axis.X, MovementControls.XSpeed, false, moveButtonFactory);
|
||||
xPlusControl = CreateMoveButton("X+", PrinterConnection.Axis.X, MovementControls.XSpeed, false, moveButtonFactory);
|
||||
xPlusControl.ToolTipText = "Move X positive".Localize();
|
||||
xButtons.AddChild(xPlusControl);
|
||||
}
|
||||
|
|
@ -615,7 +615,7 @@ namespace MatterHackers.MatterControl
|
|||
moveButtonFactory.Colors.Fill.Normal = XYZColors.yColor;
|
||||
yButtons.HAnchor |= Agg.UI.HAnchor.ParentCenter;
|
||||
yButtons.VAnchor |= Agg.UI.VAnchor.ParentCenter;
|
||||
yPlusControl = CreateMoveButton("Y+", PrinterConnectionAndCommunication.Axis.Y, MovementControls.YSpeed, false, moveButtonFactory);
|
||||
yPlusControl = CreateMoveButton("Y+", PrinterConnection.Axis.Y, MovementControls.YSpeed, false, moveButtonFactory);
|
||||
yPlusControl.ToolTipText = "Move Y positive".Localize();
|
||||
yButtons.AddChild(yPlusControl);
|
||||
|
||||
|
|
@ -624,7 +624,7 @@ namespace MatterHackers.MatterControl
|
|||
spacer.BackgroundColor = XYZColors.yColor;
|
||||
yButtons.AddChild(spacer);
|
||||
|
||||
yMinusControl = CreateMoveButton("Y-", PrinterConnectionAndCommunication.Axis.Y, MovementControls.YSpeed, false, moveButtonFactory);
|
||||
yMinusControl = CreateMoveButton("Y-", PrinterConnection.Axis.Y, MovementControls.YSpeed, false, moveButtonFactory);
|
||||
yMinusControl.ToolTipText = "Move Y negative".Localize();
|
||||
yButtons.AddChild(yMinusControl);
|
||||
}
|
||||
|
|
@ -639,14 +639,14 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public class MoveButton : Button
|
||||
{
|
||||
private PrinterConnectionAndCommunication.Axis moveAxis;
|
||||
private PrinterConnection.Axis moveAxis;
|
||||
|
||||
//Amounts in millimeters
|
||||
public double MoveAmount = 10;
|
||||
|
||||
private double movementFeedRate;
|
||||
|
||||
public MoveButton(double x, double y, GuiWidget buttonView, PrinterConnectionAndCommunication.Axis axis, double movementFeedRate)
|
||||
public MoveButton(double x, double y, GuiWidget buttonView, PrinterConnection.Axis axis, double movementFeedRate)
|
||||
: base(x, y, buttonView)
|
||||
{
|
||||
this.moveAxis = axis;
|
||||
|
|
@ -656,9 +656,9 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
MoveButton moveButton = (MoveButton)s;
|
||||
|
||||
if (PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.Printing)
|
||||
if (PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Printing)
|
||||
{
|
||||
if (moveAxis == PrinterConnectionAndCommunication.Axis.Z) // only works on z
|
||||
if (moveAxis == PrinterConnection.Axis.Z) // only works on z
|
||||
{
|
||||
var currentZ = ActiveSliceSettings.Instance.GetValue<double>(SettingsKey.baby_step_z_offset);
|
||||
currentZ += this.MoveAmount;
|
||||
|
|
@ -667,7 +667,7 @@ namespace MatterHackers.MatterControl
|
|||
}
|
||||
else
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.MoveRelative(this.moveAxis, this.MoveAmount, movementFeedRate);
|
||||
PrinterConnection.Instance.MoveRelative(this.moveAxis, this.MoveAmount, movementFeedRate);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
@ -693,7 +693,7 @@ namespace MatterHackers.MatterControl
|
|||
base.OnClick(mouseEvent);
|
||||
|
||||
//Add more fancy movement here
|
||||
PrinterConnectionAndCommunication.Instance.MoveExtruderRelative(MoveAmount, movementFeedRate, ExtruderNumber);
|
||||
PrinterConnection.Instance.MoveExtruderRelative(MoveAmount, movementFeedRate, ExtruderNumber);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -786,7 +786,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
public double BorderWidth { get; set; } = 1;
|
||||
|
||||
public MoveButton GenerateMoveButton(string label, PrinterConnectionAndCommunication.Axis axis, double movementFeedRate)
|
||||
public MoveButton GenerateMoveButton(string label, PrinterConnection.Axis axis, double movementFeedRate)
|
||||
{
|
||||
//Create button based on view container widget
|
||||
return new MoveButton(0, 0, GetButtonView(label), axis, movementFeedRate)
|
||||
|
|
|
|||
|
|
@ -84,8 +84,8 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
{
|
||||
if (index >= 0 && index < ItemCount)
|
||||
{
|
||||
bool ActiveItemMustStayInQueue = PrinterConnectionAndCommunication.Instance.PrinterIsPrinting || PrinterConnectionAndCommunication.Instance.PrinterIsPaused;
|
||||
bool PartMustStayInQueue = ActiveItemMustStayInQueue && PrintItems[index] == PrinterConnectionAndCommunication.Instance.ActivePrintItem;
|
||||
bool ActiveItemMustStayInQueue = PrinterConnection.Instance.PrinterIsPrinting || PrinterConnection.Instance.PrinterIsPaused;
|
||||
bool PartMustStayInQueue = ActiveItemMustStayInQueue && PrintItems[index] == PrinterConnection.Instance.ActivePrintItem;
|
||||
if (!PartMustStayInQueue)
|
||||
{
|
||||
PrintItems.RemoveAt(index);
|
||||
|
|
@ -138,16 +138,16 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
|
||||
public void LoadFilesFromSD()
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsConnected
|
||||
&& !(PrinterConnectionAndCommunication.Instance.PrinterIsPrinting
|
||||
|| PrinterConnectionAndCommunication.Instance.PrinterIsPaused))
|
||||
if (PrinterConnection.Instance.PrinterIsConnected
|
||||
&& !(PrinterConnection.Instance.PrinterIsPrinting
|
||||
|| PrinterConnection.Instance.PrinterIsPaused))
|
||||
{
|
||||
gotBeginFileList = false;
|
||||
PrinterConnectionAndCommunication.Instance.ReadLine.RegisterEvent(GetSdCardList, ref unregisterEvents);
|
||||
PrinterConnection.Instance.ReadLine.RegisterEvent(GetSdCardList, ref unregisterEvents);
|
||||
StringBuilder commands = new StringBuilder();
|
||||
commands.AppendLine("M21"); // Init SD card
|
||||
commands.AppendLine("M20"); // List SD card
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(commands.ToString());
|
||||
PrinterConnection.Instance.SendLineToPrinterNow(commands.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -197,7 +197,7 @@ namespace MatterHackers.MatterControl.PrintQueue
|
|||
break;
|
||||
|
||||
case "End file list":
|
||||
PrinterConnectionAndCommunication.Instance.ReadLine.UnregisterEvent(GetSdCardList, ref unregisterEvents);
|
||||
PrinterConnection.Instance.ReadLine.UnregisterEvent(GetSdCardList, ref unregisterEvents);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ namespace MatterHackers.MatterControl
|
|||
contentRow.AddChild(new TextWidget("3. Press 'Connect'.".Localize(), 0, 0, 12,textColor:ActiveTheme.Instance.PrimaryTextColor));
|
||||
|
||||
//Add inputs to main container
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(communicationStateChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(communicationStateChanged, ref unregisterEvents);
|
||||
|
||||
connectButtonContainer = new FlowLayoutWidget()
|
||||
{
|
||||
|
|
@ -142,7 +142,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
void ConnectButton_Click(object sender, EventArgs mouseEvent)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter(true);
|
||||
PrinterConnection.Instance.ConnectToActivePrinter(true);
|
||||
}
|
||||
|
||||
void NextButton_Click(object sender, EventArgs mouseEvent)
|
||||
|
|
@ -168,19 +168,19 @@ namespace MatterHackers.MatterControl
|
|||
connectButtonContainer.Visible = false;
|
||||
retryButtonContainer.Visible = false;
|
||||
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsConnected)
|
||||
if (PrinterConnection.Instance.PrinterIsConnected)
|
||||
{
|
||||
generalError.Text = "{0}!".FormatWith ("Connection succeeded".Localize ());
|
||||
generalError.Visible = true;
|
||||
nextButton.Visible = true;
|
||||
}
|
||||
else if (firstLoad || PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.Disconnected)
|
||||
else if (firstLoad || PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Disconnected)
|
||||
{
|
||||
generalError.Text = "";
|
||||
connectButton.Visible = true;
|
||||
connectButtonContainer.Visible = true;
|
||||
}
|
||||
else if (PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect)
|
||||
else if (PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.AttemptingToConnect)
|
||||
{
|
||||
generalError.Text = "{0}...".FormatWith("Attempting to connect".Localize());
|
||||
generalError.Visible = true;
|
||||
|
|
|
|||
|
|
@ -111,7 +111,7 @@ namespace MatterHackers.MatterControl
|
|||
disconnectButton.VAnchor = VAnchor.ParentCenter;
|
||||
disconnectButton.Click += (sender, e) =>
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.Disable();
|
||||
PrinterConnection.Instance.Disable();
|
||||
UiThread.RunOnIdle(WizardPage.WizardWindow.ChangeToPage<SetupOptionsPage>);
|
||||
};
|
||||
buttonContainer.AddChild(disconnectButton);
|
||||
|
|
@ -122,7 +122,7 @@ namespace MatterHackers.MatterControl
|
|||
};
|
||||
mainContainer.AddChild(connectionStatus);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(updateConnectedState, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(updateConnectedState, ref unregisterEvents);
|
||||
updateConnectedState(null, null);
|
||||
}
|
||||
|
||||
|
|
@ -130,12 +130,12 @@ namespace MatterHackers.MatterControl
|
|||
{
|
||||
if (disconnectButton != null)
|
||||
{
|
||||
disconnectButton.Visible = PrinterConnectionAndCommunication.Instance.PrinterIsConnected;
|
||||
disconnectButton.Visible = PrinterConnection.Instance.PrinterIsConnected;
|
||||
}
|
||||
|
||||
if (connectionStatus != null)
|
||||
{
|
||||
connectionStatus.Text = string.Format ("{0}: {1}", "Status".Localize().ToUpper(), PrinterConnectionAndCommunication.Instance.PrinterConnectionStatusVerbose);
|
||||
connectionStatus.Text = string.Format ("{0}: {1}", "Status".Localize().ToUpper(), PrinterConnection.Instance.PrinterConnectionStatusVerbose);
|
||||
}
|
||||
|
||||
this.Invalidate();
|
||||
|
|
|
|||
|
|
@ -57,12 +57,12 @@ namespace MatterHackers.MatterControl
|
|||
footerRow.AddChild(cancelButton);
|
||||
|
||||
// Register for connection notifications
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(ConnectionStatusChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(ConnectionStatusChanged, ref unregisterEvents);
|
||||
}
|
||||
|
||||
public void ConnectionStatusChanged(object test, EventArgs args)
|
||||
{
|
||||
if(PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.Connected && connectToPrinterRow != null)
|
||||
if(PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Connected && connectToPrinterRow != null)
|
||||
{
|
||||
connectToPrinterRow.SetSuccessful();
|
||||
nextButton.Visible = true;
|
||||
|
|
@ -177,7 +177,7 @@ namespace MatterHackers.MatterControl
|
|||
"Connect",
|
||||
"Click the 'Connect' button to retry the original connection attempt",
|
||||
false,
|
||||
() => PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter());
|
||||
() => PrinterConnection.Instance.ConnectToActivePrinter());
|
||||
|
||||
contentRow.AddChild(connectToPrinterRow);
|
||||
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ namespace MatterHackers.MatterControl
|
|||
|
||||
internal void ChangeToSetupBaudOrComPortOne()
|
||||
{
|
||||
if (string.IsNullOrEmpty(PrinterConnectionAndCommunication.Instance?.ActivePrinter?.GetValue(SettingsKey.baud_rate)))
|
||||
if (string.IsNullOrEmpty(PrinterConnection.Instance?.ActivePrinter?.GetValue(SettingsKey.baud_rate)))
|
||||
{
|
||||
ChangeToPage<SetupStepBaudRate>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
// If we have an active printer, run Disable
|
||||
if (activeInstance != PrinterSettings.Empty)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.Disable();
|
||||
PrinterConnection.Instance.Disable();
|
||||
}
|
||||
|
||||
activeInstance = value;
|
||||
|
|
@ -82,7 +82,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
{
|
||||
UiThread.RunOnIdle(() =>
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.ConnectToActivePrinter();
|
||||
PrinterConnection.Instance.ConnectToActivePrinter();
|
||||
}, 2);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,9 +64,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
public void Run()
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.PrinterIsConnected)
|
||||
if (PrinterConnection.Instance.PrinterIsConnected)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.MacroStart();
|
||||
PrinterConnection.Instance.MacroStart();
|
||||
SendCommandToPrinter(GCode);
|
||||
if (GCode.Contains(QueuedCommandsStream.MacroPrefix))
|
||||
{
|
||||
|
|
@ -77,7 +77,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
protected void SendCommandToPrinter(string command)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.SendLineToPrinterNow(command);
|
||||
PrinterConnection.Instance.SendLineToPrinterNow(command);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -305,7 +305,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
public void SetMaterialPreset(int extruderIndex, string materialKey)
|
||||
{
|
||||
if (extruderIndex >= PrinterCommunication.PrinterConnectionAndCommunication.MAX_EXTRUDERS)
|
||||
if (extruderIndex >= PrinterCommunication.PrinterConnection.MAX_EXTRUDERS)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("Requested extruder index is outside of bounds: " + extruderIndex);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -477,7 +477,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
public 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 (PrinterConnectionAndCommunication.Instance != null)
|
||||
if (PrinterConnection.Instance != null)
|
||||
{
|
||||
string savedSettings = printerSettings.GetValue(SettingsKey.manual_movement_speeds);
|
||||
if (!string.IsNullOrEmpty(savedSettings))
|
||||
|
|
|
|||
|
|
@ -154,8 +154,8 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
noConnectionMessageContainer.AddChild(noConnectionMessage);
|
||||
pageTopToBottomLayout.AddChild(noConnectionMessageContainer);
|
||||
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnectionAndCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
PrinterConnection.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
|
||||
|
||||
RebuildSliceSettingsTabs();
|
||||
|
||||
|
|
@ -1286,7 +1286,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
|
||||
EventHandler localUnregisterEvents = null;
|
||||
|
||||
bool canChangeComPort = !PrinterConnectionAndCommunication.Instance.PrinterIsConnected && PrinterConnectionAndCommunication.Instance.CommunicationState != PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect;
|
||||
bool canChangeComPort = !PrinterConnection.Instance.PrinterIsConnected && PrinterConnection.Instance.CommunicationState != PrinterConnection.CommunicationStates.AttemptingToConnect;
|
||||
// The COM_PORT control is unique in its approach to the SlicerConfigName. It uses "com_port" settings name to
|
||||
// bind to a context that will place it in the SliceSetting view but it binds its values to a machine
|
||||
// specific dictionary key that is not exposed in the UI. At runtime we lookup and store to '<machinename>_com_port'
|
||||
|
|
@ -1318,9 +1318,9 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
|
|||
};
|
||||
|
||||
// Prevent droplist interaction when connected
|
||||
PrinterConnectionAndCommunication.Instance.CommunicationStateChanged.RegisterEvent((s, e) =>
|
||||
PrinterConnection.Instance.CommunicationStateChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
canChangeComPort = !PrinterConnectionAndCommunication.Instance.PrinterIsConnected && PrinterConnectionAndCommunication.Instance.CommunicationState != PrinterConnectionAndCommunication.CommunicationStates.AttemptingToConnect;
|
||||
canChangeComPort = !PrinterConnection.Instance.PrinterIsConnected && PrinterConnection.Instance.CommunicationState != PrinterConnection.CommunicationStates.AttemptingToConnect;
|
||||
selectableOptions.Enabled = canChangeComPort;
|
||||
selectableOptions.TextColor = canChangeComPort ? ActiveTheme.Instance.PrimaryTextColor : new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 150);
|
||||
selectableOptions.BorderColor = canChangeComPort ? ActiveTheme.Instance.SecondaryTextColor : new RGBA_Bytes(ActiveTheme.Instance.SecondaryTextColor, 150);
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit d9376b6ec58da66b63022b36e92f8a262e48aa03
|
||||
Subproject commit cdb543e7349bed9c49a9f3a67b5eeb36fc5945fe
|
||||
|
|
@ -44,12 +44,12 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
testRunner.WaitForPrintFinished();
|
||||
|
||||
// Wait for expected temp
|
||||
testRunner.Delay(() => PrinterConnectionAndCommunication.Instance.GetActualExtruderTemperature(0) <= 0, 5);
|
||||
Assert.Less(PrinterConnectionAndCommunication.Instance.GetActualExtruderTemperature(0), 30);
|
||||
testRunner.Delay(() => PrinterConnection.Instance.GetActualExtruderTemperature(0) <= 0, 5);
|
||||
Assert.Less(PrinterConnection.Instance.GetActualExtruderTemperature(0), 30);
|
||||
|
||||
// Wait for expected temp
|
||||
testRunner.Delay(() => PrinterConnectionAndCommunication.Instance.ActualBedTemperature <= 10, 5);
|
||||
Assert.Less(PrinterConnectionAndCommunication.Instance.ActualBedTemperature, 10);
|
||||
testRunner.Delay(() => PrinterConnection.Instance.ActualBedTemperature <= 10, 5);
|
||||
Assert.Less(PrinterConnection.Instance.ActualBedTemperature, 10);
|
||||
}
|
||||
|
||||
return Task.CompletedTask;
|
||||
|
|
@ -278,7 +278,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
|
||||
// Wait for printing to complete
|
||||
var printFinishedResetEvent = new AutoResetEvent(false);
|
||||
PrinterConnectionAndCommunication.Instance.PrintFinished.RegisterEvent((s, e) => printFinishedResetEvent.Set(), ref unregisterEvents);
|
||||
PrinterConnection.Instance.PrintFinished.RegisterEvent((s, e) => printFinishedResetEvent.Set(), ref unregisterEvents);
|
||||
|
||||
testRunner.ClickByName("Start Print Button", 1);
|
||||
|
||||
|
|
@ -312,7 +312,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate);
|
||||
|
||||
// Wait for slicing to complete before setting target values
|
||||
testRunner.Delay(() => PrinterConnectionAndCommunication.Instance.PrintingState == PrinterConnectionAndCommunication.DetailedPrintingState.Printing, 8);
|
||||
testRunner.Delay(() => PrinterConnection.Instance.PrintingState == PrinterConnection.DetailedPrintingState.Printing, 8);
|
||||
testRunner.Delay();
|
||||
|
||||
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate);
|
||||
|
|
@ -369,7 +369,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
testRunner.SwitchToControlsTab();
|
||||
|
||||
var printFinishedResetEvent = new AutoResetEvent(false);
|
||||
PrinterConnectionAndCommunication.Instance.PrintFinished.RegisterEvent((s, e) => printFinishedResetEvent.Set(), ref unregisterEvents);
|
||||
PrinterConnection.Instance.PrintFinished.RegisterEvent((s, e) => printFinishedResetEvent.Set(), ref unregisterEvents);
|
||||
|
||||
testRunner.ClickByName("Start Print Button", 1);
|
||||
|
||||
|
|
@ -403,7 +403,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
ConfirmExpectedSpeeds(testRunner, targetExtrusionRate, targetFeedRate);
|
||||
|
||||
// Wait for slicing to complete before setting target values
|
||||
testRunner.Delay(() => PrinterConnectionAndCommunication.Instance.PrintingState == PrinterConnectionAndCommunication.DetailedPrintingState.Printing, 8);
|
||||
testRunner.Delay(() => PrinterConnection.Instance.PrintingState == PrinterConnection.DetailedPrintingState.Printing, 8);
|
||||
testRunner.Delay();
|
||||
|
||||
// Values should remain after print completes
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ namespace MatterControl.Tests.MatterControl
|
|||
{
|
||||
double[] extruders = new double[16];
|
||||
double bed = 0;
|
||||
PrinterConnectionAndCommunication.ParseTemperatureString(gcodeString, extruders, null, ref bed, null);
|
||||
PrinterConnection.ParseTemperatureString(gcodeString, extruders, null, ref bed, null);
|
||||
Assert.IsTrue(extruders[0] == extruder0);
|
||||
Assert.IsTrue(extruders[1] == extruder1);
|
||||
Assert.IsTrue(extruders[2] == extruder2);
|
||||
|
|
|
|||
|
|
@ -429,7 +429,7 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
|
||||
public static void WaitForPrintFinished(this AutomationRunner testRunner)
|
||||
{
|
||||
testRunner.Delay(() => PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.FinishedPrint, 500);
|
||||
testRunner.Delay(() => PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.FinishedPrint, 500);
|
||||
}
|
||||
|
||||
public static async Task RunTest(
|
||||
|
|
@ -487,9 +487,9 @@ namespace MatterHackers.MatterControl.Tests.Automation
|
|||
|
||||
await AutomationRunner.ShowWindowAndExecuteTests(matterControlWindow, testMethod, maxTimeToRun, defaultTestImages, config.AutomationInputType, () =>
|
||||
{
|
||||
if (PrinterConnectionAndCommunication.Instance.CommunicationState == PrinterConnectionAndCommunication.CommunicationStates.Printing)
|
||||
if (PrinterConnection.Instance.CommunicationState == PrinterConnection.CommunicationStates.Printing)
|
||||
{
|
||||
PrinterConnectionAndCommunication.Instance.Disable();
|
||||
PrinterConnection.Instance.Disable();
|
||||
}
|
||||
|
||||
MatterControlApplication app = MatterControlApplication.Instance;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue