Add running_on_rpi function
This commit is contained in:
parent
015ebffc61
commit
41559a2d8d
10
app.py
10
app.py
|
@ -90,6 +90,13 @@ def get_RSSI():
|
||||||
print(rssi_signal)
|
print(rssi_signal)
|
||||||
return XMLify(rssi_signal, child_node_name="rssi")
|
return XMLify(rssi_signal, child_node_name="rssi")
|
||||||
|
|
||||||
|
def running_on_rpi():
|
||||||
|
with open("/proc/cpuinfo", "r") as wl:
|
||||||
|
for line in wl:
|
||||||
|
if line.lower().find("raspberry") > 0 :
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def led_init():
|
def led_init():
|
||||||
'''
|
'''
|
||||||
Set ACT and PWR leds trigger and turn them off
|
Set ACT and PWR leds trigger and turn them off
|
||||||
|
@ -205,6 +212,7 @@ def upload_file(over_write=1):
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
# Turn ACT and POW leds off on start
|
# Turn ACT and POW leds off on start
|
||||||
# ~ led_init()
|
if running_on_rpi():
|
||||||
|
led_init()
|
||||||
# ~ app.run()
|
# ~ app.run()
|
||||||
serve(app, host='127.0.0.1', port=5000, url_scheme=HTTP_url_scheme)
|
serve(app, host='127.0.0.1', port=5000, url_scheme=HTTP_url_scheme)
|
||||||
|
|
Loading…
Reference in New Issue