From a35c38e61efa563e2435237c543ea939783807ac Mon Sep 17 00:00:00 2001 From: yibo <361071264@qq.com> Date: Wed, 16 Sep 2020 09:18:39 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=B0bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ButcherFactory.Form/Controls/WeightControl.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ButcherFactory.Form/Controls/WeightControl.cs b/ButcherFactory.Form/Controls/WeightControl.cs index f14c804..2b3a736 100644 --- a/ButcherFactory.Form/Controls/WeightControl.cs +++ b/ButcherFactory.Form/Controls/WeightControl.cs @@ -182,11 +182,12 @@ namespace ButcherFactory.Controls if (availableCount == 0) { Thread.Sleep(10); - } - char[] buffer = new char[availableCount]; + } + byte[] buffer = new byte[availableCount]; weightPort.Read(buffer, 0, availableCount); - foreach (var c in buffer) - { + foreach (var b in buffer) + { + var c = (char)b; if (c == _dataFormat.Beginchar) { _dataStrBuilder.Clear();