From 7e673f778bab3048ab5262b7a1487c11de97baaa Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Sat, 22 Oct 2022 16:52:56 +0200 Subject: [PATCH] a few more words on how a custom effect can be added --- usermods/usermod_v2_weather/readme.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/usermods/usermod_v2_weather/readme.md b/usermods/usermod_v2_weather/readme.md index 8917a1fb..4417e4f2 100644 --- a/usermods/usermod_v2_weather/readme.md +++ b/usermods/usermod_v2_weather/readme.md @@ -2,6 +2,29 @@ In this usermod file you can find the documentation on how to take advantage of the new version 2 usermods! +### adding usermod specific effects + +This usermod also provides an example on how to add your own effects in a usermod. +* the new effect code is in this function, similar to other effects fx.cpp: +```c++ +//effect function +uint16_t mode_2DWeather(void) { + +.... + + return FRAMETIME; +} +static const char _data_FX_MODE_2DWEATHER[] PROGMEM = "Weather@;!;!;pal=54,2d"; //temperature palette +``` +* then activated in the usermod setup function +```c++ +class WeatherUsermod : public Usermod { + public: + void setup() { + strip.addEffect(255, &mode_2DWeather, _data_FX_MODE_2DWEATHER); + } +``` + ## Installation Copy `usermod_v2_example.h` to the wled00 directory.