Merge pull request #4985 from larsbrubaker/master

Added G4 P1 to conductive probe
This commit is contained in:
Lars Brubaker 2021-02-16 14:46:07 -08:00 committed by GitHub
commit 35deaaa1b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 3 deletions

View file

@ -212,14 +212,26 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
&& printer.Settings.GetValue<bool>(SettingsKey.has_conductive_nozzle)
&& printer.Settings.GetValue<bool>(SettingsKey.measure_probe_offset_conductively))
{
yield return new ConductiveProbeFeedback(
var conductiveProbeFeedback = new ConductiveProbeFeedback(
this,
probeStartPosition,
"Conductive Probing".Localize(),
"Measure the nozzle to probe offset using the conductive pad.".Localize(),
manualProbePositions[0]);
yield return conductiveProbeFeedback;
SetExtruderOffset(autoProbePositions, manualProbePositions, false, 0);
if (conductiveProbeFeedback.MovedBelowMinZ)
{
// show an error message
yield return 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());
}
else // found a good probe height
{
SetExtruderOffset(autoProbePositions, manualProbePositions, false, 0);
}
}
else // collect the probe information manually
{

View file

@ -67,6 +67,8 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
State state = State.WaitingForEndstopStatusStart;
private Vector3 feedRates;
public bool MovedBelowMinZ { get; private set; }
private void PrinterLineRecieved(object sender, string line)
{
// looking for 'conductive: TRIGGERED' in an M119 command
@ -108,12 +110,16 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
{
// we have gone down too far
// abort with error
this.MovedBelowMinZ = true;
// move on to the next page of the wizard
UiThread.RunOnIdle(() => NextButton.InvokeClick());
}
else if (line.StartsWith("ok"))
{
state = State.WaitingForEndstopStatusStart;
// send the next set of commands
printer.Connection.MoveAbsolute(nozzleCurrentPosition, feedRates.X);
printer.Connection.QueueLine("G4 P1");
printer.Connection.QueueLine("M119");
}
break;
@ -128,13 +134,14 @@ namespace MatterHackers.MatterControl.ConfigurationPage.PrintLeveling
NextButton.Enabled = false;
// do a last minute check that the printer is read to do this action
// do a last minute check that the printer is ready to do this action
if (printer.Connection.IsConnected
&& !(printer.Connection.Printing
|| printer.Connection.Paused))
{
printer.Connection.LineReceived += PrinterLineRecieved;
printer.Connection.MoveAbsolute(nozzleCurrentPosition, feedRates.X);
printer.Connection.QueueLine("G4 P1");
printer.Connection.QueueLine("M119");
}