[bug] board
This commit is contained in:
parent
235c6f414e
commit
1f3f0db335
|
@ -1,6 +1,6 @@
|
|||
from takway.board.base_hd import BaseHardware
|
||||
import threading
|
||||
import datetime
|
||||
from datetime import datetime
|
||||
try:
|
||||
import wiringpi
|
||||
from wiringpi import GPIO
|
||||
|
@ -69,17 +69,17 @@ class OrangePi(BaseHardware):
|
|||
while True:
|
||||
button_status_1 = wiringpi.digitalRead(self.BUTTON_PIN_1)
|
||||
if not button_status_1 and last_status_1:
|
||||
press_time_1 = datetime.datetime.now()
|
||||
press_time_1 = datetime.now()
|
||||
elif button_status_1 and not last_status_1:
|
||||
if press_time_1:
|
||||
press_duration = (datetime.datetime.now() - press_time_1).total_seconds()
|
||||
print(f"press_duration: {press_duration}")
|
||||
press_duration = (datetime.now() - press_time_1).total_seconds()
|
||||
print(f"{datetime.now()}: press_duration: {press_duration}")
|
||||
if press_duration > 1:
|
||||
self.long_power_status = ~self.long_power_status
|
||||
print(f"long_power_status: {self.long_power_status}")
|
||||
print(f"{datetime.now()}: long_power_status: {self.long_power_status} {self.short_power_status}")
|
||||
else:
|
||||
self.short_power_status = ~self.short_power_status
|
||||
print(f"short_power_status: {self.short_power_status}")
|
||||
print(f"{datetime.now()}: short_power_status: {self.short_power_status} {self.long_power_status}")
|
||||
press_time_1 = None
|
||||
|
||||
last_status_1 = button_status_1
|
||||
|
|
|
@ -454,7 +454,7 @@ class WebSocketClinet:
|
|||
tts_audio = audio_player.check_audio_type(tts_audio, return_type=None)
|
||||
for i in range(0, len(tts_audio), audio_player.CHUNK):
|
||||
audio_player.stream.write(tts_audio[i:i+audio_player.CHUNK])
|
||||
print("Playing {} data...{}/{}".format(item[0], i, len(tts_audio)))
|
||||
# print("Playing {} data...{}/{}".format(item[0], i, len(tts_audio)))
|
||||
|
||||
# 关闭状态
|
||||
if not self.wakeup_event.is_set():
|
||||
|
|
Loading…
Reference in New Issue