From 29507e676e1597aa6e5910028186d72c4d17afc8 Mon Sep 17 00:00:00 2001 From: IrvingGao <1729854488@qq.com> Date: Tue, 18 Jun 2024 23:43:25 +0800 Subject: [PATCH] [shutdown] fix bugs --- takway/board/orangepi.py | 3 ++- takway/clients/web_socket_client_utils.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/takway/board/orangepi.py b/takway/board/orangepi.py index 29f5867..f59e79c 100644 --- a/takway/board/orangepi.py +++ b/takway/board/orangepi.py @@ -78,7 +78,8 @@ class OrangePi(BaseHardware): if press_time_1: press_duration = (datetime.now() - press_time_1).total_seconds() # if press_duration > 0.01: - if press_duration > 5: + if press_duration > 3: + self.set_led_on('red') subprocess.Popen('sudo shutdown now', shell=True) else: self.long_power_status = not self.long_power_status diff --git a/takway/clients/web_socket_client_utils.py b/takway/clients/web_socket_client_utils.py index 4b202a7..b8bdae4 100644 --- a/takway/clients/web_socket_client_utils.py +++ b/takway/clients/web_socket_client_utils.py @@ -270,7 +270,7 @@ class WebSocketClinet: elif self.speaking_event.is_set(): print(f"{datetime.now()}: wait for speaking finished and listening started or sleep mode.") if board == 'orangepi': - recorder.hardware.set_led_on("red") + recorder.hardware.set_led_on("blue") while self.wakeup_event.is_set(): # 睡眠 or 监听状态 if self.sleep_event.is_set() or self.listening_event.is_set(): @@ -279,7 +279,7 @@ class WebSocketClinet: # print(f"{datetime.now()}: button interrupt (input).") # break if board == 'orangepi': - recorder.hardware.set_led_off("red") + recorder.hardware.set_led_off("blue") # 重新计时 slience_bgn_t = time.time() print(f"{datetime.now()}: restart listening.")