Aircoookie / WLED

Control WS2812B and many more types of digital RGB LEDs with an ESP8266 or ESP32 over WiFi!
https://kno.wled.ge
MIT License
14.66k stars 3.15k forks source link

Add new options for Artnet / sACN #4011

Open Bauteiltoeter opened 3 months ago

Bauteiltoeter commented 3 months ago

This PR adds two new options to the available options for sACN / Artnet Interface.

The two new options make it possible to use Artnet to switch between Preset selection and and pixel-control. For this the first channel is used. If channel 1 is between 0 and 126 WLED is in Preset mode. In this case: Channel 2: Preset ID Channel 3: Brightness

If channel 1 is between 127 and 255 WLED is in direct pixel mode (RGB or RGBW). In this case: Channel 2-4: unused Starting from channel 5: RGB / RGBW pixel data.

blazoncek commented 3 months ago

Please rebase your PR for 0_15 branch.

netmindz commented 1 week ago

It's rather unusual for a dmx fixture to change it's whole personality based on a dmx value, that's what RDM is for.

If we were to make this change then it would be nice if we could handle all possible modes than just preset/rgb

Bauteiltoeter commented 2 days ago

I didn't see it as "changing the personality" (which in fact is unusual), but I see it as "integrated effect" vs "cell / pixel mode." There are a lot of fixtures that have an macro channel / mode (brightness + internal effect type) additional to the single cell access. This is why I implemented the switch between "single cell" and "predefined effects".

I'll have to rebase this PR which is a bit of a pain because of the autogenerated files.

blazoncek commented 2 days ago

I'll have to rebase this PR which is a bit of a pain because of the autogenerated files.

0_15 no longer tracks autogenerated files.

willmmiles commented 2 days ago

I'm really not a fan of the code duplication. (Sometimes I think copy-and-paste ought to be banned from IDEs!)

I'll second the suggestion regarding supporting all possible modes instead of limiting to one or the other. Instead of special casing a couple, maybe try something like:

auto activeDMXMode = DMXMode;
if (DMXMode == DMX_MODE_SELECTABLE) {
    activeDMXMode = e131_data[dataOffset] / 10;   // default case will catch invalid values
    dataOffset += 1;
    availDMXLen -= 1;
}

switch (activeDMXMode) { 
   // existing mode logic here
}