diff --git a/MatterControlLib/CustomWidgets/XyCalibrationCollectDataPage.cs b/MatterControlLib/CustomWidgets/XyCalibrationCollectDataPage.cs index d14d03c60..9f0995485 100644 --- a/MatterControlLib/CustomWidgets/XyCalibrationCollectDataPage.cs +++ b/MatterControlLib/CustomWidgets/XyCalibrationCollectDataPage.cs @@ -40,6 +40,7 @@ namespace MatterHackers.MatterControl private List xButtons; private XyCalibrationData xyCalibrationData; private List yButtons; + private bool HaveWrittenData = false; public XyCalibrationCollectDataPage(ISetupWizard setupWizard, PrinterConfig printer, XyCalibrationData xyCalibrationData) : base(setupWizard) @@ -108,7 +109,7 @@ namespace MatterHackers.MatterControl public override void OnClosed(EventArgs e) { // save the offsets to the extruder - if (!HasBeenClosed + if (!HaveWrittenData && xyCalibrationData.XPick != -1 && xyCalibrationData.YPick != -1) { @@ -117,6 +118,7 @@ namespace MatterHackers.MatterControl hotendOffset.Y -= xyCalibrationData.Offset * -2 + xyCalibrationData.Offset * xyCalibrationData.YPick; printer.Settings.Helpers.SetExtruderOffset(xyCalibrationData.ExtruderToCalibrateIndex, hotendOffset); + HaveWrittenData = true; } base.OnClosed(e); diff --git a/MatterControlLib/CustomWidgets/XyCalibrationStartPrintPage.cs b/MatterControlLib/CustomWidgets/XyCalibrationStartPrintPage.cs index fc1914fb0..383b54ac8 100644 --- a/MatterControlLib/CustomWidgets/XyCalibrationStartPrintPage.cs +++ b/MatterControlLib/CustomWidgets/XyCalibrationStartPrintPage.cs @@ -108,6 +108,7 @@ namespace MatterHackers.MatterControl private void RestoreBedAndClearPrinterCallbacks() { printer.Connection.Disposed -= Connection_Disposed; + printer.Connection.CommunicationStateChanged -= Connection_CommunicationStateChanged; } private void Connection_CommunicationStateChanged(object sender, EventArgs e)