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); } }
protected override void OnOpen() { lock (rxBuf) { Console.WriteLine("Client connected!"); rxBuf.Clear(); txBuf.Clear(); mPaused = false; RX.Start(); TX.Start(); SendConnected(); //SendVersion(); //SendStatus(); } }
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); } }
public void OpenCom() { mMachineStatus = MacStatus.Connecting; if (!com.IsOpen) { com.Open(); com.DiscardOutBuffer(); com.DiscardInBuffer(); } lock (this) { GrblReset(); RX.Start(); TX.Start(); } }
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(); } }