make validation have feedback

issue: MatterHackers/MCCentral#6126
Add leveling feedback to printing dialog (like heating)
This commit is contained in:
LarsBrubaker 2020-10-28 19:44:02 -07:00
parent 76d0b8d9d1
commit 7af4ff5571
2 changed files with 42 additions and 1 deletions

View file

@ -30,7 +30,11 @@ either expressed or implied, of the FreeBSD Project.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MatterControl.Printing;
using MatterHackers.Agg;
using MatterHackers.Localizations;
using MatterHackers.MatterControl.ConfigurationPage.PrintLeveling;
using MatterHackers.MatterControl.SlicerConfiguration;
using MatterHackers.VectorMath;
@ -373,6 +377,41 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
}
positionsToSample = levelingPlan.GetPrintLevelPositionToSample().ToList();
StartReporting();
}
private void StartReporting()
{
ApplicationController.Instance.Tasks.Execute(
"Leveling".Localize(),
printer,
(reporter, cancellationToken) =>
{
var progressStatus = new ProgressStatus();
while (validationRunning)
{
if (activeProbeIndex == 0)
{
progressStatus.Status = "Validating";
}
else
{
progressStatus.Status = $"Probing point {activeProbeIndex} of {sampledPositions.Count}";
}
progressStatus.Progress0To1 = (activeProbeIndex + 1) / (double)sampledPositions.Count;
reporter.Report(progressStatus);
Thread.Sleep(100);
}
return Task.CompletedTask;
},
new RunningTaskOptions()
{
ReadOnlyReporting = true
});
}
private void SampleNextPoint()
@ -388,6 +427,8 @@ namespace MatterHackers.MatterControl.PrinterCommunication.Io
queuedCommands.Enqueue($"M280 P0 S{servoDeployCommand}");
}
Thread.Sleep(500);
positionToSampleWithProbeOffset = positionToSample;
// subtract out the probe offset

@ -1 +1 @@
Subproject commit f5ccdb8dcb3a38d1d9dc33a92977c6936f1f0fbf
Subproject commit 65c4736b10b9b096c60a8dcda5dc916a4cc5f63b