From 742a1b1bc2902c1aead9c21aaa61e0da69e28fa3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Tue, 20 Feb 2024 16:14:05 +0100 Subject: [PATCH] added except empty MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- server/app.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/server/app.py b/server/app.py index b868bb8..d1e18f5 100644 --- a/server/app.py +++ b/server/app.py @@ -117,17 +117,17 @@ def mqtt_publisher(ti_queue): artNet = Artnet.Artnet(BINDIP = artnetBindIp, DEBUG = True, SHORTNAME = "PiXelTubeMaster", LONGNAME = "PiXelTubeMaster", PORT = 6454) while True: try: - # try: - start = time.time() - tube_index = ti_queue.get(block=False) - end = time.time() - print("Receiving of tube index took: "+str(end-start)) - tube_index_old = tube_index - # except: - # if tube_index_old is not None: - # tube_index = tube_index_old - # else: - # tube_index = None + try: + start = time.time() + tube_index = ti_queue.get(block=False) + end = time.time() + print("Receiving of tube index took: "+str(end-start)) + tube_index_old = tube_index + except Empty: + if tube_index_old is not None: + tube_index = tube_index_old + else: + tube_index = None # Gets whatever the last Art-Net packet we received is artNetPacket = artNet.readPacket() # Make sure we actually *have* a packet