claudeheintz / LXDMXWiFi_Library

Library for ESP8266 implements Art-Net and sACN with example DMX input/output to/from network
BSD 3-Clause "New" or "Revised" License
76 stars 17 forks source link

Set ArtNet Subnet and Universe #1

Closed folny closed 8 years ago

folny commented 8 years ago

Hi

Can you please suggest how I define instance Universe - 1 and Subnet - 1, Because I am not entirely sure how can I do thanks.

https://github.com/claudeheintz/LXDMXWiFi_Library/blob/master/examples/WiFi2DMX/WiFi2DMX.ino

void loop() { uint8_t good_dmx = interface->readDMXPacket(wUDP);

if ( good_dmx ) { for (int i = 1; i <= interface->numberOfSlots(); i++) { dmx_output->setSlot(i , interface->getSlot(i)); } blinkLED(); } }

claudeheintz commented 8 years ago

The example allows for either sACN or Art-Net. You want to change line 38:

38|  uint8_t use_sacn = 0;

to use Art-Net.

The generic LXDMXWiFi class uses a single value for universe although sACN and Art-Net treat this a little differently. Art-Net has the first universe number as zero. With sACN E1.31, the first universe is one. With Art-Net, the 8 bit universe number is divided so that the upper 4 bits are the subnet and the lower 4 bits are the universe. When you create an instance of LXWiFiArtNet it defaults to universe zero, subnet zero. You can use the setUniverse() method to change this:

85|  } else {
86|     interface = new LXWiFiArtNet(WiFi.localIP(), WiFi.subnetMask());
87|     use_multicast = 0;
88|     interface->setUniverse(0x11); //add this line to set subnet 1, universe 1
89|  }
folny commented 8 years ago

Thanks works great will be good if in the future you add some more example of your libraries :-)