Skip to content

Commit d70a2c5

Browse files
committed
Refactor to network in/out
Network in (pka artnet in): support for Art-Net/DDP/E1.31 Network out (pka artnet out): support for Art-Net/DDP/E1.31
1 parent 6a97189 commit d70a2c5

7 files changed

Lines changed: 735 additions & 479 deletions

File tree

docs/develop/nodes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ All downstream logic — gamma/brightness LUT via `rgbwBufferMapping()`, per-lig
193193

194194
Drivers always read `channelsD` **without** holding `swapMutex`. This is safe: `effectTask` writes to per-layer `virtualChannels` (different memory) while the driver reads `channelsD`. The `compositeLayers()` step that writes `virtualChannels → channelsD` only runs after the driver gives `channelsDFreeSemaphore`, so there is no concurrent access to `channelsD`.
195195

196-
Do not add `swapMutex` guards inside `DriverNode::loop()`. The reference is [`D_ArtnetOut.h`](https://github.com/MoonModules/MoonLight/blob/main/src/MoonLight/Nodes/Drivers/D_ArtnetOut.h).
196+
Do not add `swapMutex` guards inside `DriverNode::loop()`. The reference is [`D_NetworkOut.h`](https://github.com/MoonModules/MoonLight/blob/main/src/MoonLight/Nodes/Drivers/D_NetworkOut.h).
197197

198198
Exception: writes **to** `channelsD` from non-driver-task paths (e.g. DMX In `processChannels()`, ArtNet In) must take `swapMutex` to avoid racing with `compositeLayers()`.
199199

docs/moonlight/drivers.md

Lines changed: 42 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ Custom layouts can also be created as **Live Scripts** — `.sc` files with an `
3737
| Parallel LED Driver | <img width="100" src="https://github.com/user-attachments/assets/9cbe487e-f330-40a5-8b40-6663c83e5d90"/> | <img width="320" alt="Parallel" src="https://github.com/user-attachments/assets/0c6f1543-623a-45bf-98d7-f5ddd072a1c6" /> | Drive multiple LED types, all devices including ESP32-P4(-nano) supported<br>Light preset: See below<br>DMA buffer: set higher when LEDs flicker<br>See [below](#parallel-led-driver) |
3838
| FastLED Driver | <img width="100" src="https://avatars.githubusercontent.com/u/5899270?s=48&v=4"/> | <img width="320" src="../../media/moonlight/drivers/FastLED-Driver.png" /> | Based on the FastLED Channels API to set Pins, Color order, Engine and other settings at runtime! Based on upcoming FastLED v4.0 ! See [Channels API](https://github.com/FastLED/FastLED/blob/master/src/fl/channels/README.md) |
3939
| FastLED Audio | <img width="100" src="https://avatars.githubusercontent.com/u/5899270?s=48&v=4"/> | <img width="320" src="../../media/moonlight/drivers/FastLED-Audio.png" /> | On-board microphone audio processing, allows audio-reactive effects (♪ & ♫) to use audio data (volume and bands (FFT)) and much more. Based on upcoming FastLED v4.0 ! see [FastLED Audio](https://github.com/FastLED/FastLED/blob/master/src/fl/audio/README.md)<br>Connect a digital microphone (e.g. INMP441) to an ESP32 and setup the I2S pins in the [IO module](../moonbase/inputoutput.md)|
40-
| Art-Net Out| <img width="100" src="https://github.com/user-attachments/assets/9c65921c-64e9-4558-b6ef-aed2a163fd88"> | <img width="320" src="../../media/moonlight/drivers/ArtNetOutControls.png" /> | Send Art-Net to Drive LEDS and DMX lights over the network. See [below](#art-net-out) |
41-
| Art-Net In | <img width="100" src="../../media/moonlight/drivers/Art-Net-In.png"> | <img width="320" src="../../media/moonlight/drivers/ArtNetInControls.png" /> | Receive Art-Net (or DDP) packages e.g. from [Resolume](https://resolume.com/) or Touch Designer. See [below](#art-net-in) |
40+
| Network Out | <img width="100" src="https://github.com/user-attachments/assets/9c65921c-64e9-4558-b6ef-aed2a163fd88"> | | Send pixel data over the network using Art-Net, DDP or E1.31/sACN. See [below](#network-out) |
41+
| Network In | <img width="100" src="../../media/moonlight/drivers/Art-Net-In.png"> | | Receive pixel data from the network (Art-Net, DDP or E1.31/sACN) e.g. from [Resolume](https://resolume.com/) or TouchDesigner. See [below](#network-in) |
4242
| DMX Out | | | Send channel data to DMX fixtures over RS-485. See [below](#dmx-out) |
4343
| DMX In | | | Receive DMX data from an external DMX controller via RS-485. See [below](#dmx-in) |
4444
| WLED Audio | <img width="100" src="https://github.com/user-attachments/assets/bfedf80b-6596-41e7-a563-ba7dd58cc476"/> | No controls | Listens to audio sent over the local network by WLED or WLED-MM and allows audio-reactive effects (♪ & ♫) to use audio data (volume and bands (FFT)) |
@@ -96,55 +96,58 @@ The ESP32-P4 Parallel LED Driver uses the hardware PARLIO peripheral to control
9696
- **RGB/RGBW support**: Configurable color ordering and per-component brightness correction
9797
- **Configuration**: Assign GPIO pins in the MoonLight interface and specify LED counts per pin. The driver automatically calculates the maximum LEDs per pin and handles synchronization.
9898

99-
### Art-Net Out ☸️
99+
### Network Out ☸️
100100

101-
<img width="300" src="../../media/moonlight/drivers/ArtNetOutControls.png"/>
102-
103-
Sends Lights in Art-Net compatible packages to an Art-Net controller specified by the IP address(es) provided.
101+
Sends pixel data over the network to LED controllers and DMX fixtures. Supports three protocols selectable at runtime — the port updates automatically when you switch protocol.
104102

105103
**Controls**
106104

107-
* **Light preset**: See above.
108-
* **Controller IPs**: The last segment of the IP address within your local network, of the hardware Art-Net controller. Add more IPs if you send to more than one controller, comma separated or use a hyphen for a range of IPs.
109-
* **Port**: The network port added to the IP address, 6454 is the default for Art-Net.
110-
* **FPS Limiter**: set the max frames per second Art-Net packages are send out (also all the other nodes will run at this speed).
111-
* Art-Net specs recommend about 44 FPS but higher framerates will work mostly (up to until ~130FPS tested)
112-
* **Universe size**: How many channels per universe. 510 and 512 most common. Make sure it corresponds with the Art-Net receiver used.
113-
* **Used channels**: Calculated! Shows how many channels are used (e.g. in a universe of 512 only 170 RGB LEDs fits which is 510 channels, so 510 of the 512 channels are used).
114-
* **Nr of Outputs per IP**: Art-Net LED controllers can have more than 1 output (e.g. 12) If all outputs are sent, Art-Net will be sent to the next IP number.
115-
* **Universes per output**: How many universes can each output handle. This determines the maximum number of lights an output can drive (nr of universe x nr of channels per universe / channels per light)
116-
* **Total universes**: Calculated! Based on the nr of lights (specified by the [layout](layouts.md)), how many universes needs to be configured to sent all lights out.
117-
* **Channels per output**: How many channels will be sent to each output
118-
* **Total channels**: Calculated! Based on the nr of lights (specified by the [layout](layouts.md)), how many channels should be send to all outputs together to sent all lights out
105+
* **Light preset**: See [above](#light-preset).
106+
* **Protocol**: Selects the output protocol:
107+
* **Art-Net** (port 6454) — industry-standard DMX-over-IP. Unicast or broadcast. An ArtSync packet is broadcast after each frame so all receivers display simultaneously.
108+
* **DDP** (port 4048) — lightweight pixel protocol. Unicast only; the push flag signals the last packet of each frame.
109+
* **E1.31 / sACN** (port 5568) — ANSI standard for streaming channel data. Unicast. Universes are 1-based, max 512 channels per universe.
110+
* **Broadcast** *(Art-Net only)*: When enabled, sends to the subnet broadcast address (`x.x.x.255`) instead of specific IPs. All Art-Net receivers on the subnet pick up the data and select their own universes. The **Controller IPs** field is ignored.
111+
* **Controller IPs** *(unicast only)*: The last segment(s) of the IP address(es) of the network controllers. Use a comma-separated list (`11,12,13`) or a hyphen for a range (`11-20`). Pixel data is divided equally across all IPs.
112+
* **Port**: Network port. Updated automatically when switching protocol; can be overridden manually.
113+
* **FPS Limiter**: Maximum frames per second sent. Art-Net spec recommends ~44 FPS; higher rates (up to ~130 FPS tested) work with most controllers.
114+
* **Universe size**: Channels per universe (max 512). Match the setting on your controller.
115+
* **Used channels** *(read-only)*: Channels actually used per universe after rounding to whole lights (e.g. 510 for RGB at 512-channel universes).
116+
* **#Outputs per IP**: Number of physical outputs per controller. When all outputs for one IP are filled, sending continues on the next IP.
117+
* **Universes per output**: How many universes each output handles, determining the maximum lights per output.
118+
* **Total universes** *(read-only)*: Universes required to transmit all lights.
119+
* **Channels per output**: Channel budget per output.
120+
* **Total channels** *(read-only)*: Total channels sent across all outputs and IPs.
119121

120122
!!! tip "Controller settings"
121-
Set the number of universes and channels per universe also on the controller!
122-
123-
* **Channels per output**: each output can drive a maximum number of channels, determined by the universes per output
123+
Set the universe count and channels per universe to the same values on your controller.
124124

125-
!!! warning "DMX start with 1"
126-
Dmx channels count from 1 to 512. At the moment MoonLight counts from 0..511 which translates to 1..512.
125+
!!! warning "DMX channel numbering"
126+
DMX channels count from 1 to 512. MoonLight internally uses 0–511, which maps to DMX 1–512.
127127

128-
### Art-Net In ☸️
128+
### Network In ☸️
129129

130-
<img width="300" src="../../media/moonlight/drivers/ArtNetInControls.png"/>
130+
Receives pixel data from the network and writes it into the MoonLight channel buffer. Supports Art-Net, DDP and E1.31/sACN — protocol and port can be changed without restarting. Compatible with [Resolume](https://resolume.com/), XLights, TouchDesigner, Chataigne, other MoonLight devices (via Network Out), and any standard Art-Net/sACN source.
131131

132-
Receives Art-Net data from the network to setup a MoonLight device as an Art-Net receiver. Can receive Art-Net from other MoonLight devices (see Art-Net out above) and other tools like Resolume, XLights, TouchDesigner, Chataigne etc.
132+
**Controls**
133133

134-
* DDP: If unchecked, processes data in Art-Net format, if checked, process data in DDP format
135-
* Port: The port listening for Art-Net. When using DDP, change to 4048 (the default port for DDP).
136-
* Universe Min-Max: Filters Universes (Art-Net only).
137-
* View:
138-
* Select physical layer to directly store the received channels into the physical layer
139-
* Select one of the (virtual layers) to take mapping into account (using layout specification and modifiers specified (recommended), see [Modifiers](modifiers.md), part of the [Effects Module](effects.md))
134+
* **Protocol**: Selects the input protocol — port updates automatically:
135+
* **Art-Net** (port 6454)
136+
* **DDP** (port 4048)
137+
* **E1.31 / sACN** (port 5568)
138+
* **Port**: UDP port to listen on. Updated automatically when switching protocol; can be overridden.
139+
* **Universe Min / Universe Max** *(Art-Net and E1.31)*: Filters incoming universes; packets outside this range are ignored.
140+
* **Layer**: Where received pixel data is written:
141+
* **Physical layer** — writes directly into the channel buffer, bypassing layout mapping.
142+
* **Layer 1 … N** — writes into the selected virtual layer, which applies the layout and any active modifiers (recommended for mapped fixtures). See [Modifiers](modifiers.md).
140143

141-
!!! tip "Other setup"
142-
* Add a Layout driver to specifify the fixture you are displaying on, e.g. Single Line for Tubes or Panel for Matrices
143-
* Add the Parallel LED Driver to enable connected LEDs
144-
* Go to the [IO Module](../moonbase/inputoutput.md) to define a board preset.
144+
!!! tip "Recommended setup"
145+
* Add a Layout node to define the fixture shape (e.g. Single Line for tubes, Panel for matrices).
146+
* Add a Parallel LED Driver to drive connected LEDs.
147+
* Configure GPIO pins in the [IO Module](../moonbase/inputoutput.md).
145148

146-
!!! tip "Running effects and Art-Net In"
147-
Effects can run at the same time, disable or delete them if you only want to run Art-Net In.
149+
!!! tip "Running effects alongside Network In"
150+
Effects and Network In can run on the same layer at the same time. Disable or delete effects if you want Network In to be the sole pixel source.
148151

149152
### DMX Out ☸️
150153

@@ -177,7 +180,7 @@ Receives DMX512 data from an external controller via RS-485 and either writes it
177180

178181
* **startChannel**: The DMX start address (1–512) to begin reading from within the incoming DMX frame.
179182
* **mode**:
180-
* **Channels** — writes received DMX data directly into the LED channel buffer, similar to Art-Net In. Use this to replace or supplement effect output with data from an external DMX console.
183+
* **Channels** — writes received DMX data directly into the LED channel buffer, similar to Network In. Use this to replace or supplement effect output with data from an external DMX console.
181184
* **LightsControl** — maps DMX channels starting at `startChannel` to [Lights Control](lightscontrol.md) properties. Useful for controlling MoonLight from a standard DMX fader wing. All values are 0–255 (DMX channels 1–256 relative to the start address):
182185

183186
| DMX channel | Lights Control property | Range |

src/MoonBase/Nodes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ extern SharedData sharedData;
212212
*/
213213

214214
// Drivers first as used by others
215-
#include "MoonLight/Nodes/Drivers/D_ArtnetIn.h"
216-
#include "MoonLight/Nodes/Drivers/D_ArtnetOut.h"
215+
#include "MoonLight/Nodes/Drivers/D_NetworkIn.h"
216+
#include "MoonLight/Nodes/Drivers/D_NetworkOut.h"
217217
#include "MoonLight/Nodes/Drivers/D_DMXIn.h"
218218
#include "MoonLight/Nodes/Drivers/D_DMXOut.h"
219219
#include "MoonLight/Nodes/Drivers/D_AudioSync.h"

0 commit comments

Comments
 (0)