rgbStripController is not a thread
This commit is contained in:
parent
babf6f676b
commit
50d967378e
@ -3,11 +3,11 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
|
import signal
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
try:
|
try:
|
||||||
|
|
||||||
running = True
|
running = True
|
||||||
if(os.path.dirname(sys.argv[0]) is not ""):
|
if(os.path.dirname(sys.argv[0]) is not ""):
|
||||||
os.chdir(os.path.dirname(sys.argv[0]))
|
os.chdir(os.path.dirname(sys.argv[0]))
|
||||||
@ -21,13 +21,19 @@ def main():
|
|||||||
# when there are new values for the strip
|
# when there are new values for the strip
|
||||||
from rgbUtils.rgbStripController import rgbStripController
|
from rgbUtils.rgbStripController import rgbStripController
|
||||||
rgbStripController = rgbStripController()
|
rgbStripController = rgbStripController()
|
||||||
rgbStripController.start()
|
#rgbStripController.start()
|
||||||
|
|
||||||
|
#signal.signal(signal.SIGINT, rgbStripController.stop())
|
||||||
|
#signal.signal(signal.SIGTERM, rgbStripController.stop())
|
||||||
|
|
||||||
# the effectController handles the effects and pushes the values to the rgbStripContoller
|
# the effectController handles the effects and pushes the values to the rgbStripContoller
|
||||||
# it also calls the backendProvider's onChange function when there are changes made on the effects
|
# it also calls the backendProvider's onChange function when there are changes made on the effects
|
||||||
from rgbUtils.effectController import effectController
|
from rgbUtils.effectController import effectController
|
||||||
effectController = effectController(rgbStripController)
|
effectController = effectController(rgbStripController)
|
||||||
|
|
||||||
|
#signal.signal(signal.SIGINT, effectController.stopAll())
|
||||||
|
#signal.signal(signal.SIGTERM, effectController.stopAll())
|
||||||
|
|
||||||
# register effectControllers onRGBStripRegistered and onRGBStripUnregistered handler on the rgbStripContoller to detect added or removed strips
|
# register effectControllers onRGBStripRegistered and onRGBStripUnregistered handler on the rgbStripContoller to detect added or removed strips
|
||||||
rgbStripController.addOnRGBStripRegisteredHandler(
|
rgbStripController.addOnRGBStripRegisteredHandler(
|
||||||
effectController.onRGBStripRegistered)
|
effectController.onRGBStripRegistered)
|
||||||
@ -43,11 +49,17 @@ def main():
|
|||||||
webSocketThread = WebSocketProvider.ThreadedWebSocketServer(
|
webSocketThread = WebSocketProvider.ThreadedWebSocketServer(
|
||||||
effectController, rgbStripController)
|
effectController, rgbStripController)
|
||||||
|
|
||||||
|
#signal.signal(signal.SIGINT, webSocketThread.stop())
|
||||||
|
#signal.signal(signal.SIGTERM, webSocketThread.stop())
|
||||||
|
|
||||||
print("starting UPDSocketProvider:8002")
|
print("starting UPDSocketProvider:8002")
|
||||||
import BackendProvider.UDPSocketProvider as UPDSocketProvider
|
import BackendProvider.UDPSocketProvider as UPDSocketProvider
|
||||||
udpSocketThread = UPDSocketProvider.ThreadedUDPServer(
|
udpSocketThread = UPDSocketProvider.ThreadedUDPServer(
|
||||||
effectController, rgbStripController)
|
effectController, rgbStripController)
|
||||||
|
|
||||||
|
#signal.signal(signal.SIGINT, udpSocketThread.stop())
|
||||||
|
#signal.signal(signal.SIGTERM, udpSocketThread.stop())
|
||||||
|
|
||||||
while running:
|
while running:
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
|
|
||||||
@ -56,9 +68,18 @@ def main():
|
|||||||
print(e, traceback.format_exc())
|
print(e, traceback.format_exc())
|
||||||
finally:
|
finally:
|
||||||
print('shutting down the LED-Server')
|
print('shutting down the LED-Server')
|
||||||
|
try:
|
||||||
webSocketThread.stop()
|
webSocketThread.stop()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
udpSocketThread.stop()
|
udpSocketThread.stop()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
effectController.stopAll()
|
effectController.stopAll()
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
x
Reference in New Issue
Block a user