Merge pull request #11 from DanielToyama/main

修复未正确读取配置文件中端口数据问题
main^2
illegal prompt 2024-08-30 16:12:56 +08:00 committed by GitHub
commit e95d747b84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 5 deletions

11
main.py
View File

@ -52,12 +52,12 @@ exp_image_dict = {'41-65-93': 'A1', '87-152-13': 'A2', '213-109-81': 'A3', '23-2
class SerialManager: class SerialManager:
p1Serial = serial.Serial(COM_PORT, COM_BAUDRATE)
settingPacket = bytearray([40, 0, 0, 0, 0, 41])
startUp = False
recvData = ""
def __init__(self): def __init__(self):
self.p1Serial = serial.Serial(COM_PORT, COM_BAUDRATE)
self.settingPacket = bytearray([40, 0, 0, 0, 0, 41])
self.startUp = False
self.recvData = ""
self.touchQueue = queue.Queue() self.touchQueue = queue.Queue()
self.data_lock = threading.Lock() self.data_lock = threading.Lock()
self.touchThread = threading.Thread(target=self.touch_thread) self.touchThread = threading.Thread(target=self.touch_thread)
@ -66,6 +66,7 @@ class SerialManager:
self.now_touch_keys = [] self.now_touch_keys = []
self.ping_touch_thread() self.ping_touch_thread()
def start(self): def start(self):
print(f"开始监听 {COM_PORT} 串口...") print(f"开始监听 {COM_PORT} 串口...")
self.touchThread.start() self.touchThread.start()