MoonModules / WLED

Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi! MoonModules adds features on top of upstream.
https://mm.kno.wled.ge
GNU General Public License v3.0
202 stars 64 forks source link

Overhaul Art-Net output to be more "professionally" useful #128

Closed troyhacks closed 1 month ago

troyhacks commented 6 months ago

Overhauls the Art-Net code to allow outputting to devices which may have multiple outputs and universe mappings, such as the commonly available "H807SA" 8-output Art-Net device.

Also adds support for "Color Order Override" in LED settings to allow the output color order to be changed on the fly within WLED for Art-Net rendering endpoints that don't have native color order remapping functionality. By using the existing color order override functions we can change any or all of the Art-Net output, just like we can with physical LEDs.

When serving as an Art-Net renderer, WLED expects 1 hardware output with as many universes as are needed, in RGB color order. This functionality is maintained with this PR with the default settings.

Where help is needed is adding a parameter for "Hardware Outputs" to the "Art-Net RGB (network)" which will be mapped to hardware_outputs in the overhauled code:

image

(hardware_outputs should default to "1" to maintain compatibility with WLED->WLED Art-Net rendering.)

A big thanks to @softhack007 for pointers on the color order remapping!

troyhacks commented 6 months ago

Added missing BRG color order (not that it's likely ever used) and also defaulted BusNetwork to COL_ORDER_RGB - which is what the default is assumed to be with the original code.

For some reason in testing I must have had some other color order defined via regular WS281x LEDs, so this makes things compatible if you have mixed physical and network LEDs or just network LEDs. Color order wasn't supported before for network LEDs, so it was always just blasting out R,G,B,R,G,B...

softhack007 commented 4 months ago

Hi @troyhacks I'll add some review comments which are actually "notes to self" meaning i'll implement the changes when I find time. So nothing to do for you right now.

Just one question - there is some code behind "#ifndef ARTNET_TROYHACKS" should we keep that as an official build option, or is that just remaining from tinkering?

troyhacks commented 4 months ago

Just one question - there is some code behind "#ifndef ARTNET_TROYHACKS" should we keep that as an official build option, or is that just remaining from tinkering?

No code. The "undefined" logic sets it up for how WLED should speak Art-Net to another instance of WLED. That's the default.

If that's defined, it just uses my personal Art-Net setup for the H801RS Art-Net receiver that's on my desk. 😁

Saves me swapping back and forth as I'm testing so I don't have to worry about committing a change with the code set to my personal defaults.

softhack007 commented 4 months ago

Where help is needed is adding a parameter for "Hardware Outputs" to the "Art-Net RGB (network)" which will be mapped to hardware_outputs in the overhauled code:

image

(hardware_outputs should default to "1" to maintain compatibility with WLED->WLED Art-Net rendering.)

@ewoudwijma or @netmindz: I'm not good with this JS stuff, can you help out? @troyhacks hardware_outputs is a single number?

ewowi commented 4 months ago

I can take a look tomorrow. Just for my understanding what does hardware_outputs do ?

troyhacks commented 4 months ago

So technically with Art-Net hardware you have the concept of outputs and universes per output.

With some hardware this is a fixed number, like you can have 8 outputs and they all have to have the same number of universes.

One universe is 170 RGB LEDs.

If you had 256 LEDs on an output, that's 2 universes - but we need to know the stopping point per output because 2 universes is 340 lights, so the code needs to know to start a new universe at LED 257.

The hardware I use has 6 universes per output, maximum. So it's useful to say "I have 8 outputs with 6 universes per output" but if I were to have different amounts of LEDs on each one, then we need to start at the universe number of the particular output.

troyhacks commented 4 months ago

So technically with Art-Net hardware you have the concept of outputs and universes per output.

With some hardware this is a fixed number, like you can have 8 outputs and they all have to have the same number of universes.

One universe is 170 RGB LEDs.

If you had 256 LEDs on an output, that's 2 universes - but we need to know the stopping point per workout because 2 universes is 340 lights, so the code needs to know to start a new universe at LED 257.

PXL_20240523_174420365.RAW-01.COVER.jpg

This unit has 8 outputs and up to 6 universes per output.

In order to address things correctly, we need to basically know how many universes are on each output, and now many LEDs are assigned to each one.

WLED as an Art-Net renderer just uses as many universes as needed and crosses the outputs accordingly.

This is the reverse, as we need to talk in universes, and how many pixels are on each one.

troyhacks commented 1 month ago

Closing this PR as things have moved on a fair bit past this.

netmindz commented 1 month ago

I'm working with upstream to overhaul how the LED settings page works, with https://github.com/Aircoookie/WLED/pull/4056 a the first stage. Mentioning here so I have a reference back to improve the Artnet config, once we have a more dynamic UI and delegation of config to the Bus