Rename LevelingWizardContext -> LevelingWizard, consolidate types
- Merge temporary LevelingWizardX into LevelingWizard
This commit is contained in:
parent
8b1dc1ab35
commit
bc9d05b6e4
18 changed files with 148 additions and 146 deletions
|
|
@ -37,7 +37,7 @@ using MatterHackers.VectorMath;
|
|||
|
||||
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
||||
{
|
||||
public class PrintLevelingWizard : LevelingWizardContext
|
||||
public class PrintLevelingWizard : LevelingWizard
|
||||
{
|
||||
private LevelingPlan levelingPlan;
|
||||
|
||||
|
|
@ -59,7 +59,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
|
||||
// If no leveling data has been calculated
|
||||
bool showWelcomeScreen = printer.Settings.Helpers.GetPrintLevelingData().SampledPositions.Count == 0
|
||||
&& !LevelingWizardX.UsingZProbe(printer);
|
||||
&& !LevelingWizard.UsingZProbe(printer);
|
||||
|
||||
if (showWelcomeScreen)
|
||||
{
|
||||
|
|
@ -276,128 +276,6 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
}
|
||||
}
|
||||
|
||||
public static class LevelingWizardX
|
||||
{
|
||||
//protected PrintLevelingContext printLevelWizard;
|
||||
//private static SystemWindow printLevelWizardWindow;
|
||||
//protected PrinterConfig printer;
|
||||
//private ThemeConfig theme;
|
||||
|
||||
public static void ShowPrintLevelWizard(PrinterConfig printer, ThemeConfig theme)
|
||||
{
|
||||
// turn off print leveling
|
||||
PrintLevelingStream.AllowLeveling = false;
|
||||
|
||||
// ************ CreateAndShowWizard ********************
|
||||
|
||||
// clear any data that we are going to be acquiring (sampled positions, after z home offset)
|
||||
var levelingData = new PrintLevelingData()
|
||||
{
|
||||
LevelingSystem = printer.Settings.GetValue<LevelingSystem>(SettingsKey.print_leveling_solution)
|
||||
};
|
||||
|
||||
printer.Settings.SetValue(SettingsKey.baby_step_z_offset, "0");
|
||||
|
||||
LevelingPlan levelingPlan;
|
||||
|
||||
switch (levelingData.LevelingSystem)
|
||||
{
|
||||
case LevelingSystem.Probe3Points:
|
||||
levelingPlan = new LevelWizard3Point(printer);
|
||||
break;
|
||||
|
||||
case LevelingSystem.Probe7PointRadial:
|
||||
levelingPlan = new LevelWizard7PointRadial(printer);
|
||||
break;
|
||||
|
||||
case LevelingSystem.Probe13PointRadial:
|
||||
levelingPlan = new LevelWizard13PointRadial(printer);
|
||||
break;
|
||||
|
||||
case LevelingSystem.Probe100PointRadial:
|
||||
levelingPlan = new LevelWizard100PointRadial(printer);
|
||||
break;
|
||||
|
||||
case LevelingSystem.Probe3x3Mesh:
|
||||
levelingPlan = new LevelWizardMesh(printer, 3, 3);
|
||||
break;
|
||||
|
||||
case LevelingSystem.Probe5x5Mesh:
|
||||
levelingPlan = new LevelWizardMesh(printer, 5, 5);
|
||||
break;
|
||||
|
||||
case LevelingSystem.Probe10x10Mesh:
|
||||
levelingPlan = new LevelWizardMesh(printer, 10, 10);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
var levelingContext = new PrintLevelingWizard(levelingPlan, printer);
|
||||
|
||||
var printLevelWizardWindow = DialogWindow.Show(new LevelingWizardRootPage(levelingContext));
|
||||
printLevelWizardWindow.Closed += (s, e) =>
|
||||
{
|
||||
// If leveling was on when we started, make sure it is on when we are done.
|
||||
PrintLevelingStream.AllowLeveling = true;
|
||||
|
||||
printLevelWizardWindow = null;
|
||||
|
||||
// make sure we raise the probe on close
|
||||
if (printer.Settings.GetValue<bool>(SettingsKey.has_z_probe)
|
||||
&& printer.Settings.GetValue<bool>(SettingsKey.use_z_probe)
|
||||
&& printer.Settings.GetValue<bool>(SettingsKey.has_z_servo))
|
||||
{
|
||||
// make sure the servo is retracted
|
||||
var servoRetract = printer.Settings.GetValue<double>(SettingsKey.z_servo_retracted_angle);
|
||||
printer.Connection.QueueLine($"M280 P0 S{servoRetract}");
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Title = string.Format("{0} - {1}", ApplicationController.Instance.ProductName, "Probe Calibration Wizard".Localize());
|
||||
public static bool UsingZProbe(PrinterConfig printer)
|
||||
{
|
||||
// we have a probe that we are using and we have not done leveling yet
|
||||
return printer.Settings.GetValue<bool>(SettingsKey.has_z_probe)
|
||||
&& printer.Settings.GetValue<bool>(SettingsKey.use_z_probe);
|
||||
}
|
||||
|
||||
public static bool NeedsToBeRun(PrinterConfig printer)
|
||||
{
|
||||
// we have a probe that we are using and we have not done leveling yet
|
||||
return UsingZProbe(printer) && !printer.Settings.GetValue<bool>(SettingsKey.probe_has_been_calibrated);
|
||||
}
|
||||
|
||||
public static void ShowProbeCalibrationWizard(PrinterConfig printer, ThemeConfig theme)
|
||||
{
|
||||
// turn off print leveling
|
||||
PrintLevelingStream.AllowLeveling = false;
|
||||
|
||||
var levelingContext = new ProbeCalibrationWizard(printer);
|
||||
|
||||
var probeCalibrationWizardWindow = DialogWindow.Show(new LevelingWizardRootPage(levelingContext));
|
||||
probeCalibrationWizardWindow.Closed += (s, e) =>
|
||||
{
|
||||
// If leveling was on when we started, make sure it is on when we are done.
|
||||
PrintLevelingStream.AllowLeveling = true;
|
||||
|
||||
probeCalibrationWizardWindow = null;
|
||||
|
||||
// make sure we raise the probe on close
|
||||
if (printer.Settings.GetValue<bool>(SettingsKey.has_z_probe)
|
||||
&& printer.Settings.GetValue<bool>(SettingsKey.use_z_probe)
|
||||
&& printer.Settings.GetValue<bool>(SettingsKey.has_z_servo))
|
||||
{
|
||||
// make sure the servo is retracted
|
||||
var servoRetract = printer.Settings.GetValue<double>(SettingsKey.z_servo_retracted_angle);
|
||||
printer.Connection.QueueLine($"M280 P0 S{servoRetract}");
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
// this class is so that it is not passed by value
|
||||
public class ProbePosition
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace MatterHackers.MatterControl
|
|||
protected TextButton nextButton;
|
||||
protected PrinterConfig printer;
|
||||
|
||||
public LevelingWizardPage(LevelingWizardContext wizardContext, string headerText, string instructionsText)
|
||||
public LevelingWizardPage(LevelingWizard wizardContext, string headerText, string instructionsText)
|
||||
{
|
||||
this.printer = wizardContext.Printer;
|
||||
this.WindowTitle = wizardContext.WindowTitle;
|
||||
|
|
|
|||
|
|
@ -33,9 +33,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
public class LevelingWizardRootPage : DialogPage
|
||||
{
|
||||
private LevelingWizardContext levelingContext;
|
||||
private LevelingWizard levelingContext;
|
||||
|
||||
public LevelingWizardRootPage(LevelingWizardContext levelingContext)
|
||||
public LevelingWizardRootPage(LevelingWizard levelingContext)
|
||||
{
|
||||
this.levelingContext = levelingContext;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ using MatterHackers.VectorMath;
|
|||
|
||||
namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
||||
{
|
||||
public class ProbeCalibrationWizard : LevelingWizardContext
|
||||
public class ProbeCalibrationWizard : LevelingWizard
|
||||
{
|
||||
public ProbeCalibrationWizard(PrinterConfig printer)
|
||||
: base(printer)
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
private EventHandler unregisterEvents;
|
||||
protected Vector3 probeStartPosition;
|
||||
|
||||
public AutoProbeFeedback(LevelingWizardContext context, Vector3 probeStartPosition, string headerText, List<ProbePosition> probePositions, int probePositionsBeingEditedIndex)
|
||||
public AutoProbeFeedback(LevelingWizard context, Vector3 probeStartPosition, string headerText, List<ProbePosition> probePositions, int probePositionsBeingEditedIndex)
|
||||
: base(context, headerText, headerText)
|
||||
{
|
||||
this.probeStartPosition = probeStartPosition;
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
private List<ProbePosition> autoProbePositions;
|
||||
private List<ProbePosition> manualProbePositions;
|
||||
|
||||
public CalibrateProbeLastPagelInstructions(LevelingWizardContext context, string headerText, string instructionsText,
|
||||
public CalibrateProbeLastPagelInstructions(LevelingWizard context, string headerText, string instructionsText,
|
||||
List<ProbePosition> autoProbePositions,
|
||||
List<ProbePosition> manualProbePositions)
|
||||
: base(context, headerText, instructionsText)
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
protected JogControls.MoveButton zPlusControl;
|
||||
protected JogControls.MoveButton zMinusControl;
|
||||
|
||||
public FindBedHeight(LevelingWizardContext context, string pageDescription, string setZHeightCoarseInstruction1, string setZHeightCoarseInstruction2, double moveDistance,
|
||||
public FindBedHeight(LevelingWizard context, string pageDescription, string setZHeightCoarseInstruction1, string setZHeightCoarseInstruction2, double moveDistance,
|
||||
List<ProbePosition> probePositions, int probePositionsBeingEditedIndex)
|
||||
: base(context, pageDescription, setZHeightCoarseInstruction1)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
protected Vector3 probeStartPosition;
|
||||
|
||||
public GetCoarseBedHeight(LevelingWizardContext context, Vector3 probeStartPosition, string pageDescription, List<ProbePosition> probePositions,
|
||||
public GetCoarseBedHeight(LevelingWizard context, Vector3 probeStartPosition, string pageDescription, List<ProbePosition> probePositions,
|
||||
int probePositionsBeingEditedIndex, LevelingStrings levelingStrings)
|
||||
: base(context, pageDescription, "Using the [Z] controls on this screen, we will now take a coarse measurement of the extruder height at this position.".Localize(),
|
||||
levelingStrings.CoarseInstruction2, 1, probePositions, probePositionsBeingEditedIndex)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
public class GetFineBedHeight : FindBedHeight
|
||||
{
|
||||
public GetFineBedHeight(LevelingWizardContext context, string pageDescription, List<ProbePosition> probePositions,
|
||||
public GetFineBedHeight(LevelingWizard context, string pageDescription, List<ProbePosition> probePositions,
|
||||
int probePositionsBeingEditedIndex, LevelingStrings levelingStrings)
|
||||
: base(context, pageDescription, levelingStrings.FineInstruction1, levelingStrings.FineInstruction2, .1, probePositions, probePositionsBeingEditedIndex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
private bool haveDrawn = false;
|
||||
|
||||
public GetUltraFineBedHeight(LevelingWizardContext context, string pageDescription, List<ProbePosition> probePositions,
|
||||
public GetUltraFineBedHeight(LevelingWizard context, string pageDescription, List<ProbePosition> probePositions,
|
||||
int probePositionsBeingEditedIndex, LevelingStrings levelingStrings)
|
||||
: base(context, pageDescription, levelingStrings.UltraFineInstruction1, levelingStrings.FineInstruction2, .02, probePositions, probePositionsBeingEditedIndex)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
private ProbePosition probePosition;
|
||||
private EventHandler unregisterEvents;
|
||||
|
||||
public GettingThirdPointFor2PointCalibration(LevelingWizardContext context, string pageDescription, Vector3 probeStartPosition, string instructionsText,
|
||||
public GettingThirdPointFor2PointCalibration(LevelingWizard context, string pageDescription, Vector3 probeStartPosition, string instructionsText,
|
||||
ProbePosition probePosition)
|
||||
: base(context, pageDescription, instructionsText)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
private EventHandler unregisterEvents;
|
||||
private bool autoAdvance;
|
||||
|
||||
public HomePrinterPage(LevelingWizardContext context, string headerText, string instructionsText, bool autoAdvance)
|
||||
public HomePrinterPage(LevelingWizard context, string headerText, string instructionsText, bool autoAdvance)
|
||||
: base(context, headerText, instructionsText)
|
||||
{
|
||||
this.autoAdvance = autoAdvance;
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
private List<ProbePosition> probePositions;
|
||||
|
||||
public LastPageInstructions(LevelingWizardContext context, string pageDescription, string instructionsText, List<ProbePosition> probePositions)
|
||||
public LastPageInstructions(LevelingWizard context, string pageDescription, string instructionsText, List<ProbePosition> probePositions)
|
||||
: base(context, pageDescription, instructionsText)
|
||||
{
|
||||
this.probePositions = probePositions;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
{
|
||||
public class SelectMaterialPage : LevelingWizardPage
|
||||
{
|
||||
public SelectMaterialPage(LevelingWizardContext context, string headerText, string instructionsText)
|
||||
public SelectMaterialPage(LevelingWizard context, string headerText, string instructionsText)
|
||||
: base(context, headerText, instructionsText)
|
||||
{
|
||||
contentRow.AddChild(
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
|
|||
private TextWidget hotEndDoneText;
|
||||
double hotEndTargetTemp;
|
||||
|
||||
public WaitForTempPage(LevelingWizardContext context,
|
||||
public WaitForTempPage(LevelingWizard context,
|
||||
string step, string instructions,
|
||||
double targetBedTemp, double targetHotendTemp)
|
||||
: base(context, step, instructions)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue