From 41559a2d8d2f048028e80f15ce5640e2b44881e4 Mon Sep 17 00:00:00 2001 From: ABelliqueux Date: Tue, 15 Nov 2022 15:57:59 +0100 Subject: [PATCH] Add running_on_rpi function --- app.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 390919e..1b4ec29 100755 --- a/app.py +++ b/app.py @@ -90,6 +90,13 @@ def get_RSSI(): print(rssi_signal) 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(): ''' Set ACT and PWR leds trigger and turn them off @@ -205,6 +212,7 @@ def upload_file(over_write=1): if __name__ == '__main__': # Turn ACT and POW leds off on start - # ~ led_init() + if running_on_rpi(): + led_init() # ~ app.run() serve(app, host='127.0.0.1', port=5000, url_scheme=HTTP_url_scheme)