From ae5d9bb3f5a6150cdd374446f1aaeba5f0cced70 Mon Sep 17 00:00:00 2001 From: IrvingGao <1729854488@qq.com> Date: Tue, 18 Jun 2024 21:57:18 +0800 Subject: [PATCH] [client] fix bugs --- takway/clients/web_socket_client_utils.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/takway/clients/web_socket_client_utils.py b/takway/clients/web_socket_client_utils.py index bfa0ce7..269cf74 100644 --- a/takway/clients/web_socket_client_utils.py +++ b/takway/clients/web_socket_client_utils.py @@ -138,19 +138,21 @@ class WebSocketClinet: recorder: takway.audio_utils.Recorder, recorder object """ print("Hardware trigger thread started.") - last_short_power_status = False + # last_short_power_status = False board = self.board while True: # 开关按键被按下 if recorder.hardware.long_power_status: self.wakeup_event.set() + ''' # 短时按键被按下,打断 if recorder.hardware.short_power_status and not last_short_power_status: # self.interrupt_event.set() recorder.hardware.short_power_status = False # print("Interrupt conversation.") last_short_power_status = recorder.hardware.short_power_status + ''' else: self.wakeup_event.clear() time.sleep(0.01) @@ -269,7 +271,7 @@ class WebSocketClinet: print(f"{datetime.now()}: wait for speaking close and listening start or sleep mode.") if board == 'orangepi': recorder.hardware.set_led_on("red") - while True: + while self.wakeup_event.is_set(): # 睡眠 or 监听状态 if self.sleep_event.is_set() or self.listening_event.is_set(): break