Ejemplo n.º 1
0
        public AXISSTATUS[] AxesStatus = new AXISSTATUS[2];             // 托架的兩軸狀態,應通過AxesStatus[AXIS1]和AxesStatus[AXIS2]引用

        public Mount()
        {
            mConnection = null;
            MCVersion = 0;
            IsEQMount = false;

            Positions[0] = 0;
            Positions[1] = 0;
            TargetPositions[0] = 0;
            TargetPositions[1] = 0;
            SlewingSpeed[0] = 0;
            SlewingSpeed[1] = 0;
            AxesStatus[0] = new AXISSTATUS { FullStop = false, NotInitialized = true, HighSpeed = false, Slewing = false, SlewingForward = false, SlewingTo = false };
            AxesStatus[1] = new AXISSTATUS { FullStop = false, NotInitialized = true, HighSpeed = false, Slewing = false, SlewingForward = false, SlewingTo = false };
        }
Ejemplo n.º 2
0
        public AXISSTATUS[] AxesStatus = new AXISSTATUS[2];             // 托架的兩軸狀態,應通過AxesStatus[AXIS1]和AxesStatus[AXIS2]引用

        public Mount()
        {
            mConnection = null;
            MCVersion   = 0;
            IsEQMount   = false;

            Positions[0]       = 0;
            Positions[1]       = 0;
            TargetPositions[0] = 0;
            TargetPositions[1] = 0;
            SlewingSpeed[0]    = 0;
            SlewingSpeed[1]    = 0;
            AxesStatus[0]      = new AXISSTATUS {
                FullStop = false, NotInitialized = true, HighSpeed = false, Slewing = false, SlewingForward = false, SlewingTo = false
            };
            AxesStatus[1] = new AXISSTATUS {
                FullStop = false, NotInitialized = true, HighSpeed = false, Slewing = false, SlewingForward = false, SlewingTo = false
            };
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Build a connection to mount via COM
        /// </summary>
        /// <param name="TelescopePort">the COM port number for connection</param>
        /// Raise IOException
        public virtual void Connect_COM(int TelescopePort)
        {
            // May raise IOException
            //var hCom = new SerialPort(string.Format("\\$device\\COM{0}", TelescopePort));
            var hCom = new SerialPort(string.Format("COM{0}", TelescopePort));

            // Origional Code in C++
            //// Set communication parameter.
            //GetCommState(hCom, &dcb);
            //dcb.BaudRate = CBR_9600;
            //dcb.fOutxCtsFlow = FALSE;
            //dcb.fOutxDsrFlow = FALSE;
            //dcb.fDtrControl = DTR_CONTROL_DISABLE;
            //dcb.fDsrSensitivity = FALSE;
            //dcb.fTXContinueOnXoff = TRUE;
            //dcb.fOutX = FALSE;
            //dcb.fInX = FALSE;
            //dcb.fErrorChar = FALSE;
            //dcb.fNull = FALSE;
            //dcb.fRtsControl = RTS_CONTROL_DISABLE;
            //dcb.fAbortOnError = FALSE;
            //dcb.ByteSize = 8;
            //dcb.fParity = NOPARITY;
            //dcb.StopBits = ONESTOPBIT;
            //SetCommState(hCom, &dcb);

            //// Communication overtime parameter
            //GetCommTimeouts(hCom, &TimeOuts);
            //TimeOuts.ReadIntervalTimeout = 30;			// Maxim interval between two charactors, set according to Celestron's hand control.
            //TimeOuts.ReadTotalTimeoutAstroMisc = 500;	// Timeout for reading operation.
            //TimeOuts.ReadTotalTimeoutMultiplier = 2;	// DOUBLE the reading timeout
            //TimeOuts.WriteTotalTimeoutAstroMisc = 30;	// Write timeout
            //TimeOuts.WriteTotalTimeoutMultiplier = 2;	// DOUBLE the writing timeout
            //SetCommTimeouts(hCom, &TimeOuts);

            //// Set RTS to high level, this will disable TX driver in iSky.
            //EscapeCommFunction(hCom, CLRRTS);

            // Set communication parameter
            hCom.BaudRate = SerialConnect_COM.CBR.CBR_9600;
            // fOutxCTSFlow
            // fOutxDsrFlow
            hCom.DtrEnable = false;
            // fDsrSensitivity
            hCom.Handshake = Handshake.RequestToSendXOnXOff;
            // fOutX
            // fInX
            // fErrorChar
            // fNull
            hCom.RtsEnable = false;
            // fAboveOnError
            hCom.Parity   = Parity.None;
            hCom.DataBits = 8;
            hCom.StopBits = StopBits.One;

            hCom.ReadTimeout  = 1000;
            hCom.WriteTimeout = 60;

            hCom.Open();
            mConnection = new SerialConnect_COM(hCom);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Build a connection to mount via COM
        /// </summary>
        /// <param name="TelescopePort">the COM port number for connection</param>
        /// Raise IOException
        public virtual void Connect_COM(int TelescopePort)
        {
            // May raise IOException 
            //var hCom = new SerialPort(string.Format("\\$device\\COM{0}", TelescopePort));
            var hCom = new SerialPort(string.Format("COM{0}", TelescopePort));

            // Origional Code in C++
            //// Set communication parameter.
            //GetCommState(hCom, &dcb);
            //dcb.BaudRate = CBR_9600;
            //dcb.fOutxCtsFlow = FALSE;
            //dcb.fOutxDsrFlow = FALSE;
            //dcb.fDtrControl = DTR_CONTROL_DISABLE;
            //dcb.fDsrSensitivity = FALSE;
            //dcb.fTXContinueOnXoff = TRUE;
            //dcb.fOutX = FALSE;
            //dcb.fInX = FALSE;
            //dcb.fErrorChar = FALSE;
            //dcb.fNull = FALSE;
            //dcb.fRtsControl = RTS_CONTROL_DISABLE;
            //dcb.fAbortOnError = FALSE;
            //dcb.ByteSize = 8;
            //dcb.fParity = NOPARITY;
            //dcb.StopBits = ONESTOPBIT;
            //SetCommState(hCom, &dcb);

            //// Communication overtime parameter
            //GetCommTimeouts(hCom, &TimeOuts);
            //TimeOuts.ReadIntervalTimeout = 30;			// Maxim interval between two charactors, set according to Celestron's hand control.
            //TimeOuts.ReadTotalTimeoutAstroMisc = 500;	// Timeout for reading operation.
            //TimeOuts.ReadTotalTimeoutMultiplier = 2;	// DOUBLE the reading timeout
            //TimeOuts.WriteTotalTimeoutAstroMisc = 30;	// Write timeout
            //TimeOuts.WriteTotalTimeoutMultiplier = 2;	// DOUBLE the writing timeout
            //SetCommTimeouts(hCom, &TimeOuts);

            //// Set RTS to high level, this will disable TX driver in iSky.
            //EscapeCommFunction(hCom, CLRRTS);

            // Set communication parameter
            hCom.BaudRate = SerialConnect_COM.CBR.CBR_9600;
            // fOutxCTSFlow
            // fOutxDsrFlow
            hCom.DtrEnable = false;
            // fDsrSensitivity            
            hCom.Handshake = Handshake.RequestToSendXOnXOff;
            // fOutX
            // fInX
            // fErrorChar
            // fNull
            hCom.RtsEnable = false;
            // fAboveOnError
            hCom.Parity = Parity.None;
            hCom.DataBits = 8;
            hCom.StopBits = StopBits.One;

            hCom.ReadTimeout = 1000;
            hCom.WriteTimeout = 60;

            hCom.Open();
            mConnection = new SerialConnect_COM(hCom);
        }