Skip to content

Commit 057182d

Browse files
authored
Update README.md
1 parent 402995d commit 057182d

File tree

1 file changed

+39
-9
lines changed

1 file changed

+39
-9
lines changed

usermods/user_fx/README.md

Lines changed: 39 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -230,17 +230,47 @@ return FRAMETIME;
230230
* ⚠️ Important: Because the actual frame logic is gated by strip.now - SEGENV.step, returning FRAMETIME here doesn’t cause excessive updates — it just keeps the engine responsive. Also note that an Effect should ALWAYS return FRAMETIME, and choosing a higher number can have negative side effects.
231231
* The final bracket closes the `mode_diffusionfire()` function itself.
232232

233+
233234
### The Metadata String
234-
At the end of every effect is an important line of code called the **metadata string**.
235+
At the end of every effect is an important line of code called the **metadata string**.
235236
It defines how the effect is to be interacted with in the UI:
236237
```cpp
237238
static const char _data_FX_MODE_DIFFUSIONFIRE[] PROGMEM = "Diffusion Fire@!,Spark rate,Diffusion Speed,Turbulence,,Use palette;;Color;;2;pal=35";
238239
```
239-
This string is passed into `strip.addEffect()` and parsed by WLED to determine how your effect appears and behaves in the UI.
240-
Let's break it down field by field, following WLED's metadata format.
241-
The string format WLED uses is semicolon-separated sections, with commas used for control labels.
242-
Let’s split this into logical sections (delimited by semicolons ;):
243-
**TODO**
240+
This metadata string is passed into `strip.addEffect()` and parsed by WLED to determine how your effect appears and behaves in the UI.
241+
The string follows the syntax of `<Effect Parameters>;<Colors>;<Palette>;<Flags>;<Defaults>`, where Effect Parameters are specified by a comma-separated list.
242+
The values for Effect Parameters will always follow the convention in the table below:
243+
244+
| Parameter | Default tooltip label |
245+
| sx | Effect speed |
246+
| ix | Effect intensity |
247+
| c1 | Custom 1 |
248+
| c2 | Custom 2 |
249+
| c3 | Custom 3 |
250+
| o1 | Option 1 |
251+
| o2 | Option 2 |
252+
| o3 | Option 3 |
253+
254+
Using this info, let’s split the Metadata string above into logical sections:
255+
256+
| Syntax Element | Description |
257+
| :---------------------------------------------- | :---------- |
258+
| "Diffusion Fire@!" | Name. (The @ symbol marks the end of the Effect Name, and the begining of the Parameter String elements.) |
259+
| !, | Use default UI entry; for the first space, this will automatically create a slider for Speed |
260+
| Spark rate, Diffusion Speed, Turbulence, | UI sliders for Spark Rate, Diffusion Speed, and Turbulence. Defining slider 2 as "Spark Rate" overwrites the default value of Intensity. |
261+
| (blank), | unused (empty field with not even a space) |
262+
| Use palette; | This occupies the spot for the 6th effect parameter, which automatically makes this a checkbox argument `o1` called Use palette in the UI. Label for a checkbox (SEGMENT.check1); when this is enabled, the effect uses a palette (ColorFromPalette()), otherwise it fades from SEGCOLOR(0).
263+
The first semicolon marks the end of the Effect Parameters and the beginning of the `Colors` parameter. |
264+
| Color; | Custom color field (SEGCOLOR(0)) |
265+
| (blank); | Custom color field (SEGCOLOR(0)) |
266+
| 2; | Number of custom sliders used |
267+
| pal=35; | Default Palette ID |
268+
269+
270+
271+
272+
273+
244274

245275

246276

@@ -350,17 +380,17 @@ Notice that there are three different modes that we can define from the single e
350380
uint16_t mode_sinelon(void) {
351381
return sinelon_base(false);
352382
}
353-
# Calls sinelon_base with dual = false and rainbow = false
383+
// Calls sinelon_base with dual = false and rainbow = false
354384

355385
uint16_t mode_sinelon_dual(void) {
356386
return sinelon_base(true);
357387
}
358-
# Calls sinelon_base with dual = true and rainbow = false
388+
// Calls sinelon_base with dual = true and rainbow = false
359389

360390
uint16_t mode_sinelon_rainbow(void) {
361391
return sinelon_base(false, true);
362392
}
363-
# Calls sinelon_base with dual = false and rainbow = true
393+
// Calls sinelon_base with dual = false and rainbow = true
364394
```
365395
366396
And then the last part defines the metadata strings for each effect to speicfy how it will be portrayed in the UI:

0 commit comments

Comments
 (0)