[bug] short button
This commit is contained in:
1 parent
8734a8c12c
commit
36f0b09852
2 files changed
+16
-20
No files matched your search
@@ -142,17 +142,12 @@ class WebSocketClinet:
|
||||
if recorder.hardware.long_power_status:
|
||||
self.wakeup_event.set()
|
||||
# 短时按键被按下,打断
|
||||
try:
|
||||
if recorder.hardware.short_power_status and not last_short_power_status:
|
||||
self.speaking_event.clear()
|
||||
self.listening_event.set()
|
||||
recorder.hardware.short_power_status = False
|
||||
print("Interrupt conversation.")
|
||||
last_short_power_status = ~recorder.hardware.short_power_status
|
||||
else:
|
||||
last_short_power_status = recorder.hardware.short_power_status
|
||||
except:
|
||||
pass
|
||||
if recorder.hardware.short_power_status and not last_short_power_status:
|
||||
self.speaking_event.clear()
|
||||
self.listening_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)
|
||||
|
||||
Reference in new issue
Block a user