hideakitai / ArtNet

Art-Net Sender/Receiver for Arduino (Ethernet, WiFi)
MIT License
257 stars 52 forks source link

Sending more than 1 universe? #126

Closed adeloscope closed 2 weeks ago

adeloscope commented 2 months ago

I have around 500 RGBW pixels I'm controlling and they are organized consecutively to overflow into consecutive universes. The issue I'm having is that when I significantly increase the data size i get some fatal error when I call sendArtDmx().

What I don't actually understand is if you do the parsing into universes on the backend? And thus I can send an arbitrary amount of data? Or am I supposed to pre-parse into universe chunks and then call sendArtDmx() however many 512bytes worth of data I have? I was doing that before and was getting very strange results that I couldn't trace. If you could provide working sample code that sent more than one universe that would be amazing.

dantheman-22 commented 1 month ago

Im also chasing some code to send more than one universe to control 240 RGB LEDs which is falling into the second universe but need to control consecutively. @adeloscope have you managed to get more than 170 pixels to work over multiple universes?

adeloscope commented 1 month ago

Not yet - though I did have email correspondence with the author who I’m hoping will chime in. 🤞

dantheman-22 commented 1 month ago

@adeloscope - I've had a bit of time to take a look and managed to get 2 universes to output on the same port. first universe controls the first 170 pixels (RGB) and the second universe controls the remainder 70 pixels in my scenario. I have a string of 240 leds and it is working with two universes on one port. Here is the code I've managed to get to work however, I cannot seem to use a global variable to have the metadata.universe to work. I have to manually set the universe number in the metadata.universe == 1 as if I add metadata.universe == globaluniverse (which is declared as a uint16_t with a value of 1) it does not work at all. Maybe you have some ideas on my issue?

artnet.subscribeArtDmx([&](const uint8_t *data, uint16_t size, const ArtDmxMetadata &metadata, const ArtNetRemoteInfo &remote) {

    // Check which universe is being used
    if (metadata.universe == 0) {
        //Serial.println("Handling Universe 0");
        handleUniverse(data, size, 0, 170);  // First segment of pixels
    } else if (metadata.universe == 1) {
        //Serial.println("Handling Universe 1");
        handleUniverse(data, size, 170, 70); // Second segment of pixels
    }
    });
hideakitai commented 1 month ago

@adeloscope @dantheman-22 Sorry for not getting back to you sooner. Please use artnet.send(ip, universe, data_ptr, size); multiple times as you want. It works correctly if your board has enough memory to store the pixels.

hideakitai commented 2 weeks ago

If you still need help, please reopen this issue.