From a11ea859389174ec54c56190e0d6f6c1b34e8d0f Mon Sep 17 00:00:00 2001 From: ERR0RPR0MPT Date: Sat, 13 Apr 2024 01:55:18 +0800 Subject: [PATCH] =?UTF-8?q?update=20v0.0.6=20-=20=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E6=89=8B=E5=8A=A8=E9=87=8D=E6=96=B0=E8=BF=9E=E6=8E=A5=E6=B8=B8?= =?UTF-8?q?=E6=88=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 ++ main.py | 11 +++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ad400c5..e83f217 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,8 @@ 11. 如果单点延迟低但滑动时延迟变高, 请将脚本中 `TOUCH_THREAD_SLEEP_MODE` 修改为 False, 或者可以调小 `TOUCH_THREAD_SLEEP_DELAY` 的值 +游戏时如果不小心断开连接, 请在控制台输入 `start` 并回车来重新连接游戏 + ## 注意 想要加 2P 的重新复制一下脚本并添加串口 COM4 到 COM44 的转发就好 diff --git a/main.py b/main.py index b180063..3795dd8 100644 --- a/main.py +++ b/main.py @@ -105,8 +105,8 @@ class SerialManager: self.settingPacket[i] = ord(data[i]) ser.write(self.settingPacket) elif byte_data == 65: - print("已连接到游戏") self.startUp = True + print("已连接到游戏") def send_touch(self, ser, data): ser.write(data) @@ -268,4 +268,11 @@ exp_image_width, exp_image_height = exp_image.size if __name__ == "__main__": serial_manager = SerialManager() serial_manager.start() - getevent() + threading.Thread(target=getevent).start() + while True: + input_str = input() + if input_str == 'start': + serial_manager.startUp = True + print("已连接到游戏") + else: + print("未知的输入")