示例#1
0
        public string FindEdge(int delaySlow, int backoffCount, int backoffDelay, Axis axisToFindEdgeFor)
        {
            // X and Y move towards home to find their edges, Z moves away from home (towards bed)
            axisToFindEdgeFor.StepDirection = axisToFindEdgeFor.ID == "Z" ? true : false;

            while (true)
            {
                if (Program.EStopCondition) return "";

                // Use Z Limit pin regardless of axis we're finding the edge for
                if (AxisZ.IsAtLimit()) break;
                axisToFindEdgeFor.Step();

                DelayBy(delaySlow);
            }

            int edgeFoundAt = axisToFindEdgeFor.Location;
            axisToFindEdgeFor.StepDirection = !axisToFindEdgeFor.StepDirection;

            for (int i = 0; i < backoffCount; i++)
            {
                axisToFindEdgeFor.Step();
                DelayBy(backoffDelay);
            }

            AxisZ.ResetLimitReached();
            return "Edge touched at: " + edgeFoundAt.ToString();
        }
示例#2
0
        public string FindEdge(int delaySlow, int backoffCount, int backoffDelay, Axis axisToFindEdgeFor)
        {
            bool wasIgnoringLimits = IgnoreLimitSwitches;

            IgnoreLimitSwitches = false;

            // X and Y move towards home to find their edges, Z moves away from home (towards bed)
            axisToFindEdgeFor.StepDirection = axisToFindEdgeFor.ID == "Z" ? true : false;

            while (true)
            {
                if (Program.EStopCondition)
                {
                    return("");
                }

                // Use Z Limit pin regardless of axis we're finding the edge for
                if (AxisZ.IsAtLimit())
                {
                    break;
                }
                axisToFindEdgeFor.Step();

                DelayBy(delaySlow);
            }

            int edgeFoundAt = axisToFindEdgeFor.Location;

            axisToFindEdgeFor.StepDirection = !axisToFindEdgeFor.StepDirection;

            for (int i = 0; i < backoffCount; i++)
            {
                axisToFindEdgeFor.Step();
                DelayBy(backoffDelay);
            }

            AxisZ.ResetLimitReached();

            IgnoreLimitSwitches = wasIgnoringLimits;
            return("Edge touched at: " + edgeFoundAt.ToString());
        }
示例#3
0
        public void StartJogMode()
        {
            double jogX;
            double jogXAmount;
            double jogXDelays = 0;

            double jogY;
            double jogYAmount;
            double jogYDelays = 0;

            while (this.JogMode != JogModeType.None)
            {
                if (jogXDelays == 0)
                {
                    jogX = ExternalDevices.JogXPort.Read();

                    jogXAmount = System.Math.Abs(jogX);
                    if (jogXAmount < 8)
                    {
                        jogXAmount = 0;
                    }
                    if (jogXAmount > 40)
                    {
                        jogXAmount = 50;
                    }
                    jogXDelays = 51 - jogXAmount;

                    if (jogXAmount > 0)
                    {
                        Axis axis = AxisX;
                        if (JogMode == JogModeType.YZ)
                        {
                            axis = AxisZ;                                       // Z moves instead of X
                        }
                        axis.StepDirection = jogX > 0;
                        axis.Step();
                    }
                }

                jogXDelays--;

                if (jogYDelays == 0)
                {
                    jogY = -ExternalDevices.JogYPort.Read();

                    jogYAmount = System.Math.Abs(jogY);
                    if (jogYAmount < 8)
                    {
                        jogYAmount = 0;
                    }
                    if (jogYAmount > 40)
                    {
                        jogYAmount = 50;
                    }
                    jogYDelays = 51 - jogYAmount;

                    if (jogYAmount > 0)
                    {
                        Axis axis = AxisY;
                        if (JogMode == JogModeType.XZ)
                        {
                            axis = AxisZ;                                       // Z moves instead of Y
                        }
                        axis.StepDirection = jogY > 0;
                        axis.Step();
                    }
                }

                jogYDelays--;
            }
        }