Files

91 lines
3.5 KiB
Markdown

# Gradient Effect on WLED (fx=46)
For additional WLED instances beyond the primary TouchDesigner complex (e.g., 192.168.178.114 with 72 WS28x LEDs):
## Setting the Gradient Effect
```bash
# Set gradient effect via WLED JSON API
curl -s -m 5 -X POST "http://<WLED_IP>/json/state" \
-H 'Content-Type: application/json' \
-d '{"fx":46,"seg":0,"bri":255,"on":true,"pal":<palette_index>}'
```
- `fx`: 46 = Gradient effect
- `seg`: 0 = first segment
- `bri`: 255 = full brightness
- `on`: true = turn on
- `pal`: palette index (0-71 for WLED 0.14.4)
## Color Palette
The `pal` parameter selects from 72 built-in palettes. For purple-to-black gradient:
- `pal`: 0 (verified: black→purple→black gradient)
- Other palette values 1-71 produce different color transitions
## Adding Custom Colors
```json
{"fx":46,"seg":0,"bri":255,"on":true,"pal":0,"col":[[0,0,0],[128,0,128],[0,0,0]]}
```
- `col`: Array of [R,G,B,W] color segments (max 3 segments for gradient)
- First color = start (black [0,0,0])
- Middle color = transition point (purple [128,0,128])
- Last color = end (black [0,0,0])
## Verified Working Commands
```bash
# Purple gradient on 72-LED chain at 192.168.178.114 (standalone, not TouchDesigner controlled)
curl -s -m 5 -X POST "http://192.168.178.114/json/state" \
-H 'Content-Type: application/json' \
-d '{"fx":46,"seg":0,"bri":255,"on":true,"pal":0}'
```
## TouchDesigner Integration (PRIMARY - do NOT override via WLED API)
For the primary TouchDesigner complex (COMP /project1/kinect_led):
1. Use `bash td/lampe.sh fest` to enable Overlay
2. Use `bash td/lampe.sh farbe 128 0 128` to set purple RGB via TouchDesigner
3. Use `bash td/lampe.sh effekt` to activate internal TouchDesigner effects
4. Check `bash td/lampe.sh status` for current state
**CRITICAL:** The `pal` parameter in TouchDesigner's Overlay section controls the WLED palette index **only when TouchDesigner is NOT sending sACN**. When Enable=True and sACN is active, TouchDesigner overrides any direct WLED API changes.
## WLED as sACN Receiver Only
The WLED lamps (birne6.local at 192.168.178.126, or 192.168.178.114 with 72 WS28x) serve **exclusively as sACN/E1.31 receivers** when TouchDesigner is running:
- TouchDesigner COMP `/project1/kinect_led` → sACN → WLED(s)
- WLED JSON API (`/json/state`, `/json/cfg`) is **disabled/ignored** during active sACN transmission
- `live:true` in WLED info means it's in DMX/E1.31 mode — JSON colors have no effect
- To set colors on birne6.local: use `bash td/lampe.sh farbe R G B` (TouchDesigner)
- To set gradient on standalone WLED instance: use WLED API, but this does NOT affect the TouchDesigner sACN output
## Separate WLED Instances (independent of TouchDesigner)
If a second WLED chain (192.168.178.114, 72 WS28x) should run its own gradient independently:
```bash
# Only if TouchDesigner sACN is NOT active, or for standalone operation:
curl -s -m 5 -X POST "http://192.168.178.114/json/state" \
-H 'Content-Type: application/json' \
-d '{"fx":46,"seg":0,"bri":255,"on":true,"pal":0}'
```
This does NOT interfere with the TouchDesigner project's sACN output to birne6.local.
## Status Verification
Always run `bash td/lampe.sh status` before and after any WLED command to confirm:
- Current Source (sim/freenect/kinect/osc)
- Overlay status (an/aus)
- Pulse settings (min-max-period)
- Output RGB values (what's actually being sent)
- DMX send enabled (an/aus)
**Beware:** `Output jetzt RGB` in the status reflects the actual sACN output — it may differ from what WLED displays internally when in live/DMX mode.