update start light
This commit is contained in:
parent
70ba63b7e8
commit
67d156d3f4
|
@ -61,6 +61,7 @@ class OrangePi(BaseHardware):
|
||||||
hd_threads = [threading.Thread(target=self.hd_detection_loop)]
|
hd_threads = [threading.Thread(target=self.hd_detection_loop)]
|
||||||
for hd_thread in hd_threads:
|
for hd_thread in hd_threads:
|
||||||
hd_thread.start()
|
hd_thread.start()
|
||||||
|
self.start_status_light()
|
||||||
|
|
||||||
def hd_detection_loop(self):
|
def hd_detection_loop(self):
|
||||||
last_status_1 = False
|
last_status_1 = False
|
||||||
|
@ -102,6 +103,13 @@ class OrangePi(BaseHardware):
|
||||||
def set_led_off(self, color='red'):
|
def set_led_off(self, color='red'):
|
||||||
wiringpi.digitalWrite(getattr(self, f'LED_PIN_{color}'), GPIO.LOW)
|
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__':
|
if __name__ == '__main__':
|
||||||
orangepi = OrangePi()
|
orangepi = OrangePi()
|
||||||
while True:
|
while True:
|
||||||
|
|
|
@ -27,17 +27,6 @@ from takway.clients.client_utils import BaseWebSocketClient
|
||||||
from takway.audio_utils import AudioPlayer
|
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:
|
class WebSocketClinet:
|
||||||
def __init__(self,
|
def __init__(self,
|
||||||
board,
|
board,
|
||||||
|
@ -152,8 +141,6 @@ class WebSocketClinet:
|
||||||
last_short_power_status = False
|
last_short_power_status = False
|
||||||
|
|
||||||
board = self.board
|
board = self.board
|
||||||
|
|
||||||
start_status_light(recorder.hardware, board)
|
|
||||||
while True:
|
while True:
|
||||||
# 开关按键被按下
|
# 开关按键被按下
|
||||||
if recorder.hardware.long_power_status:
|
if recorder.hardware.long_power_status:
|
||||||
|
|
Loading…
Reference in New Issue