コード例 #1
0
        public void OpenCom()
        {
            try
            {
                SetStatus(MacStatus.Connecting);

                if (!com.IsOpen)
                {
                    com.Open();
                }

                lock (this)
                {
                    GrblReset();
                    RX.Start();
                    TX.Start();
                }
            }
            catch (Exception ex)
            {
                Logger.LogException("OpenCom", ex);
                SetStatus(MacStatus.Disconnected);
                System.Windows.Forms.MessageBox.Show(ex.Message, Strings.BoxConnectErrorTitle, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
                com.Close(true);
            }
        }
コード例 #2
0
 protected override void OnOpen()
 {
     lock (rxBuf)
     {
         Console.WriteLine("Client connected!");
         rxBuf.Clear();
         txBuf.Clear();
         mPaused = false;
         RX.Start();
         TX.Start();
         SendConnected();
         //SendVersion();
         //SendStatus();
     }
 }
コード例 #3
0
ファイル: GrblCore.cs プロジェクト: ninjanody/LaserGRBL
        public void OpenCom()
        {
            try
            {
                SetStatus(MacStatus.Connecting);
                com.PortName = mPortName;
                com.BaudRate = mBaudRate;

                Logger.LogMessage("OpenCom", "Open {0} @ {1} baud", com.PortName.ToUpper(), com.BaudRate);

                if (!com.IsOpen)
                {
                    try
                    {
                        com.Open();
                    }
                    catch (System.IO.IOException ioex)
                    {
                        if (char.IsDigit(mPortName[mPortName.Length - 1]) && char.IsDigit(mPortName[mPortName.Length - 2]))                         //two digits port like COM23
                        {
                            //FIX https://github.com/arkypita/LaserGRBL/issues/31
                            com.PortName = mPortName.Substring(0, mPortName.Length - 1);                             //remove last digit and try again

                            Logger.LogMessage("OpenCom", "Retry open {0} @ {1} baud", com.PortName.ToUpper(), com.BaudRate);
                            com.Open();
                        }
                        else
                        {
                            throw ioex;
                        }
                    }

                    com.DiscardOutBuffer();
                    com.DiscardInBuffer();
                }

                lock (this)
                {
                    GrblReset();
                    RX.Start();
                    TX.Start();
                }
            }
            catch (Exception ex)
            {
                Logger.LogException("OpenCom", ex);
            }
        }
コード例 #4
0
        public void OpenCom()
        {
            mMachineStatus = MacStatus.Connecting;

            if (!com.IsOpen)
            {
                com.Open();
                com.DiscardOutBuffer();
                com.DiscardInBuffer();
            }

            lock (this)
            {
                GrblReset();
                RX.Start();
                TX.Start();
            }
        }
コード例 #5
0
        public void OpenCom()
        {
            if (!opened)
            {
                opened = true;
                EmuLog("Client connected!");

                lock (rxBuf)
                {
                    rxBuf.Clear();
                    txBuf.Clear();
                }

                mPaused = false;
                mCheck  = false;
                RX.Start();
                TX.Start();

                SendVersion();
            }
        }