From 62c8c751fdaa83677092d19d27b96736e3e13825 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ebbe=20Ba=C3=9F?= Date: Thu, 15 Feb 2024 23:38:23 +0100 Subject: [PATCH] test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ebbe Baß --- server/exampleReceiver.py | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/server/exampleReceiver.py b/server/exampleReceiver.py index c8f64de..f2e8948 100644 --- a/server/exampleReceiver.py +++ b/server/exampleReceiver.py @@ -12,20 +12,36 @@ def get_eth0_ip(): print(f"Error getting eth0 IP: {e}") exit -artnetBindIP = "10.0.0.228" +debug = True -artnet = Artnet.Artnet(BINDIP = artnetBindIP, DEBUG = True, SHORTNAME = "PiXelTubeMaster", LONGNAME = "PiXelTubeMaster", PORT = 6454) +### ArtNet Config ### +artnetBindIp = str(get_eth0_ip()) +artnetUniverse = 0 + +### Art-Net Setup ### +# Sets debug in Art-Net module. +# Creates Artnet socket on the selected IP and Port +artNet = Artnet.Artnet(artnetBindIp, DEBUG=debug) while True: try: - artNetPacket = artnet.readPacket() + # Gets whatever the last Art-Net packet we received is + artNetPacket = artNet.readPacket() + # Make sure we actually *have* a packet if artNetPacket is not None and artNetPacket.data is not None: - if artNetPacket.universe == 0: - print("Universe was the specified universe: "+str(artNetPacket.universe)) + # Checks to see if the current packet is for the specified DMX Universe + if artNetPacket.universe == artnetUniverse: + print("Received specified universe: "+str(artNetPacket.universe)) + + # Print a newline so things look nice :) else: - print("Universe was not the specified: "+str(artNetPacket.universe)) - # Stores the packet data array + print("Did not receive specified universe. The received universe was universe: "+str(artNetPacket.universe)) + + time.sleep(0.1) + except KeyboardInterrupt: - artnet.close() break - time.sleep(0.01) \ No newline at end of file + +# Close the various connections cleanly so nothing explodes :) +artNet.close() +sys.exit() \ No newline at end of file