串口读取数据修改
apiclient现场测试
This commit is contained in:
1 parent
6c7278ed45
commit
2bd24f5316
3 files changed
+176
-107
No files matched your search
@@ -66,7 +66,14 @@ namespace WindowsFormsApp1
|
||||
Init.ScanPort?.Open();
|
||||
}
|
||||
// 读取串口接收到的数据
|
||||
ReturnValue = Init.ScanPort.ReadExisting();
|
||||
var dataBuilder = new StringBuilder();
|
||||
while(Init.ScanPort.BytesToRead > 0)
|
||||
{
|
||||
System.Threading.Thread.Sleep(100);
|
||||
dataBuilder.Append(Init.ScanPort.ReadExisting());
|
||||
}
|
||||
ReturnValue = dataBuilder.ToString();
|
||||
|
||||
if (this.InvokeRequired)
|
||||
{
|
||||
this.Invoke(new Action(() =>
|
||||
|
||||
Reference in new issue
Block a user