Example #1
0
        /// <summary>
        /// Executes a homing sequence based on the settings within the HomingParams variable and waits until the execution is complete
        /// </summary>
        /// <returns>true if home routine was successful</returns>
        public bool DoHome()
        {
            int  timeout = 5 * 60 * 1000;
            bool success = false;

            StartDoHome();
            _Controller.WaitForThreadComplete(_HomingParams.DefaultThread, 0);
            Stopwatch sw = new Stopwatch();

            sw.Start();
            while (!success)
            {
                success = ((HOMING_STATE)_Controller.GetUserData(_HomingParams.StatusBit) == HOMING_STATE.COMPLETE);
                if (sw.ElapsedMilliseconds > timeout)
                {
                    break;
                }
                Thread.Sleep(100);
            }
            return(success);
        }