Convert usermods to static libraries

Redesign the usermod system so that usermods are implemented as
PlatformIO libraries instead of headers.  This permits them to call for
dependencies, and eliminates the compiler flags for enabling each one,
allowing the build cache to behave better.

The usermod list is built using some linker magic to construct a static
list in ROM memory.  This eliminates the need for wasting SRAM on
something fixed at build time.
This commit is contained in:
Will Miles
2024-09-14 15:09:47 -04:00
parent c4e697d797
commit b8685f2c39
11 changed files with 100 additions and 562 deletions

View File

@@ -1,4 +1,3 @@
#pragma once
#include "wled.h"
@@ -2064,3 +2063,6 @@ const char AudioReactive::_digitalmic[] PROGMEM = "digitalmic";
const char AudioReactive::_addPalettes[] PROGMEM = "add-palettes";
const char AudioReactive::UDP_SYNC_HEADER[] PROGMEM = "00002"; // new sync header version, as format no longer compatible with previous structure
const char AudioReactive::UDP_SYNC_HEADER_v1[] PROGMEM = "00001"; // old sync header version - need to add backwards-compatibility feature
static AudioReactive ar_module;
REGISTER_USERMOD(ar_module);

View File

@@ -0,0 +1,17 @@
{
"name": "audioreactive",
"build": {
"srcDir": ".",
"includeDir": "../../wled00",
"libLDFMode": "chain+",
"libArchive": false
},
"dependencies": [
{
"owner": "kosme",
"name": "arduinoFFT",
"version": "2.0.1",
"platforms": "espressif32"
}
]
}

View File

@@ -0,0 +1,8 @@
{
"name": "auto_save",
"build": {
"srcDir": ".",
"includeDir": "../../wled00",
"libLDFMode": "chain+"
}
}

View File

@@ -275,3 +275,6 @@ const char AutoSaveUsermod::_autoSaveEnabled[] PROGMEM = "enabled";
const char AutoSaveUsermod::_autoSaveAfterSec[] PROGMEM = "autoSaveAfterSec";
const char AutoSaveUsermod::_autoSavePreset[] PROGMEM = "autoSavePreset";
const char AutoSaveUsermod::_autoSaveApplyOnBoot[] PROGMEM = "autoSaveApplyOnBoot";
static AutoSaveUsermod autosave;
REGISTER_USERMOD(autosave);