protected override IEnumerator <PrinterSetupWizardPage> GetWizardSteps() { var probePositions = new List <ProbePosition>(levelingPlan.ProbeCount); for (int j = 0; j < levelingPlan.ProbeCount; j++) { probePositions.Add(new ProbePosition()); } var levelingStrings = new LevelingStrings(printer.Settings); // If no leveling data has been calculated bool showWelcomeScreen = printer.Settings.Helpers.GetPrintLevelingData().SampledPositions.Count == 0 && !ProbeCalibrationWizard.UsingZProbe(printer); if (showWelcomeScreen) { yield return(new PrinterSetupWizardPage( this, levelingStrings.InitialPrinterSetupStepText, string.Format( "{0}\n\n{1}", "Congratulations on connecting to your printer. Before starting your first print we need to run a simple calibration procedure.".Localize(), "The next few screens will walk your through calibrating your printer.".Localize()))); } 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 = levelingPlan.ProbeCount * (useZProbe ? secondsPerAutomaticSpot : secondsPerManualSpot); secondsToCompleteWizard += (hasHeatedBed ? 60 * 3 : 0); yield return(new PrinterSetupWizardPage( this, "Print Leveling Overview".Localize(), levelingStrings.WelcomeText(levelingPlan.ProbeCount, (int)Math.Round(secondsToCompleteWizard / 60.0)))); yield return(new HomePrinterPage( this, "Homing The Printer".Localize(), levelingStrings.HomingPageInstructions(useZProbe, hasHeatedBed), useZProbe)); // figure out the heating requirements double targetBedTemp = 0; double targetHotendTemp = 0; if (hasHeatedBed) { targetBedTemp = printer.Settings.GetValue <double>(SettingsKey.bed_temperature); } if (!useZProbe) { targetHotendTemp = printer.Settings.Helpers.ExtruderTemperature(0); } if (targetBedTemp > 0 || targetHotendTemp > 0) { string heatingInstructions = ""; if (targetBedTemp > 0 && targetHotendTemp > 0) { // heating both the bed and the hotend heatingInstructions = "Waiting for the bed to heat to ".Localize() + targetBedTemp + "°C\n" + "and the hotend to heat to ".Localize() + targetHotendTemp + "°C.\n" + "\n" + "This will improve the accuracy of print leveling ".Localize() + "and ensure that no filament is stuck to your nozzle.".Localize() + "\n" + "\n" + "Warning! The tip of the nozzle will be HOT!".Localize() + "\n" + "Avoid contact with your skin.".Localize(); } else if (targetBedTemp > 0) { // only heating the bed heatingInstructions = "Waiting for the bed to heat to ".Localize() + targetBedTemp + "°C.\n" + "This will improve the accuracy of print leveling.".Localize(); } else // targetHotendTemp > 0 { // only heating the hotend heatingInstructions += "Waiting for the hotend to heat to ".Localize() + targetHotendTemp + "°C.\n" + "This will ensure that no filament is stuck to your nozzle.".Localize() + "\n" + "\n" + "Warning! The tip of the nozzle will be HOT!".Localize() + "\n" + "Avoid contact with your skin.".Localize(); } yield return(new WaitForTempPage( this, "Waiting For Printer To Heat".Localize(), heatingInstructions, targetBedTemp, targetHotendTemp)); } double bedRadius = Math.Min(printer.Settings.GetValue <Vector2>(SettingsKey.bed_size).X, printer.Settings.GetValue <Vector2>(SettingsKey.bed_size).Y) / 2; double startProbeHeight = printer.Settings.GetValue <double>(SettingsKey.print_leveling_probe_start); int i = 0; foreach (var goalProbePosition in levelingPlan.GetPrintLevelPositionToSample()) { var validProbePosition = EnsureInPrintBounds(printer.Settings, goalProbePosition); if (printer.Settings.Helpers.UseZProbe()) { yield return(new AutoProbeFeedback( this, new Vector3(validProbePosition, startProbeHeight), string.Format( "{0} {1} {2} - {3}", $"{"Step".Localize()} {i + 1} {"of".Localize()} {levelingPlan.ProbeCount}:", "Position".Localize(), i + 1, "Auto Calibrate".Localize()), probePositions, i)); } else { yield return(new GetCoarseBedHeight( this, new Vector3(validProbePosition, startProbeHeight), string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(levelingPlan.TotalSteps), "Position".Localize(), i + 1, "Low Precision".Localize()), probePositions, i, levelingStrings)); yield return(new GetFineBedHeight( this, string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(levelingPlan.TotalSteps), "Position".Localize(), i + 1, "Medium Precision".Localize()), probePositions, i, levelingStrings)); yield return(new GetUltraFineBedHeight( this, string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(levelingPlan.TotalSteps), "Position".Localize(), i + 1, "High Precision".Localize()), probePositions, i, levelingStrings)); } i++; } yield return(new LastPageInstructions( this, "Print Leveling Wizard".Localize(), useZProbe, probePositions)); }
private IEnumerator <WizardPage> GetPages() { var levelingStrings = new LevelingStrings(); var autoProbePositions = new List <ProbePosition>(3); var manualProbePositions = new List <ProbePosition>(3); autoProbePositions.Add(new ProbePosition()); manualProbePositions.Add(new ProbePosition()); int totalSteps = 3; // make a welcome page if this is the first time calibrating the probe if (!printer.Settings.GetValue <bool>(SettingsKey.probe_has_been_calibrated)) { yield return(new WizardPage( this, "Initial Printer Setup".Localize(), string.Format( "{0}\n\n{1}", "Congratulations on connecting to your printer. Before starting your first print we need to run a simple calibration procedure.".Localize(), "The next few screens will walk your through calibrating your printer.".Localize())) { WindowTitle = WindowTitle }); } // show what steps will be taken yield return(new WizardPage( this, "Probe Calibration Overview".Localize(), string.Format( "{0}\n\n\t• {1}\n\t• {2}\n\t• {3}\n\n{4}\n\n{5}", "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 five minutes.".Localize(), "Click 'Next' to continue.".Localize())) { WindowTitle = WindowTitle }); // add in the homing printer page yield return(new HomePrinterPage( this, "Homing The Printer".Localize(), levelingStrings.HomingPageInstructions(true, false), false)); if (LevelingValidation.NeedsToBeRun(printer)) { // start heating up the bed as that will be needed next var bedTemperature = printer.Settings.GetValue <bool>(SettingsKey.has_heated_bed) ? printer.Settings.GetValue <double>(SettingsKey.bed_temperature) : 0; if (bedTemperature > 0) { printer.Connection.TargetBedTemperature = bedTemperature; } } var extruderCount = printer.Settings.GetValue <int>(SettingsKey.extruder_count); var temps = new double[4]; for (int i = 0; i < extruderCount; i++) { temps[i] = printer.Settings.Helpers.ExtruderTargetTemperature(i); } yield return(new WaitForTempPage( this, "Waiting For Printer To Heat".Localize(), ((extruderCount == 1) ? "Waiting for the hotend to heat to ".Localize() + temps[0] + "°C.\n" : "Waiting for the hotends to heat up.".Localize()) + "This will ensure that no filament is stuck to your nozzle.".Localize() + "\n" + "\n" + "Warning! The tip of the nozzle will be HOT!".Localize() + "\n" + "Avoid contact with your skin.".Localize(), 0, temps)); double startProbeHeight = printer.Settings.GetValue <double>(SettingsKey.print_leveling_probe_start); Vector2 probePosition = LevelingPlan.ProbeOffsetSamplePosition(printer); Vector3 probeStartPosition = new Vector3(probePosition, startProbeHeight); int extruderPriorToMeasure = printer.Connection.ActiveExtruderIndex; if (extruderCount > 1) { // reset the extruder that was active printer.Connection.QueueLine($"T0"); } int numberOfSamples = printer.Settings.GetValue <int>(SettingsKey.z_probe_samples); // do the automatic probing of the center position yield return(new AutoProbeFeedback( this, probeStartPosition, $"{"Step".Localize()} 1 {"of".Localize()} {numberOfSamples}: {"Position".Localize()} 1 - {"Auto Calibrate".Localize()}", autoProbePositions, 0)); // show what steps will be taken yield return(new WizardPage( this, "Measure the nozzle offset".Localize(), "{0}:\n\n\t• {1}\n\n{2}\n\n{3}".FormatWith( "To complete the next few steps you will need".Localize(), "A standard sheet of paper".Localize(), "We will use this paper to measure the distance between the nozzle and the bed.".Localize(), "Click 'Next' to continue.".Localize()))); // we currently only support calibrating 2 extruders for (int i = 0; i < Math.Min(extruderCount, 2); i++) { if (extruderCount > 1) { // reset the extruder that was active printer.Connection.QueueLine($"T{i}"); } // do the manual prob of the same position yield return(new GetCoarseBedHeight( this, new Vector3(probePosition, startProbeHeight), string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(totalSteps), "Position".Localize(), 1, "Low Precision".Localize()), manualProbePositions, 0, levelingStrings)); yield return(new GetFineBedHeight( this, string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(totalSteps), "Position".Localize(), 1, "Medium Precision".Localize()), manualProbePositions, 0, levelingStrings)); yield return(new GetUltraFineBedHeight( this, string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(totalSteps), "Position".Localize(), 1, "High Precision".Localize()), manualProbePositions, 0, levelingStrings)); if (i == 0) { // make sure we don't have leveling data double newProbeOffset = autoProbePositions[0].position.Z - manualProbePositions[0].position.Z; printer.Settings.SetValue(SettingsKey.z_probe_z_offset, newProbeOffset.ToString("0.###")); } else if (i == 1) { // store the offset into the extruder offset z position double newProbeOffset = autoProbePositions[0].position.Z - manualProbePositions[0].position.Z; var hotend0Offset = printer.Settings.GetValue <double>(SettingsKey.z_probe_z_offset); var newZOffset = newProbeOffset - hotend0Offset; printer.Settings.Helpers.SetExtruderZOffset(1, newZOffset); } } printer.Settings.SetValue(SettingsKey.probe_has_been_calibrated, "1"); if (extruderCount > 1) { // reset the extruder that was active printer.Connection.QueueLine($"T{extruderPriorToMeasure}"); } yield return(new CalibrateProbeLastPageInstructions( this, "Done".Localize())); }
protected override IEnumerator <WizardPage> GetPages() { var levelingStrings = new LevelingStrings(); var autoProbePositions = new List <PrintLevelingWizard.ProbePosition>(1); int hotendCount = Math.Min(2, printer.Settings.Helpers.HotendCount()); var manualProbePositions = new List <List <PrintLevelingWizard.ProbePosition> >(hotendCount); for (int i = 0; i < hotendCount; i++) { manualProbePositions.Add(new List <PrintLevelingWizard.ProbePosition>()); manualProbePositions[i] = new List <PrintLevelingWizard.ProbePosition>(1) { new PrintLevelingWizard.ProbePosition() }; } autoProbePositions.Add(new PrintLevelingWizard.ProbePosition()); int totalSteps = 3 * hotendCount; // show what steps will be taken yield return(new WizardPage( this, string.Format("{0} {1}", this.Title, "Overview".Localize()), string.Format( "{0}\n\n{1}\n\n{2}\n\n", "Z Calibration measures the z position of the nozzles.".Localize(), "This data is required for software print leveling and ensures good first layer adhesion.".Localize(), "Click 'Next' to continue.".Localize())) { WindowTitle = Title, }); // Initialize - turn off print leveling printer.Connection.AllowLeveling = false; // remember the current baby stepping values babySteppingValue = printer.Settings.GetValue <double>(SettingsKey.baby_step_z_offset); // clear them while we measure the offsets printer.Settings.SetValue(SettingsKey.baby_step_z_offset, "0"); // Require user confirmation after this point this.RequireCancelConfirmation = true; // add in the homing printer page yield return(new HomePrinterPage( this, levelingStrings.HomingPageInstructions(true, false))); var printerShim = ApplicationController.Instance.Shim(printer); if (LevelingValidation.NeedsToBeRun(printerShim)) { // start heating up the bed as that will be needed next var bedTemperature = printer.Settings.GetValue <bool>(SettingsKey.has_heated_bed) ? printer.Settings.GetValue <double>(SettingsKey.bed_temperature) : 0; if (bedTemperature > 0) { printer.Connection.TargetBedTemperature = bedTemperature; } } var extruderCount = printer.Settings.GetValue <int>(SettingsKey.extruder_count); var temps = new double[4]; for (int i = 0; i < extruderCount; i++) { temps[i] = printer.Settings.Helpers.ExtruderTargetTemperature(i); } yield return(new WaitForTempPage( this, "Heating the printer".Localize(), ((extruderCount == 1) ? "Waiting for the hotend to heat to ".Localize() + temps[0] + "°C.\n" : "Waiting for the hotends to heat up.".Localize()) + "This will ensure that no filament is stuck to your nozzle.".Localize() + "\n" + "\n" + "Warning! The tip of the nozzle will be HOT!".Localize() + "\n" + "Avoid contact with your skin.".Localize(), 0, temps)); double startProbeHeight = printer.Settings.GetValue <double>(SettingsKey.print_leveling_probe_start); Vector2 probePosition = LevelingPlan.ProbeOffsetSamplePosition(printerShim); var probeStartPosition = new Vector3(probePosition, startProbeHeight); int extruderPriorToMeasure = printer.Connection.ActiveExtruderIndex; if (extruderCount > 1) { // reset the extruder that was active printer.Connection.QueueLine($"T0"); } bool probeBeingUsed = printer.Settings.GetValue <bool>(SettingsKey.has_z_probe) && printer.Settings.GetValue <bool>(SettingsKey.use_z_probe); if (probeBeingUsed) { // do the automatic probing of the center position yield return(new AutoProbeFeedback( this, probeStartPosition, "Probe at bed center".Localize(), "Sample the bed center position to determine the probe distance to the bed".Localize(), autoProbePositions, 0)); } // show what steps will be taken yield return(new WizardPage( this, "Measure the nozzle offset".Localize(), "{0}:\n\n\t• {1}\n\n{2}\n\n{3}".FormatWith( "To complete the next few steps you will need".Localize(), "A sheet of paper".Localize(), "We will use this paper to measure the distance between the nozzle and the bed.".Localize(), "Click 'Next' to continue.".Localize()))); for (int extruderIndex = 0; extruderIndex < hotendCount; extruderIndex++) { if (extruderCount > 1) { // reset the extruder that was active printer.Connection.QueueLine($"T{extruderIndex}"); } // do the manual prob of the same position yield return(new GetCoarseBedHeight( this, new Vector3(probePosition, startProbeHeight), string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(totalSteps), "Position".Localize(), 1, "Low Precision".Localize()), manualProbePositions[extruderIndex], 0, levelingStrings)); yield return(new GetFineBedHeight( this, string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(totalSteps), "Position".Localize(), 1, "Medium Precision".Localize()), manualProbePositions[extruderIndex], 0, levelingStrings)); yield return(new GetUltraFineBedHeight( this, string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(totalSteps), "Position".Localize(), 1, "High Precision".Localize()), manualProbePositions[extruderIndex], 0, levelingStrings)); if (probeBeingUsed && extruderIndex == 0) { // set the probe z offset double newProbeOffset = autoProbePositions[0].Position.Z - manualProbePositions[0][0].Position.Z; var probe_offset = printer.Settings.GetValue <Vector3>(SettingsKey.probe_offset); probe_offset.Z = -newProbeOffset; printer.Settings.SetValue(SettingsKey.probe_offset, $"{probe_offset.X},{probe_offset.Y},{probe_offset.Z}"); printer.Settings.SetValue(SettingsKey.probe_has_been_calibrated, "1"); } else if (extruderIndex > 0) { // store the offset into the extruder offset z position double newZOffset; if (probeBeingUsed) { var extruderOffset = autoProbePositions[0].Position.Z - manualProbePositions[extruderIndex][0].Position.Z; var hotend0Offset = printer.Settings.GetValue <Vector3>(SettingsKey.probe_offset); newZOffset = extruderOffset + hotend0Offset.Z; } else { newZOffset = manualProbePositions[0][0].Position.Z - manualProbePositions[extruderIndex][0].Position.Z; } printer.Settings.Helpers.SetExtruderZOffset(1, newZOffset); } } if (extruderCount > 1) { // reset the extruder that was active printer.Connection.QueueLine($"T{extruderPriorToMeasure}"); } // clear the baby stepping so we don't save the old values babySteppingValue = 0; yield return(new CalibrateProbeLastPageInstructions(this, this.Title + " " + "Wizard".Localize())); }
protected override IEnumerator <WizardPage> GetPages() { var levelingStrings = new LevelingStrings(); yield return(new WizardPage( this, string.Format("{0} {1}", this.Title, "Overview".Localize()), string.Format( "{0}\n\n{1}\n\n{2}\n\n", "Print Leveling measures the plane of the bed.".Localize(), "This data compensates for machine misalignment and bed distortion, and ensures good first layer adhesion.".Localize(), "Click 'Next' to continue.".Localize())) { WindowTitle = Title, }); // Switch to raw mode and construct leveling structures this.Initialize(); // var probePositions = new List<ProbePosition>(Enumerable.Range(0, levelingPlan.ProbeCount).Select(p => new ProbePosition())); var probePositions = new List <ProbePosition>(LevelingPlan.ProbeCount); for (int j = 0; j < LevelingPlan.ProbeCount; j++) { probePositions.Add(new ProbePosition()); } // Require user confirmation after this point this.RequireCancelConfirmation = true; // start heating up now so it has more time to heat var bedTemperature = printer.Settings.GetValue <bool>(SettingsKey.has_heated_bed) ? printer.Settings.GetValue <double>(SettingsKey.bed_temperature) : 0; if (bedTemperature > 0) { printer.Connection.TargetBedTemperature = bedTemperature; } yield return(new HomePrinterPage( this, levelingStrings.HomingPageInstructions( printer.Settings.Helpers.UseZProbe(), printer.Settings.GetValue <bool>(SettingsKey.has_heated_bed)))); // figure out the heating requirements double targetBedTemp = 0; double targetHotendTemp = 0; if (printer.Settings.GetValue <bool>(SettingsKey.has_heated_bed)) { targetBedTemp = printer.Settings.GetValue <double>(SettingsKey.bed_temperature); } if (!printer.Settings.Helpers.UseZProbe()) { targetHotendTemp = printer.Settings.Helpers.ExtruderTargetTemperature(0); } if (targetBedTemp > 0 || targetHotendTemp > 0) { string heatingInstructions = ""; if (targetBedTemp > 0 && targetHotendTemp > 0) { // heating both the bed and the hotend heatingInstructions = "Waiting for the bed to heat to ".Localize() + targetBedTemp + "°C\n" + "and the hotend to heat to ".Localize() + targetHotendTemp + "°C.\n" + "\n" + "This will improve the accuracy of print leveling ".Localize() + "and ensure that no filament is stuck to your nozzle.".Localize() + "\n" + "\n" + "Warning! The tip of the nozzle will be HOT!".Localize() + "\n" + "Avoid contact with your skin.".Localize(); } else if (targetBedTemp > 0) { // only heating the bed heatingInstructions = "Waiting for the bed to heat to ".Localize() + targetBedTemp + "°C.\n" + "This will improve the accuracy of print leveling.".Localize(); } else // targetHotendTemp > 0 { // only heating the hotend heatingInstructions += "Waiting for the hotend to heat to ".Localize() + targetHotendTemp + "°C.\n" + "This will ensure that no filament is stuck to your nozzle.".Localize() + "\n" + "\n" + "Warning! The tip of the nozzle will be HOT!".Localize() + "\n" + "Avoid contact with your skin.".Localize(); } yield return(new WaitForTempPage( this, "Heating the printer".Localize(), heatingInstructions, targetBedTemp, new double[] { targetHotendTemp })); } double startProbeHeight = printer.Settings.GetValue <double>(SettingsKey.print_leveling_probe_start); int i = 0; var probePoints = LevelingPlan.GetPositionsToSample(printer.Connection.HomingPosition).ToList(); if (printer.Settings.Helpers.UseZProbe()) { var autoProbePage = new AutoProbePage(this, printer, "Bed Detection", probePoints, probePositions); yield return(autoProbePage); } else { foreach (var goalProbePoint in probePoints) { if (wizardExited) { // Make sure when the wizard is done we turn off the bed heating printer.Connection.TurnOffBedAndExtruders(TurnOff.AfterDelay); if (printer.Settings.GetValue <bool>(SettingsKey.z_homes_to_max)) { printer.Connection.HomeAxis(PrinterConnection.Axis.XYZ); } yield break; } var validProbePosition = EnsureInPrintBounds(printer, goalProbePoint); { yield return(new GetCoarseBedHeight( this, new Vector3(validProbePosition, startProbeHeight), string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(LevelingPlan.TotalSteps), "Position".Localize(), i + 1, "Low Precision".Localize()), probePositions, i, levelingStrings)); yield return(new GetFineBedHeight( this, string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(LevelingPlan.TotalSteps), "Position".Localize(), i + 1, "Medium Precision".Localize()), probePositions, i, levelingStrings)); yield return(new GetUltraFineBedHeight( this, string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(LevelingPlan.TotalSteps), "Position".Localize(), i + 1, "High Precision".Localize()), probePositions, i, levelingStrings)); } i++; } } // if we are not using a z-probe, reset the baby stepping at the successful conclusion of leveling if (!printer.Settings.GetValue <bool>(SettingsKey.use_z_probe)) { // clear the baby stepping so we don't save the old values var extruderCount = printer.Settings.GetValue <int>(SettingsKey.extruder_count); for (i = 0; i < extruderCount; i++) { babySteppingValue[i] = 0; } } yield return(new LastPageInstructions( this, "Print Leveling Wizard".Localize(), printer.Settings.Helpers.UseZProbe(), probePositions)); }
protected override IEnumerator <LevelingWizardPage> GetWizardSteps() { var levelingStrings = new LevelingStrings(printer.Settings); var autoProbePositions = new List <ProbePosition>(3); var manualProbePositions = new List <ProbePosition>(3); autoProbePositions.Add(new ProbePosition()); manualProbePositions.Add(new ProbePosition()); int totalSteps = 3; // make a welcome page if this is the first time calibrating the probe if (!printer.Settings.GetValue <bool>(SettingsKey.probe_has_been_calibrated)) { yield return(new LevelingWizardPage( this, levelingStrings.InitialPrinterSetupStepText, string.Format( "{0}\n\n{1}", "Congratulations on connecting to your printer. Before starting your first print we need to run a simple calibration procedure.".Localize(), "The next few screens will walk your through calibrating your printer.".Localize()))); } // show what steps will be taken yield return(new LevelingWizardPage( this, "Probe Calibration Overview".Localize(), string.Format( "{0}\n\n\t• {1}\n\t• {2}\n\t• {3}\n\n{4}\n\n{5}", "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 five minutes.".Localize(), levelingStrings.ClickNext))); // add in the material select page yield return(new SelectMaterialPage( this, "Select Material".Localize(), string.Format( "{0}\n\n{1}", "The hot end needs to be heated to ensure it is clean.".Localize(), "Please select the material you will be printing, so we can heat the printer before calibrating.".Localize()))); // add in the homing printer page yield return(new HomePrinterPage( this, "Homing The Printer".Localize(), levelingStrings.HomingPageInstructions(true, false), false)); double targetHotendTemp = 0; targetHotendTemp = printer.Settings.Helpers.ExtruderTemperature(0); yield return(new WaitForTempPage( this, "Waiting For Printer To Heat".Localize(), "Waiting for the hotend to heat to ".Localize() + targetHotendTemp + ".\n" + "This will ensure no filament is stuck to the tip.".Localize() + "\n" + "\n" + "Warning! The tip of the nozzle will be HOT!".Localize() + "\n" + "Avoid contact with your skin.".Localize(), 0, targetHotendTemp)); double startProbeHeight = printer.Settings.GetValue <double>(SettingsKey.print_leveling_probe_start); Vector2 probePosition = printer.Settings.GetValue <Vector2>(SettingsKey.print_center); int i = 0; // do the automatic probing of the center position yield return(new AutoProbeFeedback( this, new Vector3(probePosition, startProbeHeight), $"{"Step".Localize()} {i + 1} {"of".Localize()} 3: {"Position".Localize()} {i + 1} - {"Auto Calibrate".Localize()}", autoProbePositions, i)); // do the manual prob of the same position yield return(new GetCoarseBedHeight( this, new Vector3(probePosition, startProbeHeight), string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(totalSteps), "Position".Localize(), i + 1, "Low Precision".Localize()), manualProbePositions, i, levelingStrings)); yield return(new GetFineBedHeight( this, string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(totalSteps), "Position".Localize(), i + 1, "Medium Precision".Localize()), manualProbePositions, i, levelingStrings)); yield return(new GetUltraFineBedHeight( this, string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(totalSteps), "Position".Localize(), i + 1, "High Precision".Localize()), manualProbePositions, i, levelingStrings)); yield return(new CalibrateProbeLastPagelInstructions( this, "Done".Localize(), "Your Probe is now calibrated.".Localize() + "\n\n\t• " + "Remove the paper".Localize() + "\n\n" + "Click 'Done' to close this window.".Localize(), autoProbePositions, manualProbePositions)); }
protected override IEnumerator <WizardPage> GetPages() { var levelingStrings = new LevelingStrings(); // If no leveling data has been calculated bool showWelcomeScreen = printer.Settings.Helpers.PrintLevelingData.SampledPositions.Count == 0 && !ProbeCalibrationWizard.UsingZProbe(printer); if (showWelcomeScreen) { yield return(new WizardPage( this, "Initial Printer Setup".Localize(), string.Format( "{0}\n\n{1}", "Congratulations on connecting to your printer. Before starting your first print we need to run a simple calibration procedure.".Localize(), "The next few screens will walk your through calibrating your printer.".Localize())) { WindowTitle = Title }); } // Switch to raw mode and construct leveling structures this.Initialize(); // var probePositions = new List<ProbePosition>(Enumerable.Range(0, levelingPlan.ProbeCount).Select(p => new ProbePosition())); var probePositions = new List <ProbePosition>(levelingPlan.ProbeCount); for (int j = 0; j < levelingPlan.ProbeCount; j++) { probePositions.Add(new ProbePosition()); } 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); // Build welcome text for Print Leveling Overview page string buildWelcomeText() { var secondsPerManualSpot = 10 * 3; var secondsPerAutomaticSpot = 3 * zProbeSamples; var secondsToCompleteWizard = levelingPlan.ProbeCount * (useZProbe ? secondsPerAutomaticSpot : secondsPerManualSpot); secondsToCompleteWizard += (hasHeatedBed ? 60 * 3 : 0); int numberOfSteps = levelingPlan.ProbeCount; int numberOfMinutes = (int)Math.Round(secondsToCompleteWizard / 60.0); if (hasHeatedBed) { 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( "Welcome to the print leveling wizard. Here is a quick overview on what we are going to do.".Localize(), "Select the material you are printing".Localize(), "Home the printer".Localize(), "Heat the bed".Localize(), "Sample the bed at {0} points".Localize().FormatWith(numberOfSteps), "Turn auto leveling on".Localize(), "We should be done in approximately {0} minutes.".Localize().FormatWith(numberOfMinutes), "Click 'Next' to continue.".Localize())); } else { return("{0}\n\n\t• {1}\n\t• {2}\n\t• {3}\n\n{4}\n\n{5}".FormatWith( "Welcome to the print leveling wizard. Here is a quick overview on what we are going to do.".Localize(), "Home the printer".Localize(), "Sample the bed at {0} points".Localize().FormatWith(numberOfSteps), "Turn auto leveling on".Localize(), "We should be done in approximately {0} minutes.".Localize().FormatWith(numberOfMinutes), "Click 'Next' to continue.".Localize())); } } yield return(new WizardPage( this, "Print Leveling Overview".Localize(), buildWelcomeText()) { WindowTitle = Title }); yield return(new HomePrinterPage( this, "Homing The Printer".Localize(), levelingStrings.HomingPageInstructions(useZProbe, hasHeatedBed), useZProbe)); // if there is a level_x_carriage_markdown oem markdown page if (!string.IsNullOrEmpty(printer.Settings.GetValue(SettingsKey.level_x_carriage_markdown))) { yield return(GetLevelXCarriagePage(this, printer)); } // figure out the heating requirements double targetBedTemp = 0; double targetHotendTemp = 0; if (hasHeatedBed) { targetBedTemp = printer.Settings.GetValue <double>(SettingsKey.bed_temperature); } if (!useZProbe) { targetHotendTemp = printer.Settings.Helpers.ExtruderTargetTemperature(0); } if (targetBedTemp > 0 || targetHotendTemp > 0) { string heatingInstructions = ""; if (targetBedTemp > 0 && targetHotendTemp > 0) { // heating both the bed and the hotend heatingInstructions = "Waiting for the bed to heat to ".Localize() + targetBedTemp + "°C\n" + "and the hotend to heat to ".Localize() + targetHotendTemp + "°C.\n" + "\n" + "This will improve the accuracy of print leveling ".Localize() + "and ensure that no filament is stuck to your nozzle.".Localize() + "\n" + "\n" + "Warning! The tip of the nozzle will be HOT!".Localize() + "\n" + "Avoid contact with your skin.".Localize(); } else if (targetBedTemp > 0) { // only heating the bed heatingInstructions = "Waiting for the bed to heat to ".Localize() + targetBedTemp + "°C.\n" + "This will improve the accuracy of print leveling.".Localize(); } else // targetHotendTemp > 0 { // only heating the hotend heatingInstructions += "Waiting for the hotend to heat to ".Localize() + targetHotendTemp + "°C.\n" + "This will ensure that no filament is stuck to your nozzle.".Localize() + "\n" + "\n" + "Warning! The tip of the nozzle will be HOT!".Localize() + "\n" + "Avoid contact with your skin.".Localize(); } yield return(new WaitForTempPage( this, "Waiting For Printer To Heat".Localize(), heatingInstructions, targetBedTemp, new double[] { targetHotendTemp })); } double bedRadius = Math.Min(printer.Settings.GetValue <Vector2>(SettingsKey.bed_size).X, printer.Settings.GetValue <Vector2>(SettingsKey.bed_size).Y) / 2; double startProbeHeight = printer.Settings.GetValue <double>(SettingsKey.print_leveling_probe_start); int i = 0; var probePoints = levelingPlan.GetPrintLevelPositionToSample().ToList(); AutoProbePage autoProbePage = null; if (printer.Settings.Helpers.UseZProbe()) { autoProbePage = new AutoProbePage(this, printer, "Bed Detection", probePoints, probePositions); yield return(autoProbePage); } else { foreach (var goalProbePoint in probePoints) { if (wizardExited) { // Make sure when the wizard is done we turn off the bed heating printer.Connection.TurnOffBedAndExtruders(TurnOff.AfterDelay); if (printer.Settings.GetValue <bool>(SettingsKey.z_homes_to_max)) { printer.Connection.HomeAxis(PrinterConnection.Axis.XYZ); } yield break; } var validProbePosition = EnsureInPrintBounds(printer, goalProbePoint); { yield return(new GetCoarseBedHeight( this, new Vector3(validProbePosition, startProbeHeight), string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(levelingPlan.TotalSteps), "Position".Localize(), i + 1, "Low Precision".Localize()), probePositions, i, levelingStrings)); yield return(new GetFineBedHeight( this, string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(levelingPlan.TotalSteps), "Position".Localize(), i + 1, "Medium Precision".Localize()), probePositions, i, levelingStrings)); yield return(new GetUltraFineBedHeight( this, string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(levelingPlan.TotalSteps), "Position".Localize(), i + 1, "High Precision".Localize()), probePositions, i, levelingStrings)); } i++; } } // if we are not using a z-probe, reset the baby stepping at the successful conclusion of leveling if (!printer.Settings.GetValue <bool>(SettingsKey.use_z_probe)) { // clear the baby stepping so we don't save the old values babySteppingValue = 0; } yield return(new LastPageInstructions( this, "Print Leveling Wizard".Localize(), useZProbe, probePositions)); }
protected override IEnumerator <WizardPage> GetPages() { var levelingStrings = new LevelingStrings(); var autoProbePositions = new List <PrintLevelingWizard.ProbePosition>(1); int hotendCount = Math.Min(2, printer.Settings.Helpers.HotendCount()); var manualProbePositions = new List <List <PrintLevelingWizard.ProbePosition> >(hotendCount); for (int i = 0; i < hotendCount; i++) { manualProbePositions.Add(new List <PrintLevelingWizard.ProbePosition>()); manualProbePositions[i] = new List <PrintLevelingWizard.ProbePosition>(1) { new PrintLevelingWizard.ProbePosition() }; } autoProbePositions.Add(new PrintLevelingWizard.ProbePosition()); // show what steps will be taken yield return(new WizardPage( this, string.Format("{0} {1}", this.Title, "Overview".Localize()), string.Format( "{0}\n\n{1}\n\n{2}\n\n", "Z Calibration measures the z position of the nozzles.".Localize(), "This data is required for software print leveling and ensures good first layer adhesion.".Localize(), "Click 'Next' to continue.".Localize())) { WindowTitle = Title, }); // Initialize - turn off print leveling printer.Connection.AllowLeveling = false; printer.Settings.ForTools <double>(SettingsKey.baby_step_z_offset, (key, value, i) => { // remember the current baby stepping values babySteppingValue[i] = value; // clear them while we measure the offsets printer.Settings.SetValue(key, "0"); }); // Require user confirmation after this point this.RequireCancelConfirmation = true; // add in the homing printer page yield return(new HomePrinterPage( this, levelingStrings.HomingPageInstructions(true, false))); if (LevelingPlan.NeedsToBeRun(printer)) { // start heating up the bed as that will be needed next var bedTemperature = printer.Settings.GetValue <bool>(SettingsKey.has_heated_bed) ? printer.Settings.GetValue <double>(SettingsKey.bed_temperature) : 0; if (bedTemperature > 0) { printer.Connection.TargetBedTemperature = bedTemperature; } } var extruderCount = printer.Settings.GetValue <int>(SettingsKey.extruder_count); var temps = new double[4]; for (int i = 0; i < extruderCount; i++) { temps[i] = printer.Settings.Helpers.ExtruderTargetTemperature(i); } yield return(new WaitForTempPage( this, "Heating the printer".Localize(), ((extruderCount == 1) ? "Waiting for the hotend to heat to ".Localize() + temps[0] + "°C.\n" : "Waiting for the hotends to heat up.".Localize()) + "This will ensure that no filament is stuck to your nozzle.".Localize() + "\n" + "\n" + "Warning! The tip of the nozzle will be HOT!".Localize() + "\n" + "Avoid contact with your skin.".Localize(), 0, temps)); int extruderPriorToMeasure = printer.Connection.ActiveExtruderIndex; if (extruderCount > 1) { // reset the extruder that was active printer.Connection.QueueLine($"T0"); } foreach (var page in DoManualOffsetMeasurment(levelingStrings, autoProbePositions, manualProbePositions)) { yield return(page); } if (extruderCount > 1) { // reset the extruder that was active printer.Connection.QueueLine($"T{extruderPriorToMeasure}"); } for (int i = 0; i < extruderCount; i++) { // clear the baby stepping so we don't save the old values babySteppingValue[i] = 0; } if (hotendCount == 1 && // this could be improved for dual extrusion calibration in the future. But for now it is single extrusion. printer.Settings.Helpers.ProbeBeingUsed && printer.Settings.GetValue <bool>(SettingsKey.validate_probe_offset)) { // tell them about the automatic part and any settings that should be changed yield return(new ZProbePrintCalibrationPartPage( this, printer, "Validating Z Offset".Localize(), "We will now measure the probe offset from the top of a printed calibration object.".Localize())); // measure the top of the part we just printed yield return(new ZProbeCalibrateRetrieveTopProbeData(this, PageTitle)); // tell the user we are done and everything should be working yield return(new ZCalibrationValidateComplete(this, PageTitle)); } else { yield return(new CalibrateProbeRemovePaperInstructions(this, PageTitle)); } }
protected override IEnumerator <PrinterSetupWizardPage> GetWizardSteps() { var levelingStrings = new LevelingStrings(printer.Settings); var autoProbePositions = new List <ProbePosition>(3); var manualProbePositions = new List <ProbePosition>(3); autoProbePositions.Add(new ProbePosition()); manualProbePositions.Add(new ProbePosition()); int totalSteps = 3; // make a welcome page if this is the first time calibrating the probe if (!printer.Settings.GetValue <bool>(SettingsKey.probe_has_been_calibrated)) { yield return(new PrinterSetupWizardPage( this, levelingStrings.InitialPrinterSetupStepText, string.Format( "{0}\n\n{1}", "Congratulations on connecting to your printer. Before starting your first print we need to run a simple calibration procedure.".Localize(), "The next few screens will walk your through calibrating your printer.".Localize()))); } // show what steps will be taken yield return(new PrinterSetupWizardPage( this, "Probe Calibration Overview".Localize(), string.Format( "{0}\n\n\t• {1}\n\t• {2}\n\t• {3}\n\n{4}\n\n{5}", "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 five minutes.".Localize(), "Click 'Next' to continue.".Localize()))); // add in the homing printer page yield return(new HomePrinterPage( this, "Homing The Printer".Localize(), levelingStrings.HomingPageInstructions(true, false), false)); double targetHotendTemp = 0; targetHotendTemp = printer.Settings.Helpers.ExtruderTemperature(0); if (PrintLevelingData.NeedsToBeRun(printer)) { // start heating up the bed as that will be needed next var bedTemperature = printer.Settings.GetValue <bool>(SettingsKey.has_heated_bed) ? printer.Settings.GetValue <double>(SettingsKey.bed_temperature) : 0; if (bedTemperature > 0) { printer.Connection.TargetBedTemperature = bedTemperature; } } yield return(new WaitForTempPage( this, "Waiting For Printer To Heat".Localize(), "Waiting for the hotend to heat to ".Localize() + targetHotendTemp + "°C.\n" + "This will ensure that no filament is stuck to your nozzle.".Localize() + "\n" + "\n" + "Warning! The tip of the nozzle will be HOT!".Localize() + "\n" + "Avoid contact with your skin.".Localize(), 0, targetHotendTemp)); double startProbeHeight = printer.Settings.GetValue <double>(SettingsKey.print_leveling_probe_start); Vector2 probePosition = LevelingPlan.ProbeOffsetSamplePosition(printer); int i = 0; // do the automatic probing of the center position yield return(new AutoProbeFeedback( this, new Vector3(probePosition, startProbeHeight), $"{"Step".Localize()} {i + 1} {"of".Localize()} 3: {"Position".Localize()} {i + 1} - {"Auto Calibrate".Localize()}", autoProbePositions, i)); // show what steps will be taken yield return(new PrinterSetupWizardPage( this, "Measure the nozzle offset".Localize(), "{0}:\n\n\t• {1}\n\n{2}\n\n{3}".FormatWith( "To complete the next few steps you will need".Localize(), "A standard sheet of paper".Localize(), "We will use this paper to measure the distance between the nozzle and the bed.".Localize(), "Click 'Next' to continue.".Localize()))); // do the manual prob of the same position yield return(new GetCoarseBedHeight( this, new Vector3(probePosition, startProbeHeight), string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(totalSteps), "Position".Localize(), i + 1, "Low Precision".Localize()), manualProbePositions, i, levelingStrings)); yield return(new GetFineBedHeight( this, string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(totalSteps), "Position".Localize(), i + 1, "Medium Precision".Localize()), manualProbePositions, i, levelingStrings)); yield return(new GetUltraFineBedHeight( this, string.Format( "{0} {1} {2} - {3}", levelingStrings.GetStepString(totalSteps), "Position".Localize(), i + 1, "High Precision".Localize()), manualProbePositions, i, levelingStrings)); yield return(new CalibrateProbeLastPagelInstructions( this, "Done".Localize(), autoProbePositions, manualProbePositions)); }