diff --git a/takway/board/orangepi.py b/takway/board/orangepi.py index 55911d7..8b5f0ca 100644 --- a/takway/board/orangepi.py +++ b/takway/board/orangepi.py @@ -61,6 +61,7 @@ class OrangePi(BaseHardware): hd_threads = [threading.Thread(target=self.hd_detection_loop)] for hd_thread in hd_threads: hd_thread.start() + self.start_status_light() def hd_detection_loop(self): last_status_1 = False @@ -101,6 +102,13 @@ class OrangePi(BaseHardware): def set_led_off(self, color='red'): wiringpi.digitalWrite(getattr(self, f'LED_PIN_{color}'), GPIO.LOW) + + def start_status_light(self): + for i in range(2): + self.set_led_on("green") + time.sleep(0.5) + self.set_led_off("green") + time.sleep(0.5) if __name__ == '__main__': orangepi = OrangePi() diff --git a/takway/clients/web_socket_client_utils.py b/takway/clients/web_socket_client_utils.py index 3ac5f4e..bbb7aec 100644 --- a/takway/clients/web_socket_client_utils.py +++ b/takway/clients/web_socket_client_utils.py @@ -27,17 +27,6 @@ from takway.clients.client_utils import BaseWebSocketClient from takway.audio_utils import AudioPlayer -def start_status_light(hardware, board): - print(f"start status light running.") - if board == 'orangepi': - for i in range(2): - hardware.set_led_on("green") - time.sleep(0.5) - hardware.set_led_off("green") - time.sleep(0.5) - print(f"led {i} on") - - class WebSocketClinet: def __init__(self, board, @@ -152,8 +141,6 @@ class WebSocketClinet: last_short_power_status = False board = self.board - - start_status_light(recorder.hardware, board) while True: # 开关按键被按下 if recorder.hardware.long_power_status: