You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: usermods/user_fx/README.md
+39-9Lines changed: 39 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -230,17 +230,47 @@ return FRAMETIME;
230
230
* ⚠️ 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.
231
231
* The final bracket closes the `mode_diffusionfire()` function itself.
232
232
233
+
233
234
### 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**.
235
236
It defines how the effect is to be interacted with in the UI:
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:
| "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
+
244
274
245
275
246
276
@@ -350,17 +380,17 @@ Notice that there are three different modes that we can define from the single e
350
380
uint16_tmode_sinelon(void) {
351
381
return sinelon_base(false);
352
382
}
353
-
#Calls sinelon_base with dual = false and rainbow = false
383
+
// Calls sinelon_base with dual = false and rainbow = false
354
384
355
385
uint16_t mode_sinelon_dual(void) {
356
386
return sinelon_base(true);
357
387
}
358
-
#Calls sinelon_base with dual = true and rainbow = false
388
+
// Calls sinelon_base with dual = true and rainbow = false
359
389
360
390
uint16_t mode_sinelon_rainbow(void) {
361
391
return sinelon_base(false, true);
362
392
}
363
-
#Calls sinelon_base with dual = false and rainbow = true
393
+
// Calls sinelon_base with dual = false and rainbow = true
364
394
```
365
395
366
396
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