diff --git a/MatterControlLib/CustomWidgets/XyCalibrationCollectDataPage.cs b/MatterControlLib/CustomWidgets/XyCalibrationCollectDataPage.cs index 9f0995485..3ab460d65 100644 --- a/MatterControlLib/CustomWidgets/XyCalibrationCollectDataPage.cs +++ b/MatterControlLib/CustomWidgets/XyCalibrationCollectDataPage.cs @@ -41,6 +41,7 @@ namespace MatterHackers.MatterControl private XyCalibrationData xyCalibrationData; private List yButtons; private bool HaveWrittenData = false; + private bool pageCanceled; public XyCalibrationCollectDataPage(ISetupWizard setupWizard, PrinterConfig printer, XyCalibrationData xyCalibrationData) : base(setupWizard) @@ -66,11 +67,13 @@ namespace MatterHackers.MatterControl }; contentRow.AddChild(xButtonsGroup); xButtons = new List(); + xButtons.Add(new RadioButton("-3".Localize(), textColor: theme.TextColor, fontSize: theme.DefaultFontSize)); xButtons.Add(new RadioButton("-2".Localize(), textColor: theme.TextColor, fontSize: theme.DefaultFontSize)); xButtons.Add(new RadioButton("-1".Localize(), textColor: theme.TextColor, fontSize: theme.DefaultFontSize)); xButtons.Add(new RadioButton(" 0".Localize(), textColor: theme.TextColor, fontSize: theme.DefaultFontSize)); xButtons.Add(new RadioButton("+1".Localize(), textColor: theme.TextColor, fontSize: theme.DefaultFontSize)); xButtons.Add(new RadioButton("+2".Localize(), textColor: theme.TextColor, fontSize: theme.DefaultFontSize)); + xButtons.Add(new RadioButton("+3".Localize(), textColor: theme.TextColor, fontSize: theme.DefaultFontSize)); foreach (var button in xButtons) { xButtonsGroup.AddChild(button); @@ -84,11 +87,13 @@ namespace MatterHackers.MatterControl contentRow.AddChild(yButtonsGroup); yButtonsGroup.AddChild(new GuiWidget(24 * GuiWidget.DeviceScale, 16)); yButtons = new List(); + yButtons.Add(new RadioButton("-3".Localize(), textColor: theme.TextColor, fontSize: theme.DefaultFontSize)); yButtons.Add(new RadioButton("-2".Localize(), textColor: theme.TextColor, fontSize: theme.DefaultFontSize)); yButtons.Add(new RadioButton("-1".Localize(), textColor: theme.TextColor, fontSize: theme.DefaultFontSize)); yButtons.Add(new RadioButton(" 0".Localize(), textColor: theme.TextColor, fontSize: theme.DefaultFontSize)); yButtons.Add(new RadioButton("+1".Localize(), textColor: theme.TextColor, fontSize: theme.DefaultFontSize)); yButtons.Add(new RadioButton("+2".Localize(), textColor: theme.TextColor, fontSize: theme.DefaultFontSize)); + yButtons.Add(new RadioButton("+3".Localize(), textColor: theme.TextColor, fontSize: theme.DefaultFontSize)); foreach (var button in yButtons) { var column = new FlowLayoutWidget(FlowDirection.TopToBottom); @@ -106,16 +111,23 @@ namespace MatterHackers.MatterControl } } + protected override void OnCancel(out bool abortCancel) + { + pageCanceled = true; + base.OnCancel(out abortCancel); + } + public override void OnClosed(EventArgs e) { // save the offsets to the extruder - if (!HaveWrittenData + if (!pageCanceled + && !HaveWrittenData && xyCalibrationData.XPick != -1 && xyCalibrationData.YPick != -1) { var hotendOffset = printer.Settings.Helpers.ExtruderOffset(xyCalibrationData.ExtruderToCalibrateIndex); - hotendOffset.X -= xyCalibrationData.Offset * -2 + xyCalibrationData.Offset * xyCalibrationData.XPick; - hotendOffset.Y -= xyCalibrationData.Offset * -2 + xyCalibrationData.Offset * xyCalibrationData.YPick; + hotendOffset.X -= xyCalibrationData.Offset * -3 + xyCalibrationData.Offset * xyCalibrationData.XPick; + hotendOffset.Y -= xyCalibrationData.Offset * -3 + xyCalibrationData.Offset * xyCalibrationData.YPick; printer.Settings.Helpers.SetExtruderOffset(xyCalibrationData.ExtruderToCalibrateIndex, hotendOffset); HaveWrittenData = true; diff --git a/MatterControlLib/CustomWidgets/XyCalibrationDataRecieved.cs b/MatterControlLib/CustomWidgets/XyCalibrationDataRecieved.cs index ab3299eeb..77457195b 100644 --- a/MatterControlLib/CustomWidgets/XyCalibrationDataRecieved.cs +++ b/MatterControlLib/CustomWidgets/XyCalibrationDataRecieved.cs @@ -49,9 +49,9 @@ namespace MatterHackers.MatterControl // check if we picked an outside of the calibration if (xyCalibrationData.XPick == 0 - || xyCalibrationData.XPick == 4 + || xyCalibrationData.XPick == 6 || xyCalibrationData.YPick == 0 - || xyCalibrationData.YPick == 4) + || xyCalibrationData.YPick == 6) { // offer to re-run the calibration with the same settings as last time contentRow.AddChild(new TextWidget("Your printer has been ajusted but we need to run callibration again to improve accuracy.".Localize(), textColor: theme.TextColor, pointSize: theme.DefaultFontSize) diff --git a/MatterControlLib/CustomWidgets/XyCalibrationSelectPage.cs b/MatterControlLib/CustomWidgets/XyCalibrationSelectPage.cs index ccab3abc8..8425c21d0 100644 --- a/MatterControlLib/CustomWidgets/XyCalibrationSelectPage.cs +++ b/MatterControlLib/CustomWidgets/XyCalibrationSelectPage.cs @@ -31,6 +31,7 @@ using System.Collections.Generic; using MatterHackers.Agg.UI; using MatterHackers.Localizations; using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling; +using MatterHackers.MatterControl.SlicerConfiguration; namespace MatterHackers.MatterControl { @@ -48,6 +49,8 @@ namespace MatterHackers.MatterControl this.Name = "Nozzle Offset Calibration Wizard"; contentRow.Padding = theme.DefaultContainerPadding; + // default to normal offset + xyCalibrationData.Offset = printer.Settings.GetValue(SettingsKey.nozzle_diameter) / 3.0; contentRow.AddChild(new TextWidget("Choose the calibration you would like to perform.".Localize(), textColor: theme.TextColor, pointSize: theme.DefaultFontSize) { @@ -61,7 +64,7 @@ namespace MatterHackers.MatterControl coarseCalibration.CheckedStateChanged += (s, e) => { xyCalibrationData.Quality = XyCalibrationData.QualityType.Coarse; - xyCalibrationData.Offset = .5; + xyCalibrationData.Offset = printer.Settings.GetValue(SettingsKey.nozzle_diameter); }; contentRow.AddChild(normalCalibration = new RadioButton("Normal Calibration: Start here".Localize(), textColor: theme.TextColor, fontSize: theme.DefaultFontSize) { @@ -70,7 +73,7 @@ namespace MatterHackers.MatterControl normalCalibration.CheckedStateChanged += (s, e) => { xyCalibrationData.Quality = XyCalibrationData.QualityType.Normal; - xyCalibrationData.Offset = .1; + xyCalibrationData.Offset = printer.Settings.GetValue(SettingsKey.nozzle_diameter) / 3.0; }; contentRow.AddChild(fineCalibration = new RadioButton("Fine Calibration: When you want that extra precision".Localize(), textColor: theme.TextColor, fontSize: theme.DefaultFontSize) { @@ -79,7 +82,7 @@ namespace MatterHackers.MatterControl fineCalibration.CheckedStateChanged += (s, e) => { xyCalibrationData.Quality = XyCalibrationData.QualityType.Fine; - xyCalibrationData.Offset = .05; + xyCalibrationData.Offset = printer.Settings.GetValue(SettingsKey.nozzle_diameter) / 9.0; }; } } diff --git a/MatterControlLib/CustomWidgets/XyCalibrationStartPrintPage.cs b/MatterControlLib/CustomWidgets/XyCalibrationStartPrintPage.cs index 383b54ac8..3b278aef0 100644 --- a/MatterControlLib/CustomWidgets/XyCalibrationStartPrintPage.cs +++ b/MatterControlLib/CustomWidgets/XyCalibrationStartPrintPage.cs @@ -158,25 +158,17 @@ namespace MatterHackers.MatterControl case XyCalibrationData.QualityType.Coarse: item = XyCalibrationTabObject3D.Create(1, Math.Max(printer.Settings.GetValue(SettingsKey.first_layer_height) * 2, printer.Settings.GetValue(SettingsKey.layer_height) * 2), - .5, + xyCalibrationData.Offset, printer.Settings.GetValue(SettingsKey.nozzle_diameter)).GetAwaiter().GetResult(); break; + case XyCalibrationData.QualityType.Normal: case XyCalibrationData.QualityType.Fine: - item = XyCalibrationFaceObject3D.Create(1, - printer.Settings.GetValue(SettingsKey.first_layer_height) * 2, - printer.Settings.GetValue(SettingsKey.layer_height), - .05, - printer.Settings.GetValue(SettingsKey.nozzle_diameter), - printer.Settings.GetValue(SettingsKey.wipe_tower_size), - 6).GetAwaiter().GetResult(); - break; - default: item = XyCalibrationFaceObject3D.Create(1, printer.Settings.GetValue(SettingsKey.first_layer_height) * 2, printer.Settings.GetValue(SettingsKey.layer_height), - .1, + xyCalibrationData.Offset, printer.Settings.GetValue(SettingsKey.nozzle_diameter), printer.Settings.GetValue(SettingsKey.wipe_tower_size), 6).GetAwaiter().GetResult(); diff --git a/MatterControlLib/DesignTools/Primitives/XyCalibrationFaceObject3D.cs b/MatterControlLib/DesignTools/Primitives/XyCalibrationFaceObject3D.cs index 959f78551..5c474a615 100644 --- a/MatterControlLib/DesignTools/Primitives/XyCalibrationFaceObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/XyCalibrationFaceObject3D.cs @@ -146,7 +146,8 @@ namespace MatterHackers.MatterControl.DesignTools var shape = new VertexStorage(); shape.MoveTo(0, 0); // left + spaces + blocks + right - var baseWidth = (2 * spaceBetween) + (4 * spaceBetween) + (5 * TabWidth) + (2 * spaceBetween); + var sampleCount = 7; + var baseWidth = (2 * spaceBetween) + ((sampleCount - 1) * spaceBetween) + (sampleCount * TabWidth) + (2 * spaceBetween); shape.LineTo(baseWidth, 0); if (calibrateX) { @@ -174,7 +175,7 @@ namespace MatterHackers.MatterControl.DesignTools var position = new Vector2(TabWidth / 2 + 2 * spaceBetween, TabDepth / 2 - Offset * 2); var step = new Vector2(spaceBetween + TabWidth, Offset); - for (int i = 0; i < 5; i++) + for (int i = 0; i < sampleCount; i++) { var offsetMultiple = i - 2; for (int j = 0; j < Layers; j++) diff --git a/MatterControlLib/DesignTools/Primitives/XyCalibrationTabObject3D.cs b/MatterControlLib/DesignTools/Primitives/XyCalibrationTabObject3D.cs index 665298d5a..de1631335 100644 --- a/MatterControlLib/DesignTools/Primitives/XyCalibrationTabObject3D.cs +++ b/MatterControlLib/DesignTools/Primitives/XyCalibrationTabObject3D.cs @@ -140,7 +140,8 @@ namespace MatterHackers.MatterControl.DesignTools var shape = new VertexStorage(); shape.MoveTo(0, 0); // left + spaces + blocks + right - var baseWidth = (2 * spaceBetween) + (4 * spaceBetween) + (5 * TabWidth) + (2 * spaceBetween); + var sampleCount = 7; + var baseWidth = (2 * spaceBetween) + ((sampleCount - 1) * spaceBetween) + (sampleCount * TabWidth) + (2 * spaceBetween); shape.LineTo(baseWidth, 0); if (calibrateX) { @@ -168,7 +169,7 @@ namespace MatterHackers.MatterControl.DesignTools var position = new Vector2(TabWidth / 2 + 2 * spaceBetween, TabDepth / 2 - Offset * 2); var step = new Vector2(spaceBetween + TabWidth, Offset); - for (int i = 0; i < 5; i++) + for (int i = 0; i < sampleCount; i++) { var cube = PlatonicSolids.CreateCube(); content.Children.Add(new Object3D()