[client] fix bugs
This commit is contained in:
parent
b47fe8d21e
commit
ae5d9bb3f5
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue