diff --git a/ActionBar/ActionBarBaseControls.cs b/ActionBar/ActionBarBaseControls.cs index 3eb7a712f..dc330e7ef 100644 --- a/ActionBar/ActionBarBaseControls.cs +++ b/ActionBar/ActionBarBaseControls.cs @@ -162,7 +162,7 @@ namespace MatterHackers.MatterControl.ActionBar this.AddChild(textContainer); 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) diff --git a/ActionBar/HelpTextWidget.cs b/ActionBar/HelpTextWidget.cs index 148fe0eab..775b33083 100644 --- a/ActionBar/HelpTextWidget.cs +++ b/ActionBar/HelpTextWidget.cs @@ -76,7 +76,7 @@ namespace MatterHackers.MatterControl private void AddHandlers() { 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) diff --git a/ActionBar/PrintActionRow.cs b/ActionBar/PrintActionRow.cs index 63d2c7e3f..f2f5f385b 100644 --- a/ActionBar/PrintActionRow.cs +++ b/ActionBar/PrintActionRow.cs @@ -5,6 +5,7 @@ using System.IO; using MatterHackers.Agg; using MatterHackers.Agg.UI; using MatterHackers.Localizations; +using MatterHackers.MatterControl; using MatterHackers.MatterControl.DataStorage; using MatterHackers.MatterControl.PrintQueue; using MatterHackers.MatterControl.SlicerConfiguration; @@ -133,7 +134,7 @@ namespace MatterHackers.MatterControl.ActionBar protected override void AddHandlers() { 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); startButton.Click += new ButtonBase.ButtonEventHandler(onStartButton_Click); skipButton.Click += new ButtonBase.ButtonEventHandler(onSkipButton_Click); @@ -222,6 +223,18 @@ namespace MatterHackers.MatterControl.ActionBar string itemNotFoundMessage = "Item not found".Localize(); 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()) { string pathAndFile = PrinterCommunication.Instance.ActivePrintItem.FileLocation; @@ -229,7 +242,7 @@ namespace MatterHackers.MatterControl.ActionBar { 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); hideGCodeWaringCheckBox.HAnchor = Agg.UI.HAnchor.ParentCenter; diff --git a/ActionBar/PrintStatusRow.cs b/ActionBar/PrintStatusRow.cs index b52df4607..3665c4311 100644 --- a/ActionBar/PrintStatusRow.cs +++ b/ActionBar/PrintStatusRow.cs @@ -263,7 +263,7 @@ namespace MatterHackers.MatterControl.ActionBar protected void AddHandlers() { 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.ActivePrintItemChanged.RegisterEvent(onActivePrintItemChanged, ref unregisterEvents); } diff --git a/ActionBar/PrinterActionRow.cs b/ActionBar/PrinterActionRow.cs index a6a94cd1f..429ce3671 100644 --- a/ActionBar/PrinterActionRow.cs +++ b/ActionBar/PrinterActionRow.cs @@ -113,7 +113,7 @@ namespace MatterHackers.MatterControl.ActionBar ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(ReloadPrinterSelectionWidget, ref unregisterEvents); ActivePrinterProfile.Instance.ActivePrinterChanged.RegisterEvent(onActivePrinterChanged, ref unregisterEvents); PrinterCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); - PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); + PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); selectActivePrinterButton.Click += new ButtonBase.ButtonEventHandler(onSelectActivePrinterButton_Click); connectPrinterButton.Click += new ButtonBase.ButtonEventHandler(onConnectButton_Click); diff --git a/ConfigurationPage/ConfigurationPage.cs b/ConfigurationPage/ConfigurationPage.cs index 7dbf772d7..21eeeeb5e 100644 --- a/ConfigurationPage/ConfigurationPage.cs +++ b/ConfigurationPage/ConfigurationPage.cs @@ -510,11 +510,11 @@ namespace MatterHackers.MatterControl return printLevelingControlsContainer; } - private void OpenPrintLevelWizard() + public void OpenPrintLevelWizard() { if (printLevelWizardWindow == null) { - printLevelWizardWindow = new PrintLevelWizardWindow(); + printLevelWizardWindow = new PrintLevelWizardWindow(false); printLevelWizardWindow.Closed += (sender, e) => { printLevelWizardWindow = null; @@ -608,7 +608,7 @@ namespace MatterHackers.MatterControl private void AddHandlers() { 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); } diff --git a/ConfigurationPage/PrintLevelWizard.cs b/ConfigurationPage/PrintLevelWizard.cs index a9bb22b6a..d7a4e9111 100644 --- a/ConfigurationPage/PrintLevelWizard.cs +++ b/ConfigurationPage/PrintLevelWizard.cs @@ -323,32 +323,29 @@ namespace MatterHackers.MatterControl 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 pageOneInstructionsTextThree = LocalizedString.Get("Sample the bed at three points"); string pageOneInstructionsTextFour = LocalizedString.Get("Turn auto leveling on"); - string pageOneInstructionsTextFive = LocalizedString.Get("You should be done in about 3 minutes."); - string pageOneInstructionsTextSix = LocalizedString.Get("Click 'Next' to continue."); - string pageOneInstructions; + string pageOneInstructionsText5 = LocalizedString.Get("You should be done in about 3 minutes."); + string pageOneInstructionsText6 = LocalizedString.Get("Note: Be sure the tip of the extrude is clean."); + 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 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 homingPageInstructions; string doneInstructionsText = LocalizedString.Get("Congratulations!\n\nAuto Print Leveling is now configured and enabled."); 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 doneInstructions; WizardControl printLevelWizard; - public PrintLevelWizardWindow() + public PrintLevelWizardWindow(bool requiredForPrinter) : 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 printLevelWizardTitleFull = LocalizedString.Get ("Print Leveling Wizard"); Title = string.Format("{0} - {1}",printLevelWizardTitle, printLevelWizardTitleFull); @@ -361,7 +358,16 @@ namespace MatterHackers.MatterControl printLevelWizard.DoneButton.Click += new ButtonBase.ButtonEventHandler(DoneButton_Click); 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)); + + string homingPageInstructions = string.Format("{0}:\n\n\t• {1}\n\n{2}", homingPageInstructionsTextOne, homingPageInstructionsTextTwo, homingPageInstructionsTextThree); printLevelWizard.AddPage(new HomePrinterPage(homingPageInstructions)); 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 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)); } diff --git a/CustomWidgets/ExportPrintItemWindow.cs b/CustomWidgets/ExportPrintItemWindow.cs index 8b7b95171..aaf22927f 100644 --- a/CustomWidgets/ExportPrintItemWindow.cs +++ b/CustomWidgets/ExportPrintItemWindow.cs @@ -250,7 +250,7 @@ namespace MatterHackers.MatterControl PrintItemWrapper sliceItem = (PrintItemWrapper)sender; printItemWrapper.SlicingDone.UnregisterEvent(sliceItem_Done, ref unregisterEvents); - SaveGCodeToNewLocation(sliceItem.GCodePathAndFileName, pathAndFilenameToSave); + SaveGCodeToNewLocation(sliceItem.GetGCodePathAndFileName(), pathAndFilenameToSave); } } } diff --git a/CustomWidgets/PrintProgressBarWidget.cs b/CustomWidgets/PrintProgressBarWidget.cs index 81974ea7f..08d22c7ef 100644 --- a/CustomWidgets/PrintProgressBarWidget.cs +++ b/CustomWidgets/PrintProgressBarWidget.cs @@ -59,7 +59,7 @@ namespace MatterHackers.MatterControl { PrinterCommunication.Instance.WroteLine.RegisterEvent(Instance_WroteLine, 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); } diff --git a/DataStorage/Models.cs b/DataStorage/Models.cs index a58c6d685..0c022ef3d 100644 --- a/DataStorage/Models.cs +++ b/DataStorage/Models.cs @@ -375,6 +375,7 @@ namespace MatterHackers.MatterControl.DataStorage public string BaudRate { get; set; } public bool AutoConnectFlag { get; set; } //Auto connect to printer (if available) public bool DoPrintLeveling { get; set; } + public bool NeedsPrintLeveling { get; set; } // features public string _features { get; set; } diff --git a/PartPreviewWindow/View3DTransfromPart.cs b/PartPreviewWindow/View3DTransfromPart.cs index a5d86cd4e..1a244eec0 100644 --- a/PartPreviewWindow/View3DTransfromPart.cs +++ b/PartPreviewWindow/View3DTransfromPart.cs @@ -262,7 +262,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow if (!standAloneWindow) { - PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(SetEditControlsBasedOnPrinterState, ref unregisterEvents); + PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(SetEditControlsBasedOnPrinterState, ref unregisterEvents); } GuiWidget viewArea = new GuiWidget(); diff --git a/PartPreviewWindow/ViewGcodeBasic.cs b/PartPreviewWindow/ViewGcodeBasic.cs index 5aad44aa1..21214e0ee 100644 --- a/PartPreviewWindow/ViewGcodeBasic.cs +++ b/PartPreviewWindow/ViewGcodeBasic.cs @@ -152,7 +152,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow { if (File.Exists(printItem.FileLocation)) { - string gcodePathAndFileName = printItem.GCodePathAndFileName; + string gcodePathAndFileName = printItem.GetGCodePathAndFileName(); bool gcodeFileIsComplete = printItem.IsGCodeFileComplete(gcodePathAndFileName); if (printItem.SlicingHadError) @@ -521,6 +521,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow }; 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 && PrinterCommunication.Instance.ActivePrintItem == printItem) { @@ -528,6 +531,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow printItem.SlicingDone.UnregisterEvent(sliceItem_Done, ref unregisterEvents); 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; } - 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; diff --git a/PrintHistory/PrintHistoryListControl.cs b/PrintHistory/PrintHistoryListControl.cs index 615534555..cc29e491c 100644 --- a/PrintHistory/PrintHistoryListControl.cs +++ b/PrintHistory/PrintHistoryListControl.cs @@ -188,7 +188,7 @@ namespace MatterHackers.MatterControl.PrintHistory void AddHandlers() { - PrinterCommunication.Instance.ConnectionStateChanged.RegisterEvent(ReloadData, ref unregisterEvents); + PrinterCommunication.Instance.CommunicationStateChanged.RegisterEvent(ReloadData, ref unregisterEvents); } void ReloadData(object sender, EventArgs e) diff --git a/PrintQueue/OptionsMenu/ExportToFolderProcess.cs b/PrintQueue/OptionsMenu/ExportToFolderProcess.cs index f17a72b08..7c6da3943 100644 --- a/PrintQueue/OptionsMenu/ExportToFolderProcess.cs +++ b/PrintQueue/OptionsMenu/ExportToFolderProcess.cs @@ -134,7 +134,7 @@ namespace MatterHackers.MatterControl.PrintQueue sliceItem.SlicingOutputMessage.UnregisterEvent(printItemWrapper_SlicingOutputMessage, ref unregisterEvents); if (File.Exists(sliceItem.FileLocation)) { - savedGCodeFileNames.Add(sliceItem.GCodePathAndFileName); + savedGCodeFileNames.Add(sliceItem.GetGCodePathAndFileName()); } itemCountBeingWorkedOn++; diff --git a/PrintQueue/PrintItemWrapper.cs b/PrintQueue/PrintItemWrapper.cs index 1dc6c9dce..aad4cc9fd 100644 --- a/PrintQueue/PrintItemWrapper.cs +++ b/PrintQueue/PrintItemWrapper.cs @@ -188,7 +188,6 @@ namespace MatterHackers.MatterControl.PrintQueue } } - public string GCodePathAndFileName { get { return GetGCodePathAndFileName(); } } public string PartToSlicePathAndFileName { get { return PrintItem.FileLocation; } } public bool IsGCodeFileComplete(string gcodePathAndFileName) diff --git a/PrinterCommunication/PrinterCommunication.cs b/PrinterCommunication/PrinterCommunication.cs index 03276abae..540eec2ca 100644 --- a/PrinterCommunication/PrinterCommunication.cs +++ b/PrinterCommunication/PrinterCommunication.cs @@ -124,7 +124,7 @@ namespace MatterHackers.MatterControl public RootedObjectEventHandler CommunicationUnconditionalFromPrinter = new RootedObjectEventHandler(); public RootedObjectEventHandler CommunicationUnconditionalToPrinter = new RootedObjectEventHandler(); public RootedObjectEventHandler ConnectionFailed = new RootedObjectEventHandler(); - public RootedObjectEventHandler ConnectionStateChanged = new RootedObjectEventHandler(); + public RootedObjectEventHandler CommunicationStateChanged = new RootedObjectEventHandler(); public RootedObjectEventHandler ConnectionSucceeded = new RootedObjectEventHandler(); public RootedObjectEventHandler DestinationChanged = new RootedObjectEventHandler(); public RootedObjectEventHandler EnableChanged = new RootedObjectEventHandler(); @@ -207,7 +207,7 @@ namespace MatterHackers.MatterControl } communicationState = value; - OnConnectionStateChanged(null); + OnCommunicationStateChanged(null); } } } @@ -1224,9 +1224,9 @@ namespace MatterHackers.MatterControl 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) diff --git a/PrinterControls/ManualPrinterControls.cs b/PrinterControls/ManualPrinterControls.cs index 9485a9f14..1e19bb358 100644 --- a/PrinterControls/ManualPrinterControls.cs +++ b/PrinterControls/ManualPrinterControls.cs @@ -781,7 +781,7 @@ namespace MatterHackers.MatterControl private void AddHandlers() { 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); } diff --git a/PrinterControls/PrinterConnections/SetupStepComPortManual.cs b/PrinterControls/PrinterConnections/SetupStepComPortManual.cs index 6d8e4c504..24a9ddf71 100644 --- a/PrinterControls/PrinterConnections/SetupStepComPortManual.cs +++ b/PrinterControls/PrinterConnections/SetupStepComPortManual.cs @@ -45,7 +45,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections connectButton = textImageButtonFactory.Generate(LocalizedString.Get("Connect")); 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.Click += new ButtonBase.ButtonEventHandler(RefreshButton_Click); diff --git a/PrinterControls/PrinterConnections/SetupStepComPortTwo.cs b/PrinterControls/PrinterConnections/SetupStepComPortTwo.cs index 6691a5681..63f01989e 100644 --- a/PrinterControls/PrinterConnections/SetupStepComPortTwo.cs +++ b/PrinterControls/PrinterConnections/SetupStepComPortTwo.cs @@ -41,7 +41,7 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections connectButton = textImageButtonFactory.Generate(LocalizedString.Get("Connect")); 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(); hSpacer.HAnchor = HAnchor.ParentLeftRight; diff --git a/PrinterControls/PrinterConnections/SetupStepMakeModelName.cs b/PrinterControls/PrinterConnections/SetupStepMakeModelName.cs index 7fb6ba03d..595b30add 100644 --- a/PrinterControls/PrinterConnections/SetupStepMakeModelName.cs +++ b/PrinterControls/PrinterConnections/SetupStepMakeModelName.cs @@ -202,6 +202,13 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections 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; if (settingsDict.TryGetValue("default_slice_engine", out defaultSliceEngine)) { @@ -254,8 +261,6 @@ namespace MatterHackers.MatterControl.PrinterControls.PrinterConnections } } - - private Dictionary LoadPrinterSetupFromFile(string make, string model) { string setupSettingsPathAndFile = Path.Combine(ApplicationDataStorage.Instance.ApplicationStaticDataPath, "PrinterSettings", make, model, "setup.ini"); diff --git a/SlicerConfiguration/SliceSettingsWidget.cs b/SlicerConfiguration/SliceSettingsWidget.cs index 7d81576dd..5cbb1e84f 100644 --- a/SlicerConfiguration/SliceSettingsWidget.cs +++ b/SlicerConfiguration/SliceSettingsWidget.cs @@ -276,7 +276,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration event EventHandler unregisterEvents; 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); PrinterCommunication.Instance.EnableChanged.RegisterEvent(onPrinterStatusChanged, ref unregisterEvents); } diff --git a/SlicerConfiguration/SlicingQueue.cs b/SlicerConfiguration/SlicingQueue.cs index 1a1175ec5..9e2747701 100644 --- a/SlicerConfiguration/SlicingQueue.cs +++ b/SlicerConfiguration/SlicingQueue.cs @@ -187,7 +187,7 @@ namespace MatterHackers.MatterControl.SlicerConfiguration string currentConfigurationFileAndPath = Path.Combine(ApplicationDataStorage.Instance.GCodeOutputPath, "config_" + ActiveSliceSettings.Instance.GetHashCode().ToString() + ".ini"); ActiveSliceSettings.Instance.GenerateConfigFile(currentConfigurationFileAndPath); - string gcodePathAndFileName = itemToSlice.GCodePathAndFileName; + string gcodePathAndFileName = itemToSlice.GetGCodePathAndFileName(); bool gcodeFileIsComplete = itemToSlice.IsGCodeFileComplete(gcodePathAndFileName); if (!File.Exists(gcodePathAndFileName) || !gcodeFileIsComplete) diff --git a/StaticData/PrinterSettings/RoBo 3D/R1/config.ini b/StaticData/PrinterSettings/RoBo 3D/R1/config.ini index 6a59b55f4..6e9ff7791 100644 --- a/StaticData/PrinterSettings/RoBo 3D/R1/config.ini +++ b/StaticData/PrinterSettings/RoBo 3D/R1/config.ini @@ -106,7 +106,7 @@ solid_infill_extrusion_width = 0 solid_infill_speed = 60 spiral_vase = 0 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_non_overhang = 0 support_material = 1 diff --git a/StaticData/PrinterSettings/RoBo 3D/R1/setup.ini b/StaticData/PrinterSettings/RoBo 3D/R1/setup.ini index e3bc00dd7..4aba24a00 100644 --- a/StaticData/PrinterSettings/RoBo 3D/R1/setup.ini +++ b/StaticData/PrinterSettings/RoBo 3D/R1/setup.ini @@ -2,4 +2,5 @@ baud_rate = 250000 default_slice_engine = Slic3r windows_driver = CDM20824_Setup.exe default_material_presets = PLA -default_quality_preset = Medium \ No newline at end of file +default_quality_preset = Medium +needs_print_leveling = 1 \ No newline at end of file