private void ReTrans_Tick(object sender, EventArgs e) { byte[] buffer; if (UartCom.ReHandshake(out buffer)) { if (fail <= 10) { sPort.Write(buffer, 0, 7); tBoxDisplayGet.Text += ("NAK" + Environment.NewLine); fail++; } else { fail = 0; sPort.ReadExisting(); UartCom.rxack = true; UartCom.rxnak = false; ReTrans.Enabled = false; MessageBox.Show("Transmission line is unstable, or Motor is not working" + "Please re-plug in the cable and reset the Motor", "Error!!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { fail = 0; ReTrans.Enabled = false; } }
private void ReTrans_Tick(object sender, EventArgs e) { byte[] buffer; if (UartCom.ReHandshake(out buffer)) { sPort.Write(buffer, 0, 7); tBoxDisplayGet.Text += ("NAK" + Environment.NewLine); } else { ReTrans.Enabled = false; } }