示例#1
0
        /// <summary>
        /// Disconnect the current stepper. If stepper has been stopped
        /// or no serial port exists, nothing will happen.
        /// </summary>
        private void _DisconnectStepper()
        {
            // Check if stpper exists
            if (_Stepper == null)
            {
                return;
            }

            // Close the stepper
            if (_Stepper.IsOpen)
            {
                _Stepper.Close();
                _ConsolePrintMessage("Stepper on " + _Stepper.PortName + " is closed.", MessageLevel.Info);
            }
            else
            {
                _ConsolePrintMessage("Stepper serial port is closed.", MessageLevel.Info);
            }

            // Reset the reference to the stepper
            _Stepper = null;
        }