Fixes
This commit is contained in:
parent
f200a954b1
commit
352df31f8f
47
main.py
47
main.py
@ -10,7 +10,6 @@ import bottle
|
|||||||
from bottle import route, run, request, post
|
from bottle import route, run, request, post
|
||||||
import time
|
import time
|
||||||
import sys
|
import sys
|
||||||
import signal
|
|
||||||
import logging
|
import logging
|
||||||
import math
|
import math
|
||||||
|
|
||||||
@ -167,7 +166,8 @@ class SerialWriter(threading.Thread):
|
|||||||
time.sleep(5)
|
time.sleep(5)
|
||||||
logging.info("Closing SerialWriter")
|
logging.info("Closing SerialWriter")
|
||||||
def join(self):
|
def join(self):
|
||||||
self.cv.notify_all()
|
with self.cv:
|
||||||
|
self.cv.notify_all()
|
||||||
super().join()
|
super().join()
|
||||||
def setGamma(self, r, g, b):
|
def setGamma(self, r, g, b):
|
||||||
with self.cv:
|
with self.cv:
|
||||||
@ -304,26 +304,6 @@ class AppRunner(threading.Thread):
|
|||||||
def setGamma(self, r, g, b):
|
def setGamma(self, r, g, b):
|
||||||
self.serial.setGamma(r, g, b)
|
self.serial.setGamma(r, g, b)
|
||||||
|
|
||||||
########################################################################
|
|
||||||
# Startup #
|
|
||||||
########################################################################
|
|
||||||
#normalize config
|
|
||||||
for app in config.Apps:
|
|
||||||
if "persistent" not in app.keys():
|
|
||||||
app["persistent"] = False
|
|
||||||
if "guiname" not in app.keys():
|
|
||||||
app["guiname"] = app["name"]
|
|
||||||
|
|
||||||
#remove non existing apps
|
|
||||||
for app in config.Apps:
|
|
||||||
cmd = app["cmd"]
|
|
||||||
if type(cmd) == str and not os.path.isfile(cmd):
|
|
||||||
config.Apps.remove(app)
|
|
||||||
logging.warning("Removed app "+app["name"])
|
|
||||||
|
|
||||||
runner = AppRunner()
|
|
||||||
runner.start()
|
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Web Api #
|
# Web Api #
|
||||||
########################################################################
|
########################################################################
|
||||||
@ -408,9 +388,30 @@ def setGamma(r, g, b):
|
|||||||
runner.setGamma(r, g, b)
|
runner.setGamma(r, g, b)
|
||||||
return "ok"
|
return "ok"
|
||||||
|
|
||||||
|
########################################################################
|
||||||
|
# Startup #
|
||||||
|
########################################################################
|
||||||
|
#normalize config
|
||||||
|
for app in config.Apps:
|
||||||
|
if "persistent" not in app.keys():
|
||||||
|
app["persistent"] = False
|
||||||
|
if "guiname" not in app.keys():
|
||||||
|
app["guiname"] = app["name"]
|
||||||
|
|
||||||
|
#remove non existing apps
|
||||||
|
for app in config.Apps:
|
||||||
|
cmd = app["cmd"]
|
||||||
|
if type(cmd) == str and not os.path.isfile(cmd):
|
||||||
|
config.Apps.remove(app)
|
||||||
|
logging.warning("Removed app "+app["name"])
|
||||||
|
|
||||||
|
runner = AppRunner()
|
||||||
|
runner.start()
|
||||||
|
|
||||||
|
run(host=config.WebHost, port=config.WebPort)
|
||||||
|
|
||||||
########################################################################
|
########################################################################
|
||||||
# Shutdown #
|
# Shutdown #
|
||||||
########################################################################
|
########################################################################
|
||||||
run(host=config.WebHost, port=config.WebPort)
|
|
||||||
running = False
|
running = False
|
||||||
runner.join()
|
runner.join()
|
||||||
|
Loading…
Reference in New Issue
Block a user