Getting leveling data to be absolute

issue: MatterHackers/MCCentral#2980
Make leveling data be the measured plane (don't include probe offset in it)

Improving leveling message strings
This commit is contained in:
Lars Brubaker 2018-04-03 12:10:33 -07:00
parent 329aa70981
commit f78db090ef
5 changed files with 45 additions and 48 deletions

View file

@ -66,27 +66,36 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
if (runningState == LevelWizardBase.RuningState.InitialStartupCalibration)
{
string requiredPageInstructions = "{0}\n\n{1}".FormatWith(levelingStrings.requiredPageInstructions1, levelingStrings.requiredPageInstructions2);
string part1 = "Congratulations on connecting to your new printer. Before starting your first print we need to run a simple calibration procedure.".Localize();
string part2 = "The next few screens will walk your through the print leveling wizard.".Localize();
string requiredPageInstructions = $"{part1}\n\n{part2}";
printLevelWizard.AddPage(new FirstPageInstructions(printer, levelingStrings.initialPrinterSetupStepText, requiredPageInstructions));
}
printLevelWizard.AddPage(new FirstPageInstructions(printer, levelingStrings.OverviewText, levelingStrings.WelcomeText(ProbeCount, 5)));
// To make sure the bed is at the correct temp, put in a filament selection page.
bool hasHeatedBed = printer.Settings.GetValue<bool>(SettingsKey.has_heated_bed);
bool useZProbe = printer.Settings.Helpers.UseZProbe();
int zProbeSamples = printer.Settings.GetValue<int>(SettingsKey.z_probe_samples);
var secondsPerManualSpot = 10 * 3;
var secondsPerAutomaticSpot = 3 * zProbeSamples;
var secondsToCompleteWizard = ProbeCount * (useZProbe ? secondsPerAutomaticSpot : secondsPerManualSpot);
secondsToCompleteWizard += (hasHeatedBed ? 60 * 3 : 0);
printLevelWizard.AddPage(new FirstPageInstructions(printer,
"Print Leveling Overview".Localize(),
levelingStrings.WelcomeText(ProbeCount, (int)Math.Round(secondsToCompleteWizard / 60.0))));
if (!useZProbe)
{
printLevelWizard.AddPage(new CleanExtruderInstructionPage(printer, "Check Nozzle".Localize(), levelingStrings.CleanExtruder));
}
var printerSettings = printer.Settings;
// To make sure the bed is at the correct temp, put in a filament selection page.
bool hasHeatedBed = printerSettings.GetValue<bool>(SettingsKey.has_heated_bed);
if (hasHeatedBed)
{
string filamentSelectionPage = "{0}\n\n{1}".FormatWith(levelingStrings.materialPageInstructions1, levelingStrings.materialPageInstructions2);
printLevelWizard.AddPage(new SelectMaterialPage(printer, levelingStrings.materialStepText, filamentSelectionPage));
}
printLevelWizard.AddPage(new HomePrinterPage(printer, printLevelWizard,
levelingStrings.HomingPageStepText,
levelingStrings.HomingPageInstructions(useZProbe),
@ -102,17 +111,17 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
string medPrecisionLabel = "Medium Precision".Localize();
string highPrecisionLabel = "High Precision".Localize();
double bedRadius = Math.Min(printerSettings.GetValue<Vector2>(SettingsKey.bed_size).X, printerSettings.GetValue<Vector2>(SettingsKey.bed_size).Y) / 2;
double bedRadius = Math.Min(printer.Settings.GetValue<Vector2>(SettingsKey.bed_size).X, printer.Settings.GetValue<Vector2>(SettingsKey.bed_size).Y) / 2;
double startProbeHeight = printerSettings.GetValue<double>(SettingsKey.print_leveling_probe_start);
double startProbeHeight = printer.Settings.GetValue<double>(SettingsKey.print_leveling_probe_start);
int i = 0;
foreach (var goalProbePosition in GetPrintLevelPositionToSample())
{
var validProbePosition = EnsureInPrintBounds(printerSettings, goalProbePosition);
var validProbePosition = EnsureInPrintBounds(printer.Settings, goalProbePosition);
if (printerSettings.Helpers.UseZProbe())
if (printer.Settings.Helpers.UseZProbe())
{
var stepString = string.Format("{0} {1} {2} {3}:", levelingStrings.stepTextBeg, i + 1, levelingStrings.stepTextEnd, ProbeCount);
var stepString = string.Format("{0} {1} {2} {3}:", "Step".Localize(), i + 1, levelingStrings.stepTextEnd, ProbeCount);
printLevelWizard.AddPage(new AutoProbeFeedback(printer, printLevelWizard, new Vector3(validProbePosition, startProbeHeight), string.Format("{0} {1} {2} - {3}", stepString, positionLabel, i + 1, autoCalibrateLabel), probePositions, i));
}
else

View file

@ -40,11 +40,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
public string WaitingForTempPageStepText = "Waiting For Bed To Heat".Localize();
public string initialPrinterSetupStepText = "Initial Printer Setup".Localize();
public string materialStepText = "Select Material".Localize();
public string requiredPageInstructions1 = "Congratulations on connecting to your new printer. Before starting your first print we need to run a simple calibration procedure.";
public string requiredPageInstructions2 = "The next few screens will walk your through the print leveling wizard.";
public string materialPageInstructions1 = "The temperature of the bed can have a significant effect on the quality of leveling.";
public string materialPageInstructions2 = "Please select the material you will be printing, so we can adjust the temperature before calibrating.";
public string stepTextBeg = "Step".Localize();
public string stepTextEnd = "of".Localize();
private string doneLine1 = "Congratulations!";
private string doneLine1b = "Auto Print Leveling is now configured and enabled.".Localize();
@ -56,10 +53,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
private string homingLine2 = "A standard sheet of paper".Localize();
private string homingLine3 = "We will use this paper to measure the distance between the extruder and the bed.";
private int stepNumber = 1;
private string probeWelcomeLine1 = "Welcome to the probe calibration wizard. Here is a quick overview on what we are going to do.".Localize();
private string welcomeLine1 = "Welcome to the print leveling wizard. Here is a quick overview on what we are going to do.".Localize();
private string selectMaterial = "Select the material you are printing".Localize();
private string homeThePrinter = "Home the printer".Localize();
private string heatTheBed = "Heat the bed".Localize();
private string sampelAtPoints = "Sample the bed at {0} points".Localize();
private string turnOnLeveling = "Turn auto leveling on".Localize();
@ -118,8 +113,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
}
}
public string OverviewText { get; } = "Print Leveling Overview".Localize();
string setZHeightLower = "Press [Z-] until there is resistance to moving the paper".Localize();
string setZHeightRaise = "Press [Z+] once to release the paper".Localize();
string setZHeightNext = "Finally click 'Next' to continue.".Localize();
@ -148,18 +141,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
public string GetStepString(int totalSteps)
{
return "{0} {1} {2} {3}:".FormatWith(stepTextBeg, stepNumber++, stepTextEnd, totalSteps);
}
public string CalibrateProbeWelcomText()
{
return "{0}\n\n\t• {1}\n\t• {2}\n\t• {3}\n\n{4}\n\n{5}".FormatWith(
this.probeWelcomeLine1,
this.homeThePrinter,
"Probe the bed at the center".Localize(),
"Manually measure the extruder at the center".Localize(),
this.WelcomeLine7(1),
this.ClickNext);
return "{0} {1} {2} {3}:".FormatWith("Step".Localize(), stepNumber++, stepTextEnd, totalSteps);
}
public string WelcomeText(int numberOfSteps, int numberOfMinutes)
@ -174,7 +156,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
return "{0}\n\n\t• {1}\n\t• {2}\n\t• {3}\n\t• {4}\n\t• {5}\n\n{6}\n\n{7}".FormatWith(
this.welcomeLine1,
this.selectMaterial,
this.homeThePrinter,
"Home the printer".Localize(),
this.heatTheBed,
this.WelcomeLine5(numberOfSteps),
this.turnOnLeveling,
@ -185,7 +167,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
return "{0}\n\n\t• {1}\n\t• {2}\n\t• {3}\n\n{4}\n\n{5}".FormatWith(
this.welcomeLine1,
this.homeThePrinter,
"Home the printer".Localize(),
this.WelcomeLine5(numberOfSteps),
this.turnOnLeveling,
this.WelcomeLine7(numberOfMinutes),

View file

@ -76,6 +76,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
var triangles = DelaunayTriangulation<DefaultVertex, DefaultTriangulationCell<DefaultVertex>>.Create(vertices, .001);
var probeOffset = new Vector3(0, 0, printerSettings.GetValue<double>(SettingsKey.z_probe_z_offset));
// make all the triangle planes for these triangles
foreach (var triangle in triangles.Cells)
{
@ -88,7 +89,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
var v1 = new Vector3(p1[0], p1[1], zDictionary[(p1[0], p1[1])]);
var v2 = new Vector3(p2[0], p2[1], zDictionary[(p2[0], p2[1])]);
// add all the regions
Regions.Add(new LevelingTriangle(v0, v1, v2));
Regions.Add(new LevelingTriangle(v0 - probeOffset, v1 - probeOffset, v2 - probeOffset));
}
}
}

View file

@ -212,10 +212,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
PrintLevelingData levelingData = printer.Settings.Helpers.GetPrintLevelingData();
levelingData.SampledPositions.Clear();
Vector3 zProbeOffset = new Vector3(0, 0, printer.Settings.GetValue<double>(SettingsKey.z_probe_z_offset));
for (int i = 0; i < probePositions.Count; i++)
{
levelingData.SampledPositions.Add(probePositions[i].position - zProbeOffset);
levelingData.SampledPositions.Add(probePositions[i].position);
}
// Invoke setter forcing persistence of leveling data
@ -255,10 +254,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
public override void PageIsBecomingActive()
{
// make sure we don't have leveling data
PrintLevelingData levelingData = printer.Settings.Helpers.GetPrintLevelingData();
levelingData.SampledPositions.Clear();
printer.Settings.Helpers.SetPrintLevelingData(levelingData, true);
double newProbeOffset = autoProbePositions[0].position.Z - manualProbePositions[0].position.Z;
printer.Settings.SetValue(SettingsKey.z_probe_z_offset, newProbeOffset.ToString("0.###"));

View file

@ -67,8 +67,16 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
printLevelWizard = new WizardControl();
AddChild(printLevelWizard);
var CalibrateProbeWelcomText = "{0}\n\n\t• {1}\n\t• {2}\n\t• {3}\n\n{4}\n\n{5}".FormatWith(
"Welcome to the probe calibration wizard. Here is a quick overview on what we are going to do.".Localize(),
"Home the printer".Localize(),
"Probe the bed at the center".Localize(),
"Manually measure the extruder at the center".Localize(),
"We should be done in less than 1 minute.".Localize(),
levelingStrings.ClickNext);
printLevelWizard.AddPage(new FirstPageInstructions(printer,
"Probe Calibration Overview".Localize(), levelingStrings.CalibrateProbeWelcomText()));
"Probe Calibration Overview".Localize(), CalibrateProbeWelcomText));
printLevelWizard.AddPage(new CleanExtruderInstructionPage(printer, "Check Nozzle".Localize(), levelingStrings.CleanExtruder));
@ -78,8 +86,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
levelingStrings.HomingPageInstructions(useZProbe),
false));
string positionLabel = "Position".Localize();
string autoCalibrateLabel = "Auto Calibrate".Localize();
string lowPrecisionLabel = "Low Precision".Localize();
string medPrecisionLabel = "Medium Precision".Localize();
string highPrecisionLabel = "High Precision".Localize();
@ -89,13 +95,17 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
int i = 0;
// do the automatic probing of the center position
var stepString = string.Format("{0} {1} {2} {3}:", levelingStrings.stepTextBeg, i + 1, levelingStrings.stepTextEnd, 3);
printLevelWizard.AddPage(new AutoProbeFeedback(printer, printLevelWizard, new Vector3(probePosition, startProbeHeight), string.Format("{0} {1} {2} - {3}", stepString, positionLabel, i + 1, autoCalibrateLabel), autoProbePositions, i));
var stepString = string.Format($"{"Step".Localize()} {i + 1} {levelingStrings.stepTextEnd} {3}:");
printLevelWizard.AddPage(new AutoProbeFeedback(printer, printLevelWizard,
new Vector3(probePosition, startProbeHeight),
$"{stepString} {"Position".Localize()} {i + 1} - {"Auto Calibrate".Localize()}",
autoProbePositions, i));
// do the manual prob of the same position
printLevelWizard.AddPage(new GetCoarseBedHeight(printer, printLevelWizard, new Vector3(probePosition, startProbeHeight), string.Format("{0} {1} {2} - {3}", levelingStrings.GetStepString(totalSteps), positionLabel, i + 1, lowPrecisionLabel), manualProbePositions, i, levelingStrings));
printLevelWizard.AddPage(new GetFineBedHeight(printer, printLevelWizard, string.Format("{0} {1} {2} - {3}", levelingStrings.GetStepString(totalSteps), positionLabel, i + 1, medPrecisionLabel), manualProbePositions, i, levelingStrings));
printLevelWizard.AddPage(new GetUltraFineBedHeight(printer, printLevelWizard, string.Format("{0} {1} {2} - {3}", levelingStrings.GetStepString(totalSteps), positionLabel, i + 1, highPrecisionLabel), manualProbePositions, i, levelingStrings));
printLevelWizard.AddPage(new GetCoarseBedHeight(printer, printLevelWizard, new Vector3(probePosition, startProbeHeight),
string.Format("{0} {1} {2} - {3}", levelingStrings.GetStepString(totalSteps), "Position".Localize(), i + 1, lowPrecisionLabel), manualProbePositions, i, levelingStrings));
printLevelWizard.AddPage(new GetFineBedHeight(printer, printLevelWizard, string.Format("{0} {1} {2} - {3}", levelingStrings.GetStepString(totalSteps), "Position".Localize(), i + 1, medPrecisionLabel), manualProbePositions, i, levelingStrings));
printLevelWizard.AddPage(new GetUltraFineBedHeight(printer, printLevelWizard, string.Format("{0} {1} {2} - {3}", levelingStrings.GetStepString(totalSteps), "Position".Localize(), i + 1, highPrecisionLabel), manualProbePositions, i, levelingStrings));
printLevelWizard.AddPage(new CalibrateProbeLastPagelInstructions(printer, printLevelWizard,
"Done".Localize(),