private void btnStartTL_Click(object sender, EventArgs e)
        {
            lblEFProgressInfo.Text = Localization.getString("probingProbingOn") + " Z"; //"Probing on X";
            lblTLProgress.Text     = "";
            lblTLStatus.Text       = "";
            probingValuesIndex     = 0;
            probingAction          = probingMode.toolLenght;
            setRBEnable(cBnow, false);

            for (int i = 0; i < stateCommandsMax; i++)
            {
                stateCommands[i] = "";
            }

            probeStartMachine  = grbl.posMachine;
            probingValuesIndex = 0;
            int k = 1;

            stateCommands[k++] = string.Format("{0} Z-{1} F{2};", ProbeCommand, nUDProbeTravelZ.Value, nUDProbeFeed.Value);    // index=1 will be send below
            stateCommands[k++] = string.Format("G53 G00 Z{0};", probeStartMachine.Z);
            //        stateCommands[k++] = string.Format("G91 G00 Z{0};", nUDProbeTravelZ.Value);

            probingCount = 1;
            sendCommandEvent(new CmdEventArgs(stateCommands[probingCount++].Replace(',', '.')));
            setProgressTL(nUDProbeTravelZ.Value);
            isIdle         = false;
            timer1.Enabled = true;
        }
        private void btnStartEF_Click(object sender, EventArgs e)
        {
            timer1.Enabled   = false;
            probeX           = false; probeY = false;
            probingCount     = 1;
            probingStep2     = "";
            probingStep3     = "";
            probingMoveSave  = "";
            lblEFStatus.Text = "";
            ZatX             = 0; ZatY = 0;

            fillStrings();
            sendCommandEvent(new CmdEventArgs("G91"));

            if (!probeAxisX())
            {
                probingCount += 2;
                if (!probeAxisY())
                {
                    probingCount += 2;
                    probeAxisZ();
                }
            }
            timer1.Enabled      = true;
            isIdle              = false;
            btnCancelEF.Enabled = true;
            btnStartEF.Enabled  = false;
            tBAngle.Text        = "0";
            probingAction       = probingMode.edgeFinder;
            setRBEnable(cBnow, false);
        }
        private void btnStartEF_Click(object sender, EventArgs e)
        {
            Logger.Trace("Start Edge Finder");
            timer1.Enabled   = false;
            probeX           = false; probeY = false;
            probingCount     = 1;
            probingStep2     = "";
            probingStep3     = "";
            probingMoveSave  = "";
            lblEFStatus.Text = "";
            ZatX             = 0; ZatY = 0;

            fillStrings();      // check which axis to probe, set probeX, probeY, CMD-Strings
            sendCommandEvent(new CmdEventArgs("G91"));

            if (!probeAxisX())          // if X, then Y and Z will started via Timer / stateMachine
            {
                probingCount += 2;
                if (!probeAxisY())      // if not X but Y, then Z will started via Timer / stateMachine
                {
                    probingCount += 2;
                    probeAxisZ();       // only Z
                }
            }
            timer1.Enabled      = true;
            isIdle              = false;
            btnCancelEF.Enabled = true;
            btnStartEF.Enabled  = false;
            tBAngle.Text        = "0";
            probingAction       = probingMode.edgeFinder;
            setRBEnable(cBnow, false);
        }
        private void probingFinishTL()
        {
            timer1.Enabled = false;
            probeX         = false; probeY = false;
            probingCount   = 1;
            probingAction  = probingMode.noProbing;
//            setRBEnable(cBnow, true);
        }
 private void probingFinishTL()
 {
     timer1.Enabled      = false;
     probeX              = false; probeY = false;
     probingCount        = 1;
     probingAction       = probingMode.noProbing;
     progressBarTL.Value = 0;        // 2021-01-05
     setRBEnable(cBnow, true);       // 2020-08-09
 }
 private void probingFinishCF()
 {
     timer1.Enabled      = false;
     probeX              = false; probeY = false;
     probingCount        = 1;
     btnCancelCF.Enabled = false;
     btnStartCF.Enabled  = true;
     probingAction       = probingMode.noProbing;
     setRBEnable(cBnow, true);
 }
 private void probingFinishCF()
 {
     timer1.Enabled      = false;
     probeX              = false; probeY = false;
     probingCount        = 1;
     btnCancelCF.Enabled = false;
     btnStartCF.Enabled  = true;
     probingAction       = probingMode.noProbing;
     progressBarCF.Value = 0;        // 2021-01-05
     setRBEnable(cBnow, true);
 }
 private void probingFinishEF()
 {
     timer1.Enabled      = false;
     probeX              = false; probeY = false;
     probingCount        = 1;
     probingStep2        = "";
     probingStep3        = "";
     probingMoveSave     = "";
     btnCancelEF.Enabled = false;
     btnStartEF.Enabled  = true;
     //           btnCancelCF.Enabled = false;
     //           btnStartCF.Enabled = true;
     probingAction = probingMode.noProbing;
     setRBEnable(cBnow, true);
 }
        private void btnStartCF_Click(object sender, EventArgs e)
        {
            btnCancelCF.Enabled    = true;
            btnStartCF.Enabled     = false;
            lblEFProgressInfo.Text = Localization.getString("probingProbingOn") + " X"; //"Probing on X";
            lblCFProgress.Text     = "";
            lblCFStatus.Text       = "";
            probingValuesIndex     = 0;
            probingAction          = probingMode.centerFinder;
            setRBEnable(cBnow, false);

            for (int i = 0; i < stateCommandsMax; i++)
            {
                stateCommands[i] = "";
            }

            probeStartMachine  = grbl.posMachine;
            probingValuesIndex = 0;
            int k = 1;

            if (rBCF1.Checked)
            {
                stateCommands[k++] = string.Format("{0} X-{1} F{2};", ProbeCommand, nUDWorkpieceDiameter.Value, nUDProbeFeed.Value);    // index=1 will be send below
                stateCommands[k++] = string.Format("G53 G00 X{0};", probeStartMachine.X);
                stateCommands[k++] = string.Format("{0} X{1} F{2};", ProbeCommand, nUDWorkpieceDiameter.Value, nUDProbeFeed.Value);
                stateCommands[k++] = string.Format("G53 G00 X{0};", probeStartMachine.X);                                               // replace 4
                stateCommands[k++] = string.Format("{0} Y-{1} F{2};", ProbeCommand, nUDWorkpieceDiameter.Value, nUDProbeFeed.Value);
                stateCommands[k++] = string.Format("G53 G00 Y{0};", probeStartMachine.Y);
                stateCommands[k++] = string.Format("{0} Y{1} F{2};", ProbeCommand, nUDWorkpieceDiameter.Value, nUDProbeFeed.Value);
                stateCommands[k++] = string.Format("G53 G00 Y{0};", probeStartMachine.Y);
            }
            else
            {
                stateCommands[k++] = string.Format("{0} X{1} F{2};", ProbeCommand, nUDProbeTravelX.Value, nUDProbeFeed.Value);  // probe 0
                stateCommands[k++] = string.Format("G91 G00 X-{0};", nUDProbeSaveX.Value);
                stateCommands[k++] = string.Format("Z{0};", nUDProbeTravelZ.Value);
                stateCommands[k++] = string.Format("X{0};", (nUDWorkpieceDiameter.Value + 2 * nUDProbeSaveX.Value + nUDDiameter.Value));
                stateCommands[k++] = string.Format("Z-{0}", nUDProbeTravelZ.Value);
                // k=6
                stateCommands[k++] = string.Format("{0} X-{1} F{2};", ProbeCommand, nUDProbeTravelX.Value, nUDProbeFeed.Value); // probe 1
                stateCommands[k++] = string.Format("G91 G00 X{0};", nUDProbeSaveX.Value);
                stateCommands[k++] = string.Format("Z{0};", nUDProbeTravelZ.Value);
                stateCommands[k++] = string.Format("X-{0};", (nUDProbeSaveX.Value + nUDWorkpieceDiameter.Value / 2));         // 9 will be replaced
                stateCommands[k++] = string.Format("G91 G00 Y-{0};", (nUDProbeTravelY.Value + nUDWorkpieceDiameter.Value / 2));
                stateCommands[k++] = string.Format("Z-{0}", nUDProbeTravelZ.Value);
                // 12
                stateCommands[k++] = string.Format("{0} Y{1} F{2};", ProbeCommand, nUDWorkpieceDiameter.Value, nUDProbeFeed.Value); // probe 2
                stateCommands[k++] = string.Format("G91 G00 Y-{0};", nUDProbeSaveY.Value);
                stateCommands[k++] = string.Format("Z{0};", nUDProbeTravelZ.Value);
                stateCommands[k++] = string.Format("Y{0};", (nUDWorkpieceDiameter.Value + 2 * nUDProbeSaveY.Value + nUDDiameter.Value));
                stateCommands[k++] = string.Format("Z-{0}", nUDProbeTravelZ.Value);
                // 17
                stateCommands[k++] = string.Format("{0} Y-{1} F{2};", ProbeCommand, nUDWorkpieceDiameter.Value, nUDProbeFeed.Value);    // probe 3
                stateCommands[k++] = string.Format("G91 G00 Y{0};", nUDProbeSaveY.Value);
                stateCommands[k++] = string.Format("Z{0};", nUDProbeTravelZ.Value);
                stateCommands[k++] = string.Format("G53 G00 Y{0};", probeStartMachine.Y);
            }

            probingCount = 1;
            sendCommandEvent(new CmdEventArgs(stateCommands[probingCount++].Replace(',', '.')));
            setProgressCF(nUDWorkpieceDiameter.Value);
            isIdle         = false;
            timer1.Enabled = true;
        }