Exemple #1
0
        private void SampleProbePoints()
        {
            double startProbeHeight = printer.Settings.GetValue <double>(SettingsKey.print_leveling_probe_start);

            for (var i = 0; i < probePoints.Count; i++)
            {
                var goalProbePosition = probePoints[i];

                if (this.HasBeenClosed)
                {
                    // 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);
                    }

                    break;
                }

                var validProbePosition = PrintLevelingWizard.EnsureInPrintBounds(printer, goalProbePosition);
                var probePosition      = new Vector3(validProbePosition, startProbeHeight);

                //this.lastReportedPosition = printer.Connection.LastReportedPosition;

                probePositionsWidget.ActiveProbeIndex = i;
                probePositionsWidget.Invalidate();

                this.StartSampling(i, probePosition);

                autoResetEvent.WaitOne();
            }

            probePositionsWidget.ActiveProbeIndex = probePoints.Count;

            this.NextButton.Enabled = true;

            // Auto advance
            UiThread.RunOnIdle(this.NextButton.InvokeClick);
        }
        private void SampleProbePoints()
        {
            if (waitingToCompleteNextSample)
            {
                return;
            }

            double startProbeHeight = printer.Settings.GetValue <double>(SettingsKey.print_leveling_probe_start) + ZProbePrintCalibrationPartPage.CalibrationObjectHeight(printer);

            if (!dataCollected)
            {
                var validProbePosition2D = PrintLevelingWizard.EnsureInPrintBounds(printer, printer.Bed.BedCenter);
                positionToSample = new Vector3(validProbePosition2D, startProbeHeight);

                this.SamplePoint();
            }
            else
            {
                SaveSamplePoints();
                CancelValidation();
            }
        }