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
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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; }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user