From 0120b1ab79186ca8fc36b1d7986df44bab239eb0 Mon Sep 17 00:00:00 2001 From: gustebeast Date: Thu, 5 Feb 2026 22:16:25 -0800 Subject: [PATCH] Add user_fx installation instructions and a usermod config example (#5327) * Update user_fx to include installation instructions and a usermod config example * Explain installation when using multiple usermods --- usermods/user_fx/README.md | 12 ++++++++++++ usermods/user_fx/user_fx.cpp | 23 +++++++++++++++++++++++ 2 files changed, 35 insertions(+) diff --git a/usermods/user_fx/README.md b/usermods/user_fx/README.md index 704b71df..83ba3737 100644 --- a/usermods/user_fx/README.md +++ b/usermods/user_fx/README.md @@ -4,6 +4,7 @@ This usermod is a common place to put various users’ WLED effects. It lets you Multiple Effects can be specified inside this single usermod, as we will illustrate below. You will be able to define them with custom names, sliders, etc. as with any other Effect. +* [Installation](./README.md#installation) * [How The Usermod Works](./README.md#how-the-usermod-works) * [Basic Syntax for WLED Effect Creation](./README.md#basic-syntax-for-wled-effect-creation) * [Understanding 2D WLED Effects](./README.md#understanding-2d-wled-effects) @@ -14,6 +15,17 @@ Multiple Effects can be specified inside this single usermod, as we will illustr * [Change Log](./README.md#change-log) * [Contact Us](./README.md#contact-us) +## Installation + +To activate the usermod, add the following line to your platformio_override.ini +```ini +custom_usermods = user_fx +``` +Or if you are already using a usermod, append user_fx to the list +```ini +custom_usermods = audioreactive user_fx +``` + ## How The Usermod Works The `user_fx.cpp` file can be broken down into four main parts: diff --git a/usermods/user_fx/user_fx.cpp b/usermods/user_fx/user_fx.cpp index da6937c8..2c9e2339 100644 --- a/usermods/user_fx/user_fx.cpp +++ b/usermods/user_fx/user_fx.cpp @@ -8,6 +8,10 @@ static uint16_t mode_static(void) { return strip.isOffRefreshRequired() ? FRAMETIME : 350; } +// If you define configuration options in your class and need to reference them in your effect function, add them here. +// If you only need to use them in your class you can define them as class members instead. +// bool myConfigValue = false; + ///////////////////////// // User FX functions // ///////////////////////// @@ -109,6 +113,25 @@ class UserFxUsermod : public Usermod { // strip.addEffect(255, &mode_your_effect2, _data_FX_MODE_YOUR_EFFECT2); // strip.addEffect(255, &mode_your_effect3, _data_FX_MODE_YOUR_EFFECT3); } + + + /////////////////////////////////////////////////////////////////////////////////////////////// + // If you want configuration options in the usermod settings page, implement these methods // + /////////////////////////////////////////////////////////////////////////////////////////////// + + // void addToConfig(JsonObject& root) override + // { + // JsonObject top = root.createNestedObject(FPSTR("User FX")); + // top["myConfigValue"] = myConfigValue; + // } + // bool readFromConfig(JsonObject& root) override + // { + // JsonObject top = root[FPSTR("User FX")]; + // bool configComplete = !top.isNull(); + // configComplete &= getJsonValue(top["myConfigValue"], myConfigValue); + // return configComplete; + // } + void loop() override {} // nothing to do in the loop uint16_t getId() override { return USERMOD_ID_USER_FX; } };