diff --git a/csv/system_info.json b/csv/system_info.json index 02cf3e9..c82636f 100755 --- a/csv/system_info.json +++ b/csv/system_info.json @@ -1 +1 @@ -{"update_available": false, "first_boot": true} +{"update_available": false, "first_boot": false} \ No newline at end of file diff --git a/server.py b/server.py index 1dde748..8d5e528 100755 --- a/server.py +++ b/server.py @@ -33,6 +33,7 @@ api_caller.sendline('A') displaying_screensaver = False uploading = False screensaver_p = None +ticker_stopped = False professional = json.load(open('csv/display_settings.json', 'r'))[0] == "Professional" command = 300 @@ -174,12 +175,18 @@ def start(): global ticker global api_caller global professional + global ticker_stopped if displaying_screensaver: screensaver_p.close() ticker = pexpect.spawn("sudo -E python3 stockTicker.py") #api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 api_caller.py") api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 database_caller.py") displaying_screensaver = False + + if ticker_stopped: + ticker = pexpect.spawn("sudo -E python3 stockTicker.py") + ticker_stopped = False + api_caller.sendline('A') ticker.sendline('K') @@ -194,11 +201,21 @@ def stop(): global ticker global api_caller global professional + global ticker_stopped + + ticker.sendline('K') + if not displaying_screensaver: - ticker.sendline('K') + ticker.close() else: screensaver_p.close() + if not ticker_stopped: + + time.sleep(2) # give time for leds to turn off + ticker.close() + ticker_stopped = True + if displaying_screensaver: screensaver_p.close() @@ -206,6 +223,7 @@ def stop(): #api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 api_caller.py") api_caller = pexpect.spawn("sudo -E taskset -c 3 python3 database_caller.py") displaying_screensaver = False + return index() @app.route("/update", methods=['PUT','POST'])