Make sure we don't sample off the bed
reorder 7 and 13 point leveling probe positions issue: MatterHackers/MCCentral#1821 Improvements to leveling process
This commit is contained in:
parent
3f8f0cbe28
commit
83a7d49e32
6 changed files with 38 additions and 20 deletions
|
|
@ -48,28 +48,29 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
double bedRadius = Math.Min(printer.Settings.GetValue<Vector2>(SettingsKey.bed_size).X, printer.Settings.GetValue<Vector2>(SettingsKey.bed_size).Y) / 2;
|
||||
Vector2 bedCenter = printer.Settings.GetValue<Vector2>(SettingsKey.print_center);
|
||||
|
||||
// around the outside
|
||||
int numberOfOuterSamples = 6;
|
||||
for (int i = 0; i < numberOfOuterSamples; i++)
|
||||
{
|
||||
Vector2 position = new Vector2(bedRadius, 0);
|
||||
position.Rotate(MathHelper.Tau / numberOfOuterSamples * i);
|
||||
position += bedCenter;
|
||||
yield return position;
|
||||
}
|
||||
// the center
|
||||
yield return bedCenter;
|
||||
|
||||
// around an inner circle
|
||||
int numberOfInnerSamples = 6;
|
||||
int numberOfInnerSamples = 4;
|
||||
for (int i = 0; i < numberOfInnerSamples; i++)
|
||||
{
|
||||
Vector2 position = new Vector2(bedRadius / 2, 0);
|
||||
Vector2 position = new Vector2(bedRadius * .45, 0);
|
||||
position.Rotate(MathHelper.Tau / numberOfInnerSamples * i);
|
||||
position += bedCenter;
|
||||
yield return position;
|
||||
}
|
||||
|
||||
// the center
|
||||
yield return bedCenter;
|
||||
// around the outside
|
||||
int numberOfOuterSamples = 8;
|
||||
for (int i = 0; i < numberOfOuterSamples; i++)
|
||||
{
|
||||
Vector2 position = new Vector2(bedRadius * .9, 0);
|
||||
// the -MathHelper.Tau / 4 is to start out just under the last inner point
|
||||
position.Rotate(MathHelper.Tau / numberOfOuterSamples * i - MathHelper.Tau / 4);
|
||||
position += bedCenter;
|
||||
yield return position;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -49,15 +49,15 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
double bedRadius = Math.Min(printer.Settings.GetValue<Vector2>(SettingsKey.bed_size).X, printer.Settings.GetValue<Vector2>(SettingsKey.bed_size).Y) / 2;
|
||||
Vector2 bedCenter = printer.Settings.GetValue<Vector2>(SettingsKey.print_center);
|
||||
|
||||
yield return bedCenter;
|
||||
|
||||
for (int i = 0; i < numberOfRadialSamples; i++)
|
||||
{
|
||||
Vector2 position = new Vector2(bedRadius, 0);
|
||||
Vector2 position = new Vector2(bedRadius * .9, 0);
|
||||
position.Rotate(MathHelper.Tau / numberOfRadialSamples * i);
|
||||
position += bedCenter;
|
||||
yield return position;
|
||||
}
|
||||
|
||||
yield return bedCenter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -238,11 +238,16 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
if (printerSettings.Helpers.UseZProbe())
|
||||
{
|
||||
var probeOffset = printer.Settings.GetValue<Vector2>(SettingsKey.z_probe_xy_offset);
|
||||
var actualNozzlePosition = probePosition + probeOffset;
|
||||
var actualNozzlePosition = probePosition - probeOffset;
|
||||
|
||||
// clamp this to the bed bounds
|
||||
Vector2 bedSize = printer.Settings.GetValue<Vector2>(SettingsKey.bed_size);
|
||||
Vector2 printCenter = printer.Settings.GetValue<Vector2>(SettingsKey.print_center);
|
||||
RectangleDouble bedBounds = new RectangleDouble(printCenter - bedSize/2, printCenter + bedSize/2);
|
||||
Vector2 adjustedPostion = bedBounds.Clamp(actualNozzlePosition);
|
||||
|
||||
// and push it back into the probePosition
|
||||
probePosition = actualNozzlePosition - probeOffset;
|
||||
probePosition = adjustedPostion + probeOffset;
|
||||
}
|
||||
|
||||
return probePosition;
|
||||
|
|
|
|||
|
|
@ -29,6 +29,7 @@ either expressed or implied, of the FreeBSD Project.
|
|||
|
||||
using System;
|
||||
using System.Threading;
|
||||
using MatterHackers.Agg;
|
||||
using MatterHackers.Agg.Platform;
|
||||
using MatterHackers.Agg.UI;
|
||||
using MatterHackers.Localizations;
|
||||
|
|
@ -60,6 +61,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
BackgroundColor = theme.ButtonFactory.Options.NormalFillColor,
|
||||
HoverColor = theme.ButtonFactory.Options.HoverFillColor,
|
||||
};
|
||||
|
||||
finishSetupButton.Click += (s, e) =>
|
||||
{
|
||||
UiThread.RunOnIdle(async () =>
|
||||
|
|
@ -83,6 +85,17 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
|
|||
UiThread.RunOnIdle(SetButtonStates);
|
||||
}, ref unregisterEvents);
|
||||
|
||||
ActiveSliceSettings.SettingChanged.RegisterEvent((s, e) =>
|
||||
{
|
||||
if (e is StringEventArgs stringEvent
|
||||
&& (stringEvent.Data == SettingsKey.z_probe_z_offset
|
||||
|| stringEvent.Data == SettingsKey.print_leveling_data
|
||||
|| stringEvent.Data == SettingsKey.print_leveling_solution))
|
||||
{
|
||||
SetButtonStates();
|
||||
}
|
||||
}, ref unregisterEvents);
|
||||
|
||||
SetButtonStates();
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -775,7 +775,6 @@
|
|||
"ShowAsOverride": true,
|
||||
"ShowIfSet": "!has_hardware_leveling",
|
||||
"DefaultValue": "3 Point Plane",
|
||||
"ReloadUiWhenChanged": true,
|
||||
"RebuildGCodeOnChange": false
|
||||
},
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 6a84d17400a0bfe0e3fe0e76ab978c527a2eb13c
|
||||
Subproject commit 285336bfd56a2d3fd6d8d05d4547177e752b5c98
|
||||
Loading…
Add table
Add a link
Reference in a new issue