ACT Blink off by default
This commit is contained in:
parent
8bb57c476b
commit
ed97b1e6c8
27
app.py
27
app.py
|
@ -64,23 +64,31 @@ def getRSSI():
|
|||
signal = str(signal.stdout, 'UTF-8').strip("-").strip("\n")
|
||||
return signal
|
||||
|
||||
def ledSetup():
|
||||
os.system('echo none | sudo tee /sys/class/leds/led0/trigger')
|
||||
os.system('echo none | sudo tee /sys/class/leds/led1/trigger')
|
||||
|
||||
def led( led_id, state ):
|
||||
# 0 : off, 1: on
|
||||
os.system('echo ' + str(state) + ' | sudo tee /sys/class/leds/led' + str(led_id) +'/brightness')
|
||||
|
||||
# Blink the Pi led to allow identification
|
||||
def blinkPy():
|
||||
# disable mmc access led
|
||||
os.system('echo none | sudo tee /sys/class/leds/led0/trigger')
|
||||
os.system('echo none | sudo tee /sys/class/leds/led1/trigger')
|
||||
# ~ os.system('echo none | sudo tee /sys/class/leds/led0/trigger')
|
||||
# ~ os.system('echo none | sudo tee /sys/class/leds/led1/trigger')
|
||||
# Blink 10 times
|
||||
for j in range(10):
|
||||
for j in range(16):
|
||||
# TODO : add dd to NOPASSWD in /etc/sudoers.d/010...
|
||||
os.system('echo 1 | sudo tee /sys/class/leds/led0/brightness') # led on
|
||||
os.system('echo 0 | sudo tee /sys/class/leds/led1/brightness') # led on
|
||||
led(0, 1)
|
||||
led(1, 0)
|
||||
time.sleep(.2)
|
||||
os.system('echo 0 | sudo tee /sys/class/leds/led0/brightness') # led off
|
||||
os.system('echo 1 | sudo tee /sys/class/leds/led1/brightness') # led off
|
||||
led(1, 0)
|
||||
led(0, 1)
|
||||
time.sleep(.2)
|
||||
# restore default behavior
|
||||
os.system('echo mmc0 | sudo tee /sys/class/leds/led0/trigger')
|
||||
os.system('echo default-on | sudo tee /sys/class/leds/led1/trigger')
|
||||
# ~ os.system('echo mmc0 | sudo tee /sys/class/leds/led0/trigger')
|
||||
# ~ os.system('echo default-on | sudo tee /sys/class/leds/led1/trigger')
|
||||
return "OK"
|
||||
|
||||
|
||||
|
@ -135,5 +143,6 @@ def upload_file():
|
|||
return "OK"
|
||||
|
||||
if __name__ == '__main__':
|
||||
ledSetup()
|
||||
# app.run()
|
||||
serve(app, host='127.0.0.1', port=5000, url_scheme='https')
|
||||
|
|
Loading…
Reference in New Issue