Changed ConnectionStateChanged => CommunicationStateChanged

Put in support for running the print level wizard on first print.
Set the R1 to need print leveling
This commit is contained in:
larsbrubaker 2014-05-30 14:37:30 -07:00
parent 449678597a
commit 12650e854e
24 changed files with 84 additions and 43 deletions

View file

@ -162,7 +162,7 @@ namespace MatterHackers.MatterControl.ActionBar
this.AddChild(textContainer); this.AddChild(textContainer);
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(onActivePrinterChanged, ref unregisterEvents); ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(onActivePrinterChanged, ref unregisterEvents);
PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onActivePrinterChanged, ref unregisterEvents); PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onActivePrinterChanged, ref unregisterEvents);
} }
public override void OnClosed(EventArgs e) public override void OnClosed(EventArgs e)

View file

@ -76,7 +76,7 @@ namespace MatterHackers.MatterControl
private void AddHandlers() private void AddHandlers()
{ {
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
} }
public override void OnClosed(EventArgs e) public override void OnClosed(EventArgs e)

View file

@ -5,6 +5,7 @@ using System.IO;
using MatterHackers.Agg; using MatterHackers.Agg;
using MatterHackers.Agg.UI; using MatterHackers.Agg.UI;
using MatterHackers.Localizations; using MatterHackers.Localizations;
using MatterHackers.MatterControl;
using MatterHackers.MatterControl.DataStorage; using MatterHackers.MatterControl.DataStorage;
using MatterHackers.MatterControl.PrintQueue; using MatterHackers.MatterControl.PrintQueue;
using MatterHackers.MatterControl.SlicerConfiguration; using MatterHackers.MatterControl.SlicerConfiguration;
@ -133,7 +134,7 @@ namespace MatterHackers.MatterControl.ActionBar
protected override void AddHandlers() protected override void AddHandlers()
{ {
PrinterCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onStateChanged, ref unregisterEvents); PrinterCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onStateChanged, ref unregisterEvents);
PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onStateChanged, ref unregisterEvents); PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onStateChanged, ref unregisterEvents);
addButton.Click += new ButtonBase.ButtonEventHandler(onAddButton_Click); addButton.Click += new ButtonBase.ButtonEventHandler(onAddButton_Click);
startButton.Click += new ButtonBase.ButtonEventHandler(onStartButton_Click); startButton.Click += new ButtonBase.ButtonEventHandler(onStartButton_Click);
skipButton.Click += new ButtonBase.ButtonEventHandler(onSkipButton_Click); skipButton.Click += new ButtonBase.ButtonEventHandler(onSkipButton_Click);
@ -222,6 +223,18 @@ namespace MatterHackers.MatterControl.ActionBar
string itemNotFoundMessage = "Item not found".Localize(); string itemNotFoundMessage = "Item not found".Localize();
void PrintActivePart() void PrintActivePart()
{ {
if (ActivePrinterProfile.Instance.ActivePrinter.NeedsPrintLeveling
&& ActivePrinterProfile.Instance.GetPrintLevelingMeasuredPosition(0).z == 0
&& ActivePrinterProfile.Instance.GetPrintLevelingMeasuredPosition(1).z == 0
&& ActivePrinterProfile.Instance.GetPrintLevelingMeasuredPosition(2).z == 0)
{
PrintLevelWizardWindow printLevelWizardWindow = new PrintLevelWizardWindow(true);
printLevelWizardWindow.ShowAsSystemWindow();
return;
}
// else print as normal
if (ActiveSliceSettings.Instance.IsValid()) if (ActiveSliceSettings.Instance.IsValid())
{ {
string pathAndFile = PrinterCommunication.Instance.ActivePrintItem.FileLocation; string pathAndFile = PrinterCommunication.Instance.ActivePrintItem.FileLocation;
@ -229,7 +242,7 @@ namespace MatterHackers.MatterControl.ActionBar
{ {
string hideGCodeWarning = ApplicationSettings.Instance.get("HideGCodeWarning"); string hideGCodeWarning = ApplicationSettings.Instance.get("HideGCodeWarning");
if (Path.GetExtension(pathAndFile).ToUpper() == ".GCODE" && hideGCodeWarning == null ) if (Path.GetExtension(pathAndFile).ToUpper() == ".GCODE" && hideGCodeWarning == null)
{ {
CheckBox hideGCodeWaringCheckBox = new CheckBox(doNotShowAgainMessage); CheckBox hideGCodeWaringCheckBox = new CheckBox(doNotShowAgainMessage);
hideGCodeWaringCheckBox.HAnchor = Agg.UI.HAnchor.ParentCenter; hideGCodeWaringCheckBox.HAnchor = Agg.UI.HAnchor.ParentCenter;

View file

@ -263,7 +263,7 @@ namespace MatterHackers.MatterControl.ActionBar
protected void AddHandlers() protected void AddHandlers()
{ {
PrinterCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onPrintItemChanged, ref unregisterEvents); PrinterCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onPrintItemChanged, ref unregisterEvents);
PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onStateChanged, ref unregisterEvents); PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onStateChanged, ref unregisterEvents);
PrinterCommunication.Instance.WroteLine.RegisterEvent(Instance_WroteLine, ref unregisterEvents); PrinterCommunication.Instance.WroteLine.RegisterEvent(Instance_WroteLine, ref unregisterEvents);
PrinterCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents); PrinterCommunication.Instance.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents);
} }

View file

@ -113,7 +113,7 @@ namespace MatterHackers.MatterControl.ActionBar
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(ReloadPrinterSelectionWidget, ref unregisterEvents); ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(ReloadPrinterSelectionWidget, ref unregisterEvents);
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(onActivePrinterChanged, ref unregisterEvents); ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(onActivePrinterChanged, ref unregisterEvents);
PrinterCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); PrinterCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
selectActivePrinterButton.Click += new ButtonBase.ButtonEventHandler(onSelectActivePrinterButton_Click); selectActivePrinterButton.Click += new ButtonBase.ButtonEventHandler(onSelectActivePrinterButton_Click);
connectPrinterButton.Click += new ButtonBase.ButtonEventHandler(onConnectButton_Click); connectPrinterButton.Click += new ButtonBase.ButtonEventHandler(onConnectButton_Click);

View file

@ -510,11 +510,11 @@ namespace MatterHackers.MatterControl
return printLevelingControlsContainer; return printLevelingControlsContainer;
} }
private void OpenPrintLevelWizard() public void OpenPrintLevelWizard()
{ {
if (printLevelWizardWindow == null) if (printLevelWizardWindow == null)
{ {
printLevelWizardWindow = new PrintLevelWizardWindow(); printLevelWizardWindow = new PrintLevelWizardWindow(false);
printLevelWizardWindow.Closed += (sender, e) => printLevelWizardWindow.Closed += (sender, e) =>
{ {
printLevelWizardWindow = null; printLevelWizardWindow = null;
@ -608,7 +608,7 @@ namespace MatterHackers.MatterControl
private void AddHandlers() private void AddHandlers()
{ {
ActiveTheme.Instance.ThemeChanged.RegisterEvent(onThemeChanged, ref unregisterEvents); ActiveTheme.Instance.ThemeChanged.RegisterEvent(onThemeChanged, ref unregisterEvents);
PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
PrinterCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); PrinterCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
} }

View file

@ -323,32 +323,29 @@ namespace MatterHackers.MatterControl
public class PrintLevelWizardWindow : SystemWindow public class PrintLevelWizardWindow : SystemWindow
{ {
string pageOneInstructionsTextOne = LocalizedString.Get("Welcome to the print leveling wizard. Here is a quick overview on what we are going to do."); string requiredPageInstructions1 = "Congratulations on setting up your new printer. Before starting your first print we need to run a simple calibration procedure.";
string requiredPageInstructions2 = "The next few screens will walk your through the print leveling wizard.";
string pageOneInstructionsTextOne = LocalizedString.Get("Welcome to the print leveling wizard. Here is a quick overview on what we are going to do.");
string pageOneInstructionsTextTwo = LocalizedString.Get("'Home' the printer"); string pageOneInstructionsTextTwo = LocalizedString.Get("'Home' the printer");
string pageOneInstructionsTextThree = LocalizedString.Get("Sample the bed at three points"); string pageOneInstructionsTextThree = LocalizedString.Get("Sample the bed at three points");
string pageOneInstructionsTextFour = LocalizedString.Get("Turn auto leveling on"); string pageOneInstructionsTextFour = LocalizedString.Get("Turn auto leveling on");
string pageOneInstructionsTextFive = LocalizedString.Get("You should be done in about 3 minutes."); string pageOneInstructionsText5 = LocalizedString.Get("You should be done in about 3 minutes.");
string pageOneInstructionsTextSix = LocalizedString.Get("Click 'Next' to continue."); string pageOneInstructionsText6 = LocalizedString.Get("Note: Be sure the tip of the extrude is clean.");
string pageOneInstructions; string pageOneInstructionsText7 = LocalizedString.Get("Click 'Next' to continue.");
string homingPageInstructionsTextOne = LocalizedString.Get("The printer should now be 'homing'. Once it is finished homing we will move it to the first point to sample.\n\nTo complete the next few steps you will need"); string homingPageInstructionsTextOne = LocalizedString.Get("The printer should now be 'homing'. Once it is finished homing we will move it to the first point to sample.\n\nTo complete the next few steps you will need");
string homingPageInstructionsTextTwo = LocalizedString.Get("A standard sheet of paper"); string homingPageInstructionsTextTwo = LocalizedString.Get("A standard sheet of paper");
string homingPageInstructionsTextThree = LocalizedString.Get("We will use this paper to measure the distance between the extruder and the bed.\n\nClick 'Next' to continue."); string homingPageInstructionsTextThree = LocalizedString.Get("We will use this paper to measure the distance between the extruder and the bed.\n\nClick 'Next' to continue.");
string homingPageInstructions;
string doneInstructionsText = LocalizedString.Get("Congratulations!\n\nAuto Print Leveling is now configured and enabled."); string doneInstructionsText = LocalizedString.Get("Congratulations!\n\nAuto Print Leveling is now configured and enabled.");
string doneInstructionsTextTwo = LocalizedString.Get("Remove the paper"); string doneInstructionsTextTwo = LocalizedString.Get("Remove the paper");
string doneInstructionsTextThree = LocalizedString.Get("If in the future you wish to turn Auto Print Leveling off, you can uncheck the 'Enabled' button found in 'Advanced Settings'->'Printer Controls'.\n\nClick 'Done' to close this window."); string doneInstructionsTextThree = LocalizedString.Get("If in the future you wish to turn Auto Print Leveling off, you can uncheck the 'Enabled' button found in 'Advanced Settings'->'Printer Controls'.\n\nClick 'Done' to close this window.");
string doneInstructions;
WizardControl printLevelWizard; WizardControl printLevelWizard;
public PrintLevelWizardWindow() public PrintLevelWizardWindow(bool requiredForPrinter)
: base(500, 370) : base(500, 370)
{ {
pageOneInstructions = string.Format("{0}\n\n\t• {1}\n\t• {2}\n\t• {3}\n\n{4}\n\n{5}",pageOneInstructionsTextOne, pageOneInstructionsTextTwo, pageOneInstructionsTextThree, pageOneInstructionsTextFour, pageOneInstructionsTextFive, pageOneInstructionsTextSix);
homingPageInstructions = string.Format("{0}:\n\n\t• {1}\n\n{2}", homingPageInstructionsTextOne, homingPageInstructionsTextTwo, homingPageInstructionsTextThree);
doneInstructions = string.Format("{0}\n\n\t• {1}\n\n{2}",doneInstructionsText, doneInstructionsTextTwo, doneInstructionsTextThree);
string printLevelWizardTitle = LocalizedString.Get("MatterControl"); string printLevelWizardTitle = LocalizedString.Get("MatterControl");
string printLevelWizardTitleFull = LocalizedString.Get ("Print Leveling Wizard"); string printLevelWizardTitleFull = LocalizedString.Get ("Print Leveling Wizard");
Title = string.Format("{0} - {1}",printLevelWizardTitle, printLevelWizardTitleFull); Title = string.Format("{0} - {1}",printLevelWizardTitle, printLevelWizardTitleFull);
@ -361,7 +358,16 @@ namespace MatterHackers.MatterControl
printLevelWizard.DoneButton.Click += new ButtonBase.ButtonEventHandler(DoneButton_Click); printLevelWizard.DoneButton.Click += new ButtonBase.ButtonEventHandler(DoneButton_Click);
AddChild(printLevelWizard); AddChild(printLevelWizard);
if(requiredForPrinter)
{
string requiredPageInstructions = "{0}\n\n{1}".FormatWith(requiredPageInstructions1, requiredPageInstructions2);
printLevelWizard.AddPage(new FirstPageInstructions(requiredPageInstructions));
}
string pageOneInstructions = string.Format("{0}\n\n\t• {1}\n\t• {2}\n\t• {3}\n\n{4}\n\n{5}\n\n{6}", pageOneInstructionsTextOne, pageOneInstructionsTextTwo, pageOneInstructionsTextThree, pageOneInstructionsTextFour, pageOneInstructionsText5, pageOneInstructionsText6, pageOneInstructionsText7);
printLevelWizard.AddPage(new FirstPageInstructions(pageOneInstructions)); printLevelWizard.AddPage(new FirstPageInstructions(pageOneInstructions));
string homingPageInstructions = string.Format("{0}:\n\n\t• {1}\n\n{2}", homingPageInstructionsTextOne, homingPageInstructionsTextTwo, homingPageInstructionsTextThree);
printLevelWizard.AddPage(new HomePrinterPage(homingPageInstructions)); printLevelWizard.AddPage(new HomePrinterPage(homingPageInstructions));
Vector2 probeBackCenter = ActiveSliceSettings.Instance.GetPrintLevelPositionToSample(0); Vector2 probeBackCenter = ActiveSliceSettings.Instance.GetPrintLevelPositionToSample(0);
@ -398,6 +404,7 @@ namespace MatterHackers.MatterControl
printLevelWizard.AddPage(new GetFineBedHeight(string.Format("{0} {1} 3 - {2}", Step(),positionLabelThree, medPrecisionLabelThree ), probePositions[2])); printLevelWizard.AddPage(new GetFineBedHeight(string.Format("{0} {1} 3 - {2}", Step(),positionLabelThree, medPrecisionLabelThree ), probePositions[2]));
printLevelWizard.AddPage(new GetUltraFineBedHeight(string.Format("{0} {1} 3 - {2}", Step(), positionLabelThree, highPrecisionLabelThree ), probePositions[2])); printLevelWizard.AddPage(new GetUltraFineBedHeight(string.Format("{0} {1} 3 - {2}", Step(), positionLabelThree, highPrecisionLabelThree ), probePositions[2]));
string doneInstructions = string.Format("{0}\n\n\t• {1}\n\n{2}",doneInstructionsText, doneInstructionsTextTwo, doneInstructionsTextThree);
printLevelWizard.AddPage(new LastPageInstructions(doneInstructions, probePositions)); printLevelWizard.AddPage(new LastPageInstructions(doneInstructions, probePositions));
} }

View file

@ -250,7 +250,7 @@ namespace MatterHackers.MatterControl
PrintItemWrapper sliceItem = (PrintItemWrapper)sender; PrintItemWrapper sliceItem = (PrintItemWrapper)sender;
printItemWrapper.SlicingDone.UnregisterEvent(sliceItem_Done, ref unregisterEvents); printItemWrapper.SlicingDone.UnregisterEvent(sliceItem_Done, ref unregisterEvents);
SaveGCodeToNewLocation(sliceItem.GCodePathAndFileName, pathAndFilenameToSave); SaveGCodeToNewLocation(sliceItem.GetGCodePathAndFileName(), pathAndFilenameToSave);
} }
} }
} }

View file

@ -59,7 +59,7 @@ namespace MatterHackers.MatterControl
{ {
PrinterCommunication.Instance.WroteLine.RegisterEvent(Instance_WroteLine, ref unregisterEvents); PrinterCommunication.Instance.WroteLine.RegisterEvent(Instance_WroteLine, ref unregisterEvents);
PrinterCommunication.Instance.ActivePrintItemChanged.RegisterEvent(Instance_PrintItemChanged, ref unregisterEvents); PrinterCommunication.Instance.ActivePrintItemChanged.RegisterEvent(Instance_PrintItemChanged, ref unregisterEvents);
PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(Instance_PrintItemChanged, ref unregisterEvents); PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(Instance_PrintItemChanged, ref unregisterEvents);
ActiveTheme.Instance.ThemeChanged.RegisterEvent(onThemeChanged, ref unregisterEvents); ActiveTheme.Instance.ThemeChanged.RegisterEvent(onThemeChanged, ref unregisterEvents);
} }

View file

@ -375,6 +375,7 @@ namespace MatterHackers.MatterControl.DataStorage
public string BaudRate { get; set; } public string BaudRate { get; set; }
public bool AutoConnectFlag { get; set; } //Auto connect to printer (if available) public bool AutoConnectFlag { get; set; } //Auto connect to printer (if available)
public bool DoPrintLeveling { get; set; } public bool DoPrintLeveling { get; set; }
public bool NeedsPrintLeveling { get; set; }
// features // features
public string _features { get; set; } public string _features { get; set; }

View file

@ -262,7 +262,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
if (!standAloneWindow) if (!standAloneWindow)
{ {
PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(SetEditControlsBasedOnPrinterState, ref unregisterEvents); PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(SetEditControlsBasedOnPrinterState, ref unregisterEvents);
} }
GuiWidget viewArea = new GuiWidget(); GuiWidget viewArea = new GuiWidget();

View file

@ -152,7 +152,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
{ {
if (File.Exists(printItem.FileLocation)) if (File.Exists(printItem.FileLocation))
{ {
string gcodePathAndFileName = printItem.GCodePathAndFileName; string gcodePathAndFileName = printItem.GetGCodePathAndFileName();
bool gcodeFileIsComplete = printItem.IsGCodeFileComplete(gcodePathAndFileName); bool gcodeFileIsComplete = printItem.IsGCodeFileComplete(gcodePathAndFileName);
if (printItem.SlicingHadError) if (printItem.SlicingHadError)
@ -521,6 +521,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}; };
layerInfoContainer.AddChild(syncToPrint); layerInfoContainer.AddChild(syncToPrint);
// The idea here is we just got asked to rebuild the window (and it is being created now)
// because the gcode finished creating for the print that is printing.
// We don't want to be notified if any other updates happen to this gcode while it is printing.
if (PrinterCommunication.Instance.PrinterIsPrinting if (PrinterCommunication.Instance.PrinterIsPrinting
&& PrinterCommunication.Instance.ActivePrintItem == printItem) && PrinterCommunication.Instance.ActivePrintItem == printItem)
{ {
@ -528,6 +531,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
printItem.SlicingDone.UnregisterEvent(sliceItem_Done, ref unregisterEvents); printItem.SlicingDone.UnregisterEvent(sliceItem_Done, ref unregisterEvents);
generateGCodeButton.Visible = false; generateGCodeButton.Visible = false;
// However if the print finished or is canceled we are going to want to get updates again. So, hook the status event
PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(HookUpGCodeMessagesWhenDonePrinting, ref unregisterEvents);
} }
} }
@ -538,9 +544,18 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
textImageButtonFactory.FixedWidth = oldWidth; textImageButtonFactory.FixedWidth = oldWidth;
} }
public override void OnParentChanged(EventArgs e) void HookUpGCodeMessagesWhenDonePrinting(object sender, EventArgs e)
{ {
base.OnParentChanged(e); if(!PrinterCommunication.Instance.PrinterIsPaused && !PrinterCommunication.Instance.PrinterIsPrinting)
{
// unregister first to make sure we don't double up in error (should not be needed but no harm)
printItem.SlicingOutputMessage.UnregisterEvent(sliceItem_SlicingOutputMessage, ref unregisterEvents);
printItem.SlicingDone.UnregisterEvent(sliceItem_Done, ref unregisterEvents);
// register for done slicing and slicing messages
printItem.SlicingOutputMessage.RegisterEvent(sliceItem_SlicingOutputMessage, ref unregisterEvents);
printItem.SlicingDone.RegisterEvent(sliceItem_Done, ref unregisterEvents);
}
} }
string partToStartLoadingOnFirstDraw = null; string partToStartLoadingOnFirstDraw = null;

View file

@ -188,7 +188,7 @@ namespace MatterHackers.MatterControl.PrintHistory
void AddHandlers() void AddHandlers()
{ {
PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(ReloadData, ref unregisterEvents); PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(ReloadData, ref unregisterEvents);
} }
void ReloadData(object sender, EventArgs e) void ReloadData(object sender, EventArgs e)

View file

@ -134,7 +134,7 @@ namespace MatterHackers.MatterControl.PrintQueue
sliceItem.SlicingOutputMessage.UnregisterEvent(printItemWrapper_SlicingOutputMessage, ref unregisterEvents); sliceItem.SlicingOutputMessage.UnregisterEvent(printItemWrapper_SlicingOutputMessage, ref unregisterEvents);
if (File.Exists(sliceItem.FileLocation)) if (File.Exists(sliceItem.FileLocation))
{ {
savedGCodeFileNames.Add(sliceItem.GCodePathAndFileName); savedGCodeFileNames.Add(sliceItem.GetGCodePathAndFileName());
} }
itemCountBeingWorkedOn++; itemCountBeingWorkedOn++;

View file

@ -188,7 +188,6 @@ namespace MatterHackers.MatterControl.PrintQueue
} }
} }
public string GCodePathAndFileName { get { return GetGCodePathAndFileName(); } }
public string PartToSlicePathAndFileName { get { return PrintItem.FileLocation; } } public string PartToSlicePathAndFileName { get { return PrintItem.FileLocation; } }
public bool IsGCodeFileComplete(string gcodePathAndFileName) public bool IsGCodeFileComplete(string gcodePathAndFileName)

View file

@ -124,7 +124,7 @@ namespace MatterHackers.MatterControl
public RootedObjectEventHandler CommunicationUnconditionalFromPrinter = new RootedObjectEventHandler(); public RootedObjectEventHandler CommunicationUnconditionalFromPrinter = new RootedObjectEventHandler();
public RootedObjectEventHandler CommunicationUnconditionalToPrinter = new RootedObjectEventHandler(); public RootedObjectEventHandler CommunicationUnconditionalToPrinter = new RootedObjectEventHandler();
public RootedObjectEventHandler ConnectionFailed = new RootedObjectEventHandler(); public RootedObjectEventHandler ConnectionFailed = new RootedObjectEventHandler();
public RootedObjectEventHandler ConnectionStateChanged = new RootedObjectEventHandler(); public RootedObjectEventHandler CommunicationStateChanged = new RootedObjectEventHandler();
public RootedObjectEventHandler ConnectionSucceeded = new RootedObjectEventHandler(); public RootedObjectEventHandler ConnectionSucceeded = new RootedObjectEventHandler();
public RootedObjectEventHandler DestinationChanged = new RootedObjectEventHandler(); public RootedObjectEventHandler DestinationChanged = new RootedObjectEventHandler();
public RootedObjectEventHandler EnableChanged = new RootedObjectEventHandler(); public RootedObjectEventHandler EnableChanged = new RootedObjectEventHandler();
@ -207,7 +207,7 @@ namespace MatterHackers.MatterControl
} }
communicationState = value; communicationState = value;
OnConnectionStateChanged(null); OnCommunicationStateChanged(null);
} }
} }
} }
@ -1224,9 +1224,9 @@ namespace MatterHackers.MatterControl
OnEnabledChanged(e); OnEnabledChanged(e);
} }
public void OnConnectionStateChanged(EventArgs e) public void OnCommunicationStateChanged(EventArgs e)
{ {
ConnectionStateChanged.CallEvents(this, e); CommunicationStateChanged.CallEvents(this, e);
} }
public void OnConnectionFailed(EventArgs e) public void OnConnectionFailed(EventArgs e)

View file

@ -781,7 +781,7 @@ namespace MatterHackers.MatterControl
private void AddHandlers() private void AddHandlers()
{ {
ActiveTheme.Instance.ThemeChanged.RegisterEvent(onThemeChanged, ref unregisterEvents); ActiveTheme.Instance.ThemeChanged.RegisterEvent(onThemeChanged, ref unregisterEvents);
PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
PrinterCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); PrinterCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
} }

View file

@ -45,7 +45,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
connectButton = textImageButtonFactory.Generate(LocalizedString.Get("Connect")); connectButton = textImageButtonFactory.Generate(LocalizedString.Get("Connect"));
connectButton.Click += new ButtonBase.ButtonEventHandler(ConnectButton_Click); connectButton.Click += new ButtonBase.ButtonEventHandler(ConnectButton_Click);
PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
refreshButton = textImageButtonFactory.Generate(LocalizedString.Get("Refresh")); refreshButton = textImageButtonFactory.Generate(LocalizedString.Get("Refresh"));
refreshButton.Click += new ButtonBase.ButtonEventHandler(RefreshButton_Click); refreshButton.Click += new ButtonBase.ButtonEventHandler(RefreshButton_Click);

View file

@ -41,7 +41,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
connectButton = textImageButtonFactory.Generate(LocalizedString.Get("Connect")); connectButton = textImageButtonFactory.Generate(LocalizedString.Get("Connect"));
connectButton.Click += new ButtonBase.ButtonEventHandler(ConnectButton_Click); connectButton.Click += new ButtonBase.ButtonEventHandler(ConnectButton_Click);
PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
GuiWidget hSpacer = new GuiWidget(); GuiWidget hSpacer = new GuiWidget();
hSpacer.HAnchor = HAnchor.ParentLeftRight; hSpacer.HAnchor = HAnchor.ParentLeftRight;

View file

@ -202,6 +202,13 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
ActivePrinter.BaudRate = baudRate; ActivePrinter.BaudRate = baudRate;
} }
// Check if we need to run the print level wizard before printing
string needsPrintLeveling;
if (settingsDict.TryGetValue("needs_print_leveling", out needsPrintLeveling))
{
ActivePrinter.NeedsPrintLeveling = true;
}
string defaultSliceEngine; string defaultSliceEngine;
if (settingsDict.TryGetValue("default_slice_engine", out defaultSliceEngine)) if (settingsDict.TryGetValue("default_slice_engine", out defaultSliceEngine))
{ {
@ -254,8 +261,6 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections
} }
} }
private Dictionary<string, string> LoadPrinterSetupFromFile(string make, string model) private Dictionary<string, string> LoadPrinterSetupFromFile(string make, string model)
{ {
string setupSettingsPathAndFile = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "PrinterSettings", make, model, "setup.ini"); string setupSettingsPathAndFile = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "PrinterSettings", make, model, "setup.ini");

View file

@ -276,7 +276,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
event EventHandler unregisterEvents; event EventHandler unregisterEvents;
private void AddHandlers() private void AddHandlers()
{ {
PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(APP_onPrinterStatusChanged, ref unregisterEvents); ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(APP_onPrinterStatusChanged, ref unregisterEvents);
PrinterCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); PrinterCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents);
} }

View file

@ -187,7 +187,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration
string currentConfigurationFileAndPath = Path.Combine(ApplicationDataStorage.Instance.GCodeOutputPath, "config_" + ActiveSliceSettings.Instance.GetHashCode().ToString() + ".ini"); string currentConfigurationFileAndPath = Path.Combine(ApplicationDataStorage.Instance.GCodeOutputPath, "config_" + ActiveSliceSettings.Instance.GetHashCode().ToString() + ".ini");
ActiveSliceSettings.Instance.GenerateConfigFile(currentConfigurationFileAndPath); ActiveSliceSettings.Instance.GenerateConfigFile(currentConfigurationFileAndPath);
string gcodePathAndFileName = itemToSlice.GCodePathAndFileName; string gcodePathAndFileName = itemToSlice.GetGCodePathAndFileName();
bool gcodeFileIsComplete = itemToSlice.IsGCodeFileComplete(gcodePathAndFileName); bool gcodeFileIsComplete = itemToSlice.IsGCodeFileComplete(gcodePathAndFileName);
if (!File.Exists(gcodePathAndFileName) || !gcodeFileIsComplete) if (!File.Exists(gcodePathAndFileName) || !gcodeFileIsComplete)

View file

@ -106,7 +106,7 @@ solid_infill_extrusion_width = 0
solid_infill_speed = 60 solid_infill_speed = 60
spiral_vase = 0 spiral_vase = 0
standby_temperature_delta = -5 standby_temperature_delta = -5
start_gcode = G28 ; home all axes\nG1 Z5 F5000 ; lift nozzle\nM109 S[temperature] ; set the extruder temp and wait\nM565 Z-1 ; Set the probe offset\nG29 ; probe bed\n start_gcode = G28 ; home all axes\nG1 Z5 F5000 ; lift nozzle\nM109 S[temperature] ; set the extruder temp and wait\nG28 Z0 ; Home Z again in case there was filament on nozzle\n
start_perimeters_at_concave_points = 0 start_perimeters_at_concave_points = 0
start_perimeters_at_non_overhang = 0 start_perimeters_at_non_overhang = 0
support_material = 1 support_material = 1

View file

@ -2,4 +2,5 @@ baud_rate = 250000
default_slice_engine = Slic3r default_slice_engine = Slic3r
windows_driver = CDM20824_Setup.exe windows_driver = CDM20824_Setup.exe
default_material_presets = PLA default_material_presets = PLA
default_quality_preset = Medium default_quality_preset = Medium
needs_print_leveling = 1