Add running_on_rpi function

This commit is contained in:
ABelliqueux 2022-11-15 15:57:59 +01:00
parent 015ebffc61
commit 41559a2d8d
1 changed files with 9 additions and 1 deletions

10
app.py
View File

@ -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)