Fix 1d/2d default in customeffect, games and weather index.htm: add buttons and text area for genPresets index.js: add genPresets, uploadFileWithText and savePresetsGen fx,cpp: set fire 2012 default palette 0 (fire colors) Bonus: battery USERMOD_BATTERY_MEASUREMENT_PIN default -1
34 lines
955 B
Markdown
34 lines
955 B
Markdown
# Usermods API v2 example usermod
|
|
|
|
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@;!;!;2;pal=54"; //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.
|
|
Uncomment the corresponding lines in `usermods_list.cpp` and compile!
|
|
_(You shouldn't need to actually install this, it does nothing useful)_
|
|
|