Finishing up warning messages for conductive probing

Added support for conductive probing to emulator
spend up rendering a bit (check less bounds)
Refactoring trackball a bit
This commit is contained in:
Lars Brubaker 2022-05-19 13:34:04 -07:00
parent c8ba76182c
commit 338bc0c3dd
8 changed files with 65 additions and 15 deletions

View file

@ -256,7 +256,7 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
this,
ProbeStartPosition,
"Conductive Probing".Localize(),
"Measure the nozzle to probe offset using the conductive pad.".Localize(),
"Measuring the nozzle to probe offset using the conductive pad.".Localize(),
manualProbePositions[0]);
yield return conductiveProbeFeedback;
@ -264,18 +264,27 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
if (conductiveProbeFeedback.MovedBelowMinZ)
{
// show an error message
yield return new WizardPage(
var errorPage = new WizardPage(
this,
"Error: Below Conductive Probe Min Z".Localize(),
"The printer moved below the minimum height set for conductive probing. Check that the nozzle is clean and there is continuity with the pad.".Localize());
}
"The printer moved below the minimum height set for conductive probing.".Localize() + "\n"
+ "Check that the nozzle is clean and there is continuity with the pad.".Localize() + "\n\n"
+ "After cleaning the nozzle, run the wizard again.".Localize());
errorPage.Load += (s, e) =>
{
errorPage.ShowWizardFinished();
};
yield return errorPage;
}
else // found a good probe height
{
SetExtruderOffset(autoProbePositions, manualProbePositions, 0);
}
// let the user know we are done with the automatic probing
yield return new ConductiveProbeCalibrateComplete(printer, this, PageTitle);
// let the user know we are done with the automatic probing
yield return new ConductiveProbeCalibrateComplete(printer, this, PageTitle);
}
}
else // collect the probe information manually
{

View file

@ -114,6 +114,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
probePositions[0].Position = nozzleCurrentPosition;
// make sure we are no longer listening for responses
printer.Connection.LineReceived -= PrinterLineRecieved;
// move on to the next page of the wizard
UiThread.RunOnIdle(() => NextButton.InvokeClick());
}
@ -134,6 +136,9 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
// we have gone down too far
// abort with error
this.MovedBelowMinZ = true;
// make sure we are no longer listening for responses
printer.Connection.LineReceived -= PrinterLineRecieved;
printer.Connection.MoveRelative(PrinterCommunication.PrinterConnection.Axis.Z, 10, printer.Settings.ZSpeed());
// move on to the next page of the wizard
UiThread.RunOnIdle(() => NextButton.InvokeClick());
}

View file

@ -146,7 +146,7 @@ namespace MatterHackers.MatterControl
base.OnClosed(e);
}
protected void ShowWizardFinished(Action doneClicked = null)
public void ShowWizardFinished(Action doneClicked = null)
{
var doneButton = new TextButton("Done".Localize(), theme)
{

View file

@ -1316,7 +1316,9 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
// Invoke all item Drawables
foreach (var drawable in itemDrawables)
{
if (drawable.Enabled)
var selectedItemDrawable = drawable as SelectedItemDrawable;
if ((selectedItemDrawable != null && isSelected)
|| (selectedItemDrawable == null && drawable.Enabled))
{
aabbs.Add(drawable.GetWorldspaceAABB(item, isSelected, this.World));
}

View file

@ -227,11 +227,6 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
base.OnDraw(graphics2D);
}
public void OnBeforeDraw3D()
{
RecalculateProjection();
}
public void OnDraw3D()
{
if (hitPlane != null)

View file

@ -1344,7 +1344,7 @@ namespace MatterHackers.MatterControl.PartPreviewWindow
}
}
TrackballTumbleWidget.OnBeforeDraw3D();
TrackballTumbleWidget.RecalculateProjection();
base.OnDraw(graphics2D);
}

View file

@ -67,6 +67,12 @@ namespace MatterHackers.PrinterEmulator
return "ok\n";
}
string TurnOnConductive(string a)
{
this.ConductivePad = true;
return "ok\n";
}
string ChangeToFast(string a)
{
this.RunSlow = false;
@ -77,6 +83,7 @@ namespace MatterHackers.PrinterEmulator
{
{ "A", Echo },
{ "FAST", ChangeToFast },
{ "CONDUCTIVE", TurnOnConductive },
{ "G0", ParseMovmentCommand },
{ "G1", ParseMovmentCommand },
{ "G28", HomeAxis },
@ -126,6 +133,19 @@ namespace MatterHackers.PrinterEmulator
status += $"x_max: {xMaxOpen}\n";
status += $"y_min: open\n";
status += $"z_min: open\n";
if (ConductivePad)
{
if (conductivePadTriggerRegion.Contains(CurrentPosition))
{
status += $"conductive: TRIGGERED\n";
}
else
{
status += $"conductive: open\n";
}
}
status += "ok\n";
return status;
}
@ -752,6 +772,13 @@ ok
public Vector3 XYZProbeOffset { get; set; } = new Vector3(0, 0, -5);
/// <summary>
/// The emulated printer has a conductive pad that can be used to probe the bed.
/// </summary>
public bool ConductivePad { get; set; }
private AxisAlignedBoundingBox conductivePadTriggerRegion = new AxisAlignedBoundingBox(40, 210, -10, 60, 240, 0);
public void Close()
{
this.ShutDown();

View file

@ -265,6 +265,9 @@ Translated:Advanced
English:Advanced Array
Translated:Advanced Array
English:After cleaning the nozzle, run the wizard again.
Translated:After cleaning the nozzle, run the wizard again.
English:After Tool Change G-Code
Translated:After Tool Change G-Code
@ -757,6 +760,9 @@ Translated:Check for Update
English:Check For Update
Translated:Check For Update
English:Check that the nozzle is clean and there is continuity with the pad.
Translated:Check that the nozzle is clean and there is continuity with the pad.
English:Checking Cloud Services
Translated:Checking Cloud Services
@ -2833,6 +2839,9 @@ Translated:Measure the nozzle to probe offset using the conductive pad.
English:Measure Tool
Translated:Measure Tool
English:Measuring the nozzle to probe offset using the conductive pad.
Translated:Measuring the nozzle to probe offset using the conductive pad.
English:Mechanical
Translated:Mechanical
@ -5377,6 +5386,9 @@ Translated:The printer has the ability to move each z motor independently and th
English:The printer is now aliging the z-axis. It will do the following:
Translated:The printer is now aliging the z-axis. It will do the following:
English:The printer moved below the minimum height set for conductive probing.
Translated:The printer moved below the minimum height set for conductive probing.
English:The printer moved below the minimum height set for conductive probing. Check that the nozzle is clean and there is continuity with the pad.
Translated:The printer moved below the minimum height set for conductive probing. Check that the nozzle is clean and there is continuity with the pad.