From b643b1037e14755d6d83cd661c5419e2798240ff Mon Sep 17 00:00:00 2001 From: vc4 <287920192@qq.com> Date: Sat, 27 Apr 2024 09:05:57 +0800 Subject: [PATCH] backup codes --- scomm.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scomm.py b/scomm.py index bdae6f0..5ca591a 100755 --- a/scomm.py +++ b/scomm.py @@ -24,7 +24,7 @@ def uint16(b): return b[0]*256+b[1] def int16(b): d = (b[0]*256+b[1]) - return d>=0x80 and (d-0x10000) or d + return d>=0x8000 and (d-0x10000) or d class UIproc(): def __init__(self, app): @@ -214,7 +214,8 @@ class SerComm(): t.start() def receiveDataLoop(self): - self.com.flush() + while self.com.in_waiting > 0: + self.com.read(self.com.in_waiting) while not self.comProgressStop: try: if self.com.is_open: