just removed the dumbest mechanism ever. WHY CHECK IF UNIVERSE IS IN LIST IF ALL THE USED UNIVERSES ARE GETTING SENDT TO ME SO I ONLY HAVE TO UPDATE AND PUBLISH

Signed-off-by: Ebbe Baß <ebbe.bass>
main
Ebbe Baß 2024-02-14 22:06:14 +01:00
parent d08a8f5420
commit b1b480da08
1 changed files with 13 additions and 17 deletions

View File

@ -112,25 +112,21 @@ def connect_mqtt():
return client return client
def start_mqtt_publishers(universe_count): def start_mqtt_publishers(universe_count):
universe_list = list(range(universe_count))
# Create and start a thread for each universe # Create and start a thread for each universe
mqtt_client = connect_mqtt() mqtt_client = connect_mqtt()
artnetBindIp = get_eth0_ip() artnetBindIp = get_eth0_ip()
artNet = Artnet.Artnet(BINDIP = artnetBindIp, DEBUG = False, SHORTNAME = "PiXelTubeMaster", LONGNAME = "PiXelTubeMaster", PORT = 6454, REFRESH=30) artNet = Artnet.Artnet(BINDIP = artnetBindIp, DEBUG = False, SHORTNAME = "PiXelTubeMaster", LONGNAME = "PiXelTubeMaster", PORT = 6454, REFRESH=30)
tuple_ip = (str(get_eth0_ip()), 6454) tuple_ip = (str(get_eth0_ip()), 6454)
artNet.art_pol_reply(tuple_ip) artNet.art_pol_reply(tuple_ip)
print(universe_list)
try: try:
while True: while True:
try: try:
# for universe in range(universe_count): # for universe in range(universe_count):
# universe = universe - 1
# Gets whatever the last Art-Net packet we received is # Gets whatever the last Art-Net packet we received is
artNetPacket = artNet.readPacket() artNetPacket = artNet.readPacket()
# Make sure we actually *have* a packet # Make sure we actually *have* a packet
if artNetPacket is not None and artNetPacket.data is not None: if artNetPacket is not None and artNetPacket.data is not None:
#Checks to see if the current packet is for the specified DMX Universe #Checks to see if the current packet is for the specified DMX Universe
if artNetPacket.universe in range(universe_count):
print(artNetPacket.universe) print(artNetPacket.universe)
dmxPacket = artNetPacket.data dmxPacket = artNetPacket.data
try: try:
@ -141,7 +137,7 @@ def start_mqtt_publishers(universe_count):
# Publish the DMX value to the MQTT topic # Publish the DMX value to the MQTT topic
mqtt_client.publish(topic, str(dmxPacket[i-1])) mqtt_client.publish(topic, str(dmxPacket[i-1]))
except Exception as e: except Exception as e:
print(f"Error in universes {universe_list}: {e}") print(f"Error in universes {str(artNetPacket.universe)}: {e}")
except KeyboardInterrupt: except KeyboardInterrupt:
break break