串口消息通过颜色区分
This commit is contained in:
13
kunlun.py
13
kunlun.py
@@ -119,13 +119,12 @@ def download_callback(total_packets, success_count, error_count):
|
||||
|
||||
# 打印串口收到的字符
|
||||
def print_device_str(data:bytearray):
|
||||
data:list[bytearray]=data.split(b"\r\n")
|
||||
for item in data:
|
||||
try:
|
||||
d=item.decode('utf-8')
|
||||
myprint("DEVICE:",d.strip())
|
||||
except Exception as e:
|
||||
myprint("DEVICE:",item)
|
||||
data=data.replace(b"\r\n",b"\n")
|
||||
try:
|
||||
d=data.decode('utf-8')
|
||||
mywrite(d)
|
||||
except Exception as e:
|
||||
mywrite(f"{data}\n")
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user