Merge pull request #4480 from willmmiles/usermod-libs

Convert usermods to static libraries
This commit is contained in:
netmindz 2025-03-11 22:37:36 +00:00 committed by GitHub
commit a6d9a8220c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
171 changed files with 1055 additions and 1580 deletions

View File

@ -57,6 +57,7 @@ jobs:
cache: 'pip' cache: 'pip'
- name: Install PlatformIO - name: Install PlatformIO
run: pip install -r requirements.txt run: pip install -r requirements.txt
- name: Build firmware - name: Build firmware
run: pio run -e ${{ matrix.environment }} run: pio run -e ${{ matrix.environment }}
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4

View File

@ -0,0 +1,115 @@
Import('env')
import os.path
from collections import deque
from pathlib import Path # For OS-agnostic path manipulation
from platformio.package.manager.library import LibraryPackageManager
usermod_dir = Path(env["PROJECT_DIR"]) / "usermods"
all_usermods = [f for f in usermod_dir.iterdir() if f.is_dir() and f.joinpath('library.json').exists()]
if env['PIOENV'] == "usermods":
# Add all usermods
env.GetProjectConfig().set(f"env:usermods", 'custom_usermods', " ".join([f.name for f in all_usermods]))
def find_usermod(mod: str):
"""Locate this library in the usermods folder.
We do this to avoid needing to rename a bunch of folders;
this could be removed later
"""
# Check name match
mp = usermod_dir / mod
if mp.exists():
return mp
mp = usermod_dir / f"{mod}_v2"
if mp.exists():
return mp
mp = usermod_dir / f"usermod_v2_{mod}"
if mp.exists():
return mp
raise RuntimeError(f"Couldn't locate module {mod} in usermods directory!")
usermods = env.GetProjectOption("custom_usermods","")
if usermods:
# Inject usermods in to project lib_deps
proj = env.GetProjectConfig()
deps = env.GetProjectOption('lib_deps')
src_dir = proj.get("platformio", "src_dir")
src_dir = src_dir.replace('\\','/')
mod_paths = {mod: find_usermod(mod) for mod in usermods.split()}
usermods = [f"{mod} = symlink://{path}" for mod, path in mod_paths.items()]
proj.set("env:" + env['PIOENV'], 'lib_deps', deps + usermods)
# Force usermods to be installed in to the environment build state before the LDF runs
# Otherwise we won't be able to see them until it's too late to change their paths for LDF
# Logic is largely borrowed from PlaformIO internals
not_found_specs = []
for spec in usermods:
found = False
for storage_dir in env.GetLibSourceDirs():
#print(f"Checking {storage_dir} for {spec}")
lm = LibraryPackageManager(storage_dir)
if lm.get_package(spec):
#print("Found!")
found = True
break
if not found:
#print("Missing!")
not_found_specs.append(spec)
if not_found_specs:
lm = LibraryPackageManager(
env.subst(os.path.join("$PROJECT_LIBDEPS_DIR", "$PIOENV"))
)
for spec in not_found_specs:
#print(f"LU: forcing install of {spec}")
lm.install(spec)
# Utility function for assembling usermod include paths
def cached_add_includes(dep, dep_cache: set, includes: deque):
""" Add dep's include paths to includes if it's not in the cache """
if dep not in dep_cache:
dep_cache.add(dep)
for include in dep.get_include_dirs():
if include not in includes:
includes.appendleft(include)
if usermod_dir not in Path(dep.src_dir).parents:
# Recurse, but only for NON-usermods
for subdep in dep.depbuilders:
cached_add_includes(subdep, dep_cache, includes)
# Monkey-patch ConfigureProjectLibBuilder to mark up the dependencies
# Save the old value
old_ConfigureProjectLibBuilder = env.ConfigureProjectLibBuilder
# Our new wrapper
def wrapped_ConfigureProjectLibBuilder(xenv):
# Update usermod properties
# Set libArchive before build actions are added
for um in (um for um in xenv.GetLibBuilders() if usermod_dir in Path(um.src_dir).parents):
build = um._manifest.get("build", {})
build["libArchive"] = False
um._manifest["build"] = build
# Call the wrapped function
result = old_ConfigureProjectLibBuilder.clone(xenv)()
# Fix up include paths
# In PlatformIO >=6.1.17, this could be done prior to ConfigureProjectLibBuilder
wled_dir = xenv["PROJECT_SRC_DIR"]
# Build a list of dependency include dirs
# TODO: Find out if this is the order that PlatformIO/SCons puts them in??
processed_deps = set()
extra_include_dirs = deque() # Deque used for fast prepend
for dep in result.depbuilders:
cached_add_includes(dep, processed_deps, extra_include_dirs)
for um in [dep for dep in result.depbuilders if usermod_dir in Path(dep.src_dir).parents]:
# Add the wled folder to the include path
um.env.PrependUnique(CPPPATH=wled_dir)
# Add WLED's own dependencies
for dir in extra_include_dirs:
um.env.PrependUnique(CPPPATH=dir)
return result
# Apply the wrapper
env.AddMethod(wrapped_ConfigureProjectLibBuilder, "ConfigureProjectLibBuilder")

View File

@ -10,7 +10,7 @@
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# CI/release binaries # CI/release binaries
default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, nodemcuv2_160, esp8266_2m_160, esp01_1m_full_160, nodemcuv2_compat, esp8266_2m_compat, esp01_1m_full_compat, esp32dev, esp32dev_V4, esp32_eth, lolin_s2_mini, esp32c3dev, esp32s3dev_16MB_opi, esp32s3dev_8MB_opi, esp32s3_4M_qspi, esp32_wrover default_envs = nodemcuv2, esp8266_2m, esp01_1m_full, nodemcuv2_160, esp8266_2m_160, esp01_1m_full_160, nodemcuv2_compat, esp8266_2m_compat, esp01_1m_full_compat, esp32dev, esp32dev_V4, esp32_eth, lolin_s2_mini, esp32c3dev, esp32s3dev_16MB_opi, esp32s3dev_8MB_opi, esp32s3_4M_qspi, esp32_wrover, usermods
src_dir = ./wled00 src_dir = ./wled00
data_dir = ./wled00/data data_dir = ./wled00/data
@ -114,6 +114,7 @@ extra_scripts =
post:pio-scripts/output_bins.py post:pio-scripts/output_bins.py
post:pio-scripts/strip-floats.py post:pio-scripts/strip-floats.py
pre:pio-scripts/user_config_copy.py pre:pio-scripts/user_config_copy.py
pre:pio-scripts/load_usermods.py
pre:pio-scripts/build_ui.py pre:pio-scripts/build_ui.py
; post:pio-scripts/obj-dump.py ;; convenience script to create a disassembly dump of the firmware (hardcore debugging) ; post:pio-scripts/obj-dump.py ;; convenience script to create a disassembly dump of the firmware (hardcore debugging)
@ -157,21 +158,13 @@ lib_deps =
;adafruit/Adafruit BMP280 Library @ 2.1.0 ;adafruit/Adafruit BMP280 Library @ 2.1.0
;adafruit/Adafruit CCS811 Library @ 1.0.4 ;adafruit/Adafruit CCS811 Library @ 1.0.4
;adafruit/Adafruit Si7021 Library @ 1.4.0 ;adafruit/Adafruit Si7021 Library @ 1.4.0
#For ADS1115 sensor uncomment following
;adafruit/Adafruit BusIO @ 1.13.2
;adafruit/Adafruit ADS1X15 @ 2.4.0
#For MAX1704x Lipo Monitor / Fuel Gauge uncomment following #For MAX1704x Lipo Monitor / Fuel Gauge uncomment following
; https://github.com/adafruit/Adafruit_BusIO @ 1.14.5 ; https://github.com/adafruit/Adafruit_BusIO @ 1.14.5
; https://github.com/adafruit/Adafruit_MAX1704X @ 1.0.2 ; https://github.com/adafruit/Adafruit_MAX1704X @ 1.0.2
#For MPU6050 IMU uncomment follwoing #For MPU6050 IMU uncomment follwoing
;electroniccats/MPU6050 @1.0.1 ;electroniccats/MPU6050 @1.0.1
# For -D USERMOD_ANIMARTRIX
# CC BY-NC 3.0 licensed effects by Stefan Petrick, include this usermod only if you accept the terms!
;https://github.com/netmindz/animartrix.git#18bf17389e57c69f11bc8d04ebe1d215422c7fb7
# SHT85 # SHT85
;robtillaart/SHT85@~0.3.3 ;robtillaart/SHT85@~0.3.3
# Audioreactive usermod
;kosme/arduinoFFT @ 2.0.1
extra_scripts = ${scripts_defaults.extra_scripts} extra_scripts = ${scripts_defaults.extra_scripts}
@ -270,11 +263,11 @@ lib_deps =
https://github.com/lorol/LITTLEFS.git https://github.com/lorol/LITTLEFS.git
${esp32_all_variants.lib_deps} ${esp32_all_variants.lib_deps}
${env.lib_deps} ${env.lib_deps}
# additional build flags for audioreactive
AR_build_flags = -D USERMOD_AUDIOREACTIVE
-D sqrt_internal=sqrtf ;; -fsingle-precision-constant ;; forces ArduinoFFT to use float math (2x faster)
AR_lib_deps = kosme/arduinoFFT @ 2.0.1
board_build.partitions = ${esp32.default_partitions} ;; default partioning for 4MB Flash - can be overridden in build envs board_build.partitions = ${esp32.default_partitions} ;; default partioning for 4MB Flash - can be overridden in build envs
# additional build flags for audioreactive - must be applied globally
AR_build_flags = ;; -fsingle-precision-constant ;; forces ArduinoFFT to use float math (2x faster)
AR_lib_deps = ;; for pre-usermod-library platformio_override compatibility
[esp32_idf_V4] [esp32_idf_V4]
;; experimental build environment for ESP32 using ESP-IDF 4.4.x / arduino-esp32 v2.0.5 ;; experimental build environment for ESP32 using ESP-IDF 4.4.x / arduino-esp32 v2.0.5
@ -384,8 +377,8 @@ build_flags = ${common.build_flags} ${esp8266.build_flags_compat} -D WLED_RELEAS
extends = env:nodemcuv2 extends = env:nodemcuv2
board_build.f_cpu = 160000000L board_build.f_cpu = 160000000L
build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_RELEASE_NAME=\"ESP8266_160\" #-DWLED_DISABLE_2D build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_RELEASE_NAME=\"ESP8266_160\" #-DWLED_DISABLE_2D
-D USERMOD_AUDIOREACTIVE
-D WLED_DISABLE_PARTICLESYSTEM2D -D WLED_DISABLE_PARTICLESYSTEM2D
custom_usermods = audioreactive
[env:esp8266_2m] [env:esp8266_2m]
board = esp_wroom_02 board = esp_wroom_02
@ -411,9 +404,9 @@ build_flags = ${common.build_flags} ${esp8266.build_flags_compat} -D WLED_RELEAS
extends = env:esp8266_2m extends = env:esp8266_2m
board_build.f_cpu = 160000000L board_build.f_cpu = 160000000L
build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_RELEASE_NAME=\"ESP02_160\" build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_RELEASE_NAME=\"ESP02_160\"
-D USERMOD_AUDIOREACTIVE
-D WLED_DISABLE_PARTICLESYSTEM1D -D WLED_DISABLE_PARTICLESYSTEM1D
-D WLED_DISABLE_PARTICLESYSTEM2D -D WLED_DISABLE_PARTICLESYSTEM2D
custom_usermods = audioreactive
[env:esp01_1m_full] [env:esp01_1m_full]
board = esp01_1m board = esp01_1m
@ -440,20 +433,19 @@ build_flags = ${common.build_flags} ${esp8266.build_flags_compat} -D WLED_RELEAS
extends = env:esp01_1m_full extends = env:esp01_1m_full
board_build.f_cpu = 160000000L board_build.f_cpu = 160000000L
build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_RELEASE_NAME=\"ESP01_160\" -D WLED_DISABLE_OTA build_flags = ${common.build_flags} ${esp8266.build_flags} -D WLED_RELEASE_NAME=\"ESP01_160\" -D WLED_DISABLE_OTA
-D USERMOD_AUDIOREACTIVE
; -D WLED_USE_REAL_MATH ;; may fix wrong sunset/sunrise times, at the cost of 7064 bytes FLASH and 975 bytes RAM ; -D WLED_USE_REAL_MATH ;; may fix wrong sunset/sunrise times, at the cost of 7064 bytes FLASH and 975 bytes RAM
-D WLED_DISABLE_PARTICLESYSTEM1D -D WLED_DISABLE_PARTICLESYSTEM1D
-D WLED_DISABLE_PARTICLESYSTEM2D -D WLED_DISABLE_PARTICLESYSTEM2D
custom_usermods = audioreactive
[env:esp32dev] [env:esp32dev]
board = esp32dev board = esp32dev
platform = ${esp32.platform} platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages} platform_packages = ${esp32.platform_packages}
custom_usermods = audioreactive
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_RELEASE_NAME=\"ESP32\" #-D WLED_DISABLE_BROWNOUT_DET build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_RELEASE_NAME=\"ESP32\" #-D WLED_DISABLE_BROWNOUT_DET
${esp32.AR_build_flags}
lib_deps = ${esp32.lib_deps} lib_deps = ${esp32.lib_deps}
${esp32.AR_lib_deps}
monitor_filters = esp32_exception_decoder monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.default_partitions} board_build.partitions = ${esp32.default_partitions}
@ -461,10 +453,9 @@ board_build.partitions = ${esp32.default_partitions}
board = esp32dev board = esp32dev
platform = ${esp32_idf_V4.platform} platform = ${esp32_idf_V4.platform}
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
custom_usermods = audioreactive
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_V4\" #-D WLED_DISABLE_BROWNOUT_DET build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_V4\" #-D WLED_DISABLE_BROWNOUT_DET
${esp32.AR_build_flags}
lib_deps = ${esp32_idf_V4.lib_deps} lib_deps = ${esp32_idf_V4.lib_deps}
${esp32.AR_lib_deps}
monitor_filters = esp32_exception_decoder monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.default_partitions} board_build.partitions = ${esp32.default_partitions}
board_build.flash_mode = dio board_build.flash_mode = dio
@ -472,11 +463,10 @@ board_build.flash_mode = dio
[env:esp32dev_8M] [env:esp32dev_8M]
board = esp32dev board = esp32dev
platform = ${esp32_idf_V4.platform} platform = ${esp32_idf_V4.platform}
custom_usermods = audioreactive
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_8M\" #-D WLED_DISABLE_BROWNOUT_DET build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_8M\" #-D WLED_DISABLE_BROWNOUT_DET
${esp32.AR_build_flags}
lib_deps = ${esp32_idf_V4.lib_deps} lib_deps = ${esp32_idf_V4.lib_deps}
${esp32.AR_lib_deps}
monitor_filters = esp32_exception_decoder monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.large_partitions} board_build.partitions = ${esp32.large_partitions}
board_upload.flash_size = 8MB board_upload.flash_size = 8MB
@ -487,11 +477,10 @@ board_upload.maximum_size = 8388608
[env:esp32dev_16M] [env:esp32dev_16M]
board = esp32dev board = esp32dev
platform = ${esp32_idf_V4.platform} platform = ${esp32_idf_V4.platform}
custom_usermods = audioreactive
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_16M\" #-D WLED_DISABLE_BROWNOUT_DET build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_16M\" #-D WLED_DISABLE_BROWNOUT_DET
${esp32.AR_build_flags}
lib_deps = ${esp32_idf_V4.lib_deps} lib_deps = ${esp32_idf_V4.lib_deps}
${esp32.AR_lib_deps}
monitor_filters = esp32_exception_decoder monitor_filters = esp32_exception_decoder
board_build.partitions = ${esp32.extreme_partitions} board_build.partitions = ${esp32.extreme_partitions}
board_upload.flash_size = 16MB board_upload.flash_size = 16MB
@ -503,11 +492,10 @@ board_build.flash_mode = dio
;board = esp32dev ;board = esp32dev
;platform = ${esp32.platform} ;platform = ${esp32.platform}
;platform_packages = ${esp32.platform_packages} ;platform_packages = ${esp32.platform_packages}
;custom_usermods = audioreactive
;build_unflags = ${common.build_unflags} ;build_unflags = ${common.build_unflags}
;build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_RELEASE_NAME=\"ESP32_audioreactive\" #-D WLED_DISABLE_BROWNOUT_DET ;build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_RELEASE_NAME=\"ESP32_audioreactive\" #-D WLED_DISABLE_BROWNOUT_DET
; ${esp32.AR_build_flags}
;lib_deps = ${esp32.lib_deps} ;lib_deps = ${esp32.lib_deps}
; ${esp32.AR_lib_deps}
;monitor_filters = esp32_exception_decoder ;monitor_filters = esp32_exception_decoder
;board_build.partitions = ${esp32.default_partitions} ;board_build.partitions = ${esp32.default_partitions}
;; board_build.f_flash = 80000000L ;; board_build.f_flash = 80000000L
@ -518,12 +506,11 @@ board = esp32-poe
platform = ${esp32.platform} platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages} platform_packages = ${esp32.platform_packages}
upload_speed = 921600 upload_speed = 921600
custom_usermods = audioreactive
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_RELEASE_NAME=\"ESP32_Ethernet\" -D RLYPIN=-1 -D WLED_USE_ETHERNET -D BTNPIN=-1 build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_RELEASE_NAME=\"ESP32_Ethernet\" -D RLYPIN=-1 -D WLED_USE_ETHERNET -D BTNPIN=-1
; -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only ; -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only
${esp32.AR_build_flags}
lib_deps = ${esp32.lib_deps} lib_deps = ${esp32.lib_deps}
${esp32.AR_lib_deps}
board_build.partitions = ${esp32.default_partitions} board_build.partitions = ${esp32.default_partitions}
[env:esp32_wrover] [env:esp32_wrover]
@ -533,13 +520,12 @@ board = ttgo-t7-v14-mini32
board_build.f_flash = 80000000L board_build.f_flash = 80000000L
board_build.flash_mode = qio board_build.flash_mode = qio
board_build.partitions = ${esp32.extended_partitions} board_build.partitions = ${esp32.extended_partitions}
custom_usermods = audioreactive
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_WROVER\" build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_WROVER\"
-DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue ;; Older ESP32 (rev.<3) need a PSRAM fix (increases static RAM used) https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/external-ram.html -DBOARD_HAS_PSRAM -mfix-esp32-psram-cache-issue ;; Older ESP32 (rev.<3) need a PSRAM fix (increases static RAM used) https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/external-ram.html
-D DATA_PINS=25 -D DATA_PINS=25
${esp32.AR_build_flags}
lib_deps = ${esp32_idf_V4.lib_deps} lib_deps = ${esp32_idf_V4.lib_deps}
${esp32.AR_lib_deps}
[env:esp32c3dev] [env:esp32c3dev]
extends = esp32c3 extends = esp32c3
@ -562,15 +548,14 @@ board = esp32-s3-devkitc-1 ;; generic dev board; the next line adds PSRAM suppor
board_build.arduino.memory_type = qio_opi ;; use with PSRAM: 8MB or 16MB board_build.arduino.memory_type = qio_opi ;; use with PSRAM: 8MB or 16MB
platform = ${esp32s3.platform} platform = ${esp32s3.platform}
upload_speed = 921600 upload_speed = 921600
custom_usermods = audioreactive
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S3_16MB_opi\" build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S3_16MB_opi\"
-D CONFIG_LITTLEFS_FOR_IDF_3_2 -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_LITTLEFS_FOR_IDF_3_2 -D WLED_WATCHDOG_TIMEOUT=0
;-D ARDUINO_USB_CDC_ON_BOOT=0 ;; -D ARDUINO_USB_MODE=1 ;; for boards with serial-to-USB chip ;-D ARDUINO_USB_CDC_ON_BOOT=0 ;; -D ARDUINO_USB_MODE=1 ;; for boards with serial-to-USB chip
-D ARDUINO_USB_CDC_ON_BOOT=1 -D ARDUINO_USB_MODE=1 ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB") -D ARDUINO_USB_CDC_ON_BOOT=1 -D ARDUINO_USB_MODE=1 ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB")
-DBOARD_HAS_PSRAM -DBOARD_HAS_PSRAM
${esp32.AR_build_flags}
lib_deps = ${esp32s3.lib_deps} lib_deps = ${esp32s3.lib_deps}
${esp32.AR_lib_deps}
board_build.partitions = ${esp32.extreme_partitions} board_build.partitions = ${esp32.extreme_partitions}
board_upload.flash_size = 16MB board_upload.flash_size = 16MB
board_upload.maximum_size = 16777216 board_upload.maximum_size = 16777216
@ -584,15 +569,14 @@ board = esp32-s3-devkitc-1 ;; generic dev board; the next line adds PSRAM suppor
board_build.arduino.memory_type = qio_opi ;; use with PSRAM: 8MB or 16MB board_build.arduino.memory_type = qio_opi ;; use with PSRAM: 8MB or 16MB
platform = ${esp32s3.platform} platform = ${esp32s3.platform}
upload_speed = 921600 upload_speed = 921600
custom_usermods = audioreactive
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S3_8MB_opi\" build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S3_8MB_opi\"
-D CONFIG_LITTLEFS_FOR_IDF_3_2 -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_LITTLEFS_FOR_IDF_3_2 -D WLED_WATCHDOG_TIMEOUT=0
;-D ARDUINO_USB_CDC_ON_BOOT=0 ;; -D ARDUINO_USB_MODE=1 ;; for boards with serial-to-USB chip ;-D ARDUINO_USB_CDC_ON_BOOT=0 ;; -D ARDUINO_USB_MODE=1 ;; for boards with serial-to-USB chip
-D ARDUINO_USB_CDC_ON_BOOT=1 -D ARDUINO_USB_MODE=1 ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB") -D ARDUINO_USB_CDC_ON_BOOT=1 -D ARDUINO_USB_MODE=1 ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB")
-DBOARD_HAS_PSRAM -DBOARD_HAS_PSRAM
${esp32.AR_build_flags}
lib_deps = ${esp32s3.lib_deps} lib_deps = ${esp32s3.lib_deps}
${esp32.AR_lib_deps}
board_build.partitions = ${esp32.large_partitions} board_build.partitions = ${esp32.large_partitions}
board_build.f_flash = 80000000L board_build.f_flash = 80000000L
board_build.flash_mode = qio board_build.flash_mode = qio
@ -605,6 +589,7 @@ platform = ${esp32s3.platform}
board = esp32s3camlcd ;; this is the only standard board with "opi_opi" board = esp32s3camlcd ;; this is the only standard board with "opi_opi"
board_build.arduino.memory_type = opi_opi board_build.arduino.memory_type = opi_opi
upload_speed = 921600 upload_speed = 921600
custom_usermods = audioreactive
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S3_WROOM-2\" build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S3_WROOM-2\"
-D CONFIG_LITTLEFS_FOR_IDF_3_2 -D WLED_WATCHDOG_TIMEOUT=0 -D CONFIG_LITTLEFS_FOR_IDF_3_2 -D WLED_WATCHDOG_TIMEOUT=0
@ -614,10 +599,8 @@ build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=
-D LEDPIN=38 -D DATA_PINS=38 ;; buildin WS2812b LED -D LEDPIN=38 -D DATA_PINS=38 ;; buildin WS2812b LED
-D BTNPIN=0 -D RLYPIN=16 -D IRPIN=17 -D AUDIOPIN=-1 -D BTNPIN=0 -D RLYPIN=16 -D IRPIN=17 -D AUDIOPIN=-1
-D WLED_DEBUG -D WLED_DEBUG
${esp32.AR_build_flags}
-D SR_DMTYPE=1 -D I2S_SDPIN=13 -D I2S_CKPIN=14 -D I2S_WSPIN=15 -D MCLK_PIN=4 ;; I2S mic -D SR_DMTYPE=1 -D I2S_SDPIN=13 -D I2S_CKPIN=14 -D I2S_WSPIN=15 -D MCLK_PIN=4 ;; I2S mic
lib_deps = ${esp32s3.lib_deps} lib_deps = ${esp32s3.lib_deps}
${esp32.AR_lib_deps}
board_build.partitions = ${esp32.extreme_partitions} board_build.partitions = ${esp32.extreme_partitions}
board_upload.flash_size = 16MB board_upload.flash_size = 16MB
@ -629,15 +612,14 @@ monitor_filters = esp32_exception_decoder
board = lolin_s3_mini ;; -S3 mini, 4MB flash 2MB PSRAM board = lolin_s3_mini ;; -S3 mini, 4MB flash 2MB PSRAM
platform = ${esp32s3.platform} platform = ${esp32s3.platform}
upload_speed = 921600 upload_speed = 921600
custom_usermods = audioreactive
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S3_4M_qspi\" build_flags = ${common.build_flags} ${esp32s3.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S3_4M_qspi\"
-DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MODE=1 ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB") -DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_MODE=1 ;; for boards with USB-OTG connector only (USBCDC or "TinyUSB")
-DBOARD_HAS_PSRAM -DBOARD_HAS_PSRAM
-DLOLIN_WIFI_FIX ; seems to work much better with this -DLOLIN_WIFI_FIX ; seems to work much better with this
-D WLED_WATCHDOG_TIMEOUT=0 -D WLED_WATCHDOG_TIMEOUT=0
${esp32.AR_build_flags}
lib_deps = ${esp32s3.lib_deps} lib_deps = ${esp32s3.lib_deps}
${esp32.AR_lib_deps}
board_build.partitions = ${esp32.default_partitions} board_build.partitions = ${esp32.default_partitions}
board_build.f_flash = 80000000L board_build.f_flash = 80000000L
board_build.flash_mode = qio board_build.flash_mode = qio
@ -649,6 +631,7 @@ board = lolin_s2_mini
board_build.partitions = ${esp32.default_partitions} board_build.partitions = ${esp32.default_partitions}
board_build.flash_mode = qio board_build.flash_mode = qio
board_build.f_flash = 80000000L board_build.f_flash = 80000000L
custom_usermods = audioreactive
build_unflags = ${common.build_unflags} build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S2\" build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_RELEASE_NAME=\"ESP32-S2\"
-DARDUINO_USB_CDC_ON_BOOT=1 -DARDUINO_USB_CDC_ON_BOOT=1
@ -664,6 +647,17 @@ build_flags = ${common.build_flags} ${esp32s2.build_flags} -D WLED_RELEASE_NAME=
-D HW_PIN_DATASPI=11 -D HW_PIN_DATASPI=11
-D HW_PIN_MISOSPI=9 -D HW_PIN_MISOSPI=9
; -D STATUSLED=15 ; -D STATUSLED=15
${esp32.AR_build_flags}
lib_deps = ${esp32s2.lib_deps} lib_deps = ${esp32s2.lib_deps}
${esp32.AR_lib_deps}
[env:usermods]
board = esp32dev
platform = ${esp32_idf_V4.platform}
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags} ${esp32_idf_V4.build_flags} -D WLED_RELEASE_NAME=\"ESP32_USERMODS\"
-DTOUCH_CS=9
lib_deps = ${esp32_idf_V4.lib_deps}
monitor_filters = esp32_exception_decoder
board_build.flash_mode = dio
; custom_usermods = *every folder with library.json* -- injected by pio-scripts/load_usermods.py
board_build.partitions = ${esp32.extreme_partitions} ; We're gonna need a bigger boat

View File

@ -506,9 +506,8 @@ lib_deps = ${esp8266.lib_deps}
extends = esp32 ;; use default esp32 platform extends = esp32 ;; use default esp32 platform
board = esp32dev board = esp32dev
upload_speed = 921600 upload_speed = 921600
custom_usermods = ${env:esp32dev.custom_usermods} RTC EleksTube_IPS
build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_DISABLE_BROWNOUT_DET -D WLED_DISABLE_INFRARED build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_DISABLE_BROWNOUT_DET -D WLED_DISABLE_INFRARED
-D USERMOD_RTC
-D USERMOD_ELEKSTUBE_IPS
-D DATA_PINS=12 -D DATA_PINS=12
-D RLYPIN=27 -D RLYPIN=27
-D BTNPIN=34 -D BTNPIN=34
@ -526,9 +525,6 @@ build_flags = ${common.build_flags} ${esp32.build_flags} -D WLED_DISABLE_BROWNOU
-D SPI_FREQUENCY=40000000 -D SPI_FREQUENCY=40000000
-D USER_SETUP_LOADED -D USER_SETUP_LOADED
monitor_filters = esp32_exception_decoder monitor_filters = esp32_exception_decoder
lib_deps =
${esp32.lib_deps}
TFT_eSPI @ 2.5.33 ;; this is the last version that compiles with the WLED default framework - newer versions require platform = espressif32 @ ^6.3.2
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Usermod examples # Usermod examples

View File

@ -1 +1 @@
platformio platformio>=6.1.17

View File

@ -2,26 +2,24 @@
# This file is autogenerated by pip-compile with Python 3.11 # This file is autogenerated by pip-compile with Python 3.11
# by the following command: # by the following command:
# #
# pip-compile # pip-compile requirements.in
# #
ajsonrpc==1.2.0 ajsonrpc==1.2.0
# via platformio # via platformio
anyio==4.6.0 anyio==4.8.0
# via starlette # via starlette
bottle==0.13.1 bottle==0.13.2
# via platformio # via platformio
certifi==2024.8.30 certifi==2025.1.31
# via requests # via requests
charset-normalizer==3.3.2 charset-normalizer==3.4.1
# via requests # via requests
click==8.1.7 click==8.1.8
# via # via
# platformio # platformio
# uvicorn # uvicorn
colorama==0.4.6 colorama==0.4.6
# via # via platformio
# click
# platformio
h11==0.14.0 h11==0.14.0
# via # via
# uvicorn # uvicorn
@ -30,13 +28,13 @@ idna==3.10
# via # via
# anyio # anyio
# requests # requests
marshmallow==3.22.0 marshmallow==3.26.1
# via platformio # via platformio
packaging==24.1 packaging==24.2
# via marshmallow # via marshmallow
platformio==6.1.16 platformio==6.1.17
# via -r requirements.in # via -r requirements.in
pyelftools==0.31 pyelftools==0.32
# via platformio # via platformio
pyserial==3.5 pyserial==3.5
# via platformio # via platformio
@ -46,13 +44,15 @@ semantic-version==2.10.0
# via platformio # via platformio
sniffio==1.3.1 sniffio==1.3.1
# via anyio # via anyio
starlette==0.39.1 starlette==0.45.3
# via platformio # via platformio
tabulate==0.9.0 tabulate==0.9.0
# via platformio # via platformio
urllib3==2.2.3 typing-extensions==4.12.2
# via anyio
urllib3==2.3.0
# via requests # via requests
uvicorn==0.30.6 uvicorn==0.34.0
# via platformio # via platformio
wsproto==1.2.0 wsproto==1.2.0
# via platformio # via platformio

View File

@ -1,5 +1,3 @@
#pragma once
#include "wled.h" #include "wled.h"
#include <Adafruit_ADS1X15.h> #include <Adafruit_ADS1X15.h>
#include <math.h> #include <math.h>
@ -253,3 +251,6 @@ class ADS1115Usermod : public Usermod {
readings[activeChannel] = ads.computeVolts(results); readings[activeChannel] = ads.computeVolts(results);
} }
}; };
static ADS1115Usermod ads1115_v2;
REGISTER_USERMOD(ads1115_v2);

View File

@ -0,0 +1,7 @@
{
"name:": "ADS1115_v2",
"dependencies": {
"Adafruit BusIO": "https://github.com/adafruit/Adafruit_BusIO#1.13.2",
"Adafruit ADS1X15": "https://github.com/adafruit/Adafruit_ADS1X15#2.4.0"
}
}

View File

@ -6,5 +6,5 @@ Configuration is performed via the Usermod menu. There are no parameters to set
## Installation ## Installation
Add the build flag `-D USERMOD_ADS1115` to your platformio environment. Add 'ADS1115' to `custom_usermods` in your platformio environment.
Uncomment libraries with comment `#For ADS1115 sensor uncomment following`

View File

@ -1,5 +1,3 @@
#pragma once
#include "wled.h" #include "wled.h"
#include <AHT10.h> #include <AHT10.h>
@ -54,12 +52,6 @@ private:
_lastTemperature = 0; _lastTemperature = 0;
} }
~UsermodAHT10()
{
delete _aht;
_aht = nullptr;
}
#ifndef WLED_DISABLE_MQTT #ifndef WLED_DISABLE_MQTT
void mqttInitialize() void mqttInitialize()
{ {
@ -322,6 +314,15 @@ public:
_initDone = true; _initDone = true;
return configComplete; return configComplete;
} }
~UsermodAHT10()
{
delete _aht;
_aht = nullptr;
}
}; };
const char UsermodAHT10::_name[] PROGMEM = "AHTxx"; const char UsermodAHT10::_name[] PROGMEM = "AHTxx";
static UsermodAHT10 aht10_v2;
REGISTER_USERMOD(aht10_v2);

View File

@ -22,15 +22,9 @@ Dependencies, These must be added under `lib_deps` in your `platform.ini` (or `p
# Compiling # Compiling
To enable, compile with `USERMOD_AHT10` defined (e.g. in `platformio_override.ini`) To enable, add 'AHT10' to `custom_usermods` in your platformio encrionment (e.g. in `platformio_override.ini`)
```ini ```ini
[env:aht10_example] [env:aht10_example]
extends = env:esp32dev extends = env:esp32dev
build_flags = custom_usermods = ${env:esp32dev.custom_usermods} AHT10
${common.build_flags} ${esp32.build_flags}
-D USERMOD_AHT10
; -D USERMOD_AHT10_DEBUG ; -- add a debug status to the info modal
lib_deps =
${esp32.lib_deps}
enjoyneering/AHT10@~1.1.0
``` ```

View File

@ -0,0 +1,6 @@
{
"name:": "AHT10_v2",
"dependencies": {
"enjoyneering/AHT10":"~1.1.0"
}
}

View File

@ -2,8 +2,4 @@
extends = env:esp32dev extends = env:esp32dev
build_flags = build_flags =
${common.build_flags} ${esp32.build_flags} ${common.build_flags} ${esp32.build_flags}
-D USERMOD_AHT10
; -D USERMOD_AHT10_DEBUG ; -- add a debug status to the info modal ; -D USERMOD_AHT10_DEBUG ; -- add a debug status to the info modal
lib_deps =
${esp32.lib_deps}
enjoyneering/AHT10@~1.1.0

View File

@ -1,4 +1,3 @@
#pragma once
#include "wled.h" #include "wled.h"
/* /*
@ -254,3 +253,7 @@ public:
return USERMOD_ID_ANALOG_CLOCK; return USERMOD_ID_ANALOG_CLOCK;
} }
}; };
static AnalogClockUsermod analog_clock;
REGISTER_USERMOD(analog_clock);

View File

@ -0,0 +1,3 @@
{
"name:": "Analog_Clock"
}

View File

@ -7,7 +7,6 @@
* *
* See the accompanying README.md file for more info. * See the accompanying README.md file for more info.
*/ */
#pragma once
#include "wled.h" #include "wled.h"
class Animated_Staircase : public Usermod { class Animated_Staircase : public Usermod {
@ -562,3 +561,7 @@ const char Animated_Staircase::_bottomEcho_pin[] PROGMEM = "bottomEch
const char Animated_Staircase::_topEchoCm[] PROGMEM = "top-dist-cm"; const char Animated_Staircase::_topEchoCm[] PROGMEM = "top-dist-cm";
const char Animated_Staircase::_bottomEchoCm[] PROGMEM = "bottom-dist-cm"; const char Animated_Staircase::_bottomEchoCm[] PROGMEM = "bottom-dist-cm";
const char Animated_Staircase::_togglePower[] PROGMEM = "toggle-on-off"; const char Animated_Staircase::_togglePower[] PROGMEM = "toggle-on-off";
static Animated_Staircase animated_staircase;
REGISTER_USERMOD(animated_staircase);

View File

@ -15,10 +15,9 @@ To include this usermod in your WLED setup, you have to be able to [compile WLED
Before compiling, you have to make the following modifications: Before compiling, you have to make the following modifications:
Edit `usermods_list.cpp`: Edit your environment in `platformio_override.ini`
1. Open `wled00/usermods_list.cpp` 1. Open `platformio_override.ini`
2. add `#include "../usermods/Animated_Staircase/Animated_Staircase.h"` to the top of the file 2. add `Animated_Staircase` to the `custom_usermods` line for your environment
3. add `UsermodManager::add(new Animated_Staircase());` to the end of the `void registerUsermods()` function.
You can configure usermod using the Usermods settings page. You can configure usermod using the Usermods settings page.
Please enter GPIO pins for PIR or ultrasonic sensors (trigger and echo). Please enter GPIO pins for PIR or ultrasonic sensors (trigger and echo).

View File

@ -0,0 +1,3 @@
{
"name:": "Animated_Staircase"
}

View File

@ -1,15 +1,13 @@
// force the compiler to show a warning to confirm that this file is included // force the compiler to show a warning to confirm that this file is included
#warning **** Included USERMOD_BH1750 **** #warning **** Included USERMOD_BH1750 ****
#ifndef WLED_ENABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
#pragma once
#include "wled.h" #include "wled.h"
#include <BH1750.h> #include <BH1750.h>
#ifdef WLED_DISABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
// the max frequency to check photoresistor, 10 seconds // the max frequency to check photoresistor, 10 seconds
#ifndef USERMOD_BH1750_MAX_MEASUREMENT_INTERVAL #ifndef USERMOD_BH1750_MAX_MEASUREMENT_INTERVAL
#define USERMOD_BH1750_MAX_MEASUREMENT_INTERVAL 10000 #define USERMOD_BH1750_MAX_MEASUREMENT_INTERVAL 10000
@ -250,3 +248,7 @@ const char Usermod_BH1750::_maxReadInterval[] PROGMEM = "max-read-interval-ms";
const char Usermod_BH1750::_minReadInterval[] PROGMEM = "min-read-interval-ms"; const char Usermod_BH1750::_minReadInterval[] PROGMEM = "min-read-interval-ms";
const char Usermod_BH1750::_HomeAssistantDiscovery[] PROGMEM = "HomeAssistantDiscoveryLux"; const char Usermod_BH1750::_HomeAssistantDiscovery[] PROGMEM = "HomeAssistantDiscoveryLux";
const char Usermod_BH1750::_offset[] PROGMEM = "offset-lx"; const char Usermod_BH1750::_offset[] PROGMEM = "offset-lx";
static Usermod_BH1750 bh1750_v2;
REGISTER_USERMOD(bh1750_v2);

View File

@ -0,0 +1,6 @@
{
"name:": "BH1750_v2",
"dependencies": {
"claws/BH1750":"^1.2.0"
}
}

View File

@ -6,22 +6,11 @@ The luminance is displayed in both the Info section of the web UI, as well as pu
## Dependencies ## Dependencies
- Libraries - Libraries
- `claws/BH1750 @^1.2.0` - `claws/BH1750 @^1.2.0`
- This must be added under `lib_deps` in your `platformio.ini` (or `platformio_override.ini`).
- Data is published over MQTT - make sure you've enabled the MQTT sync interface. - Data is published over MQTT - make sure you've enabled the MQTT sync interface.
## Compilation ## Compilation
To enable, compile with `USERMOD_BH1750` defined (e.g. in `platformio_override.ini`) To enable, compile with `BH1750` in `custom_usermods` (e.g. in `platformio_override.ini`)
```ini
[env:usermod_BH1750_d1_mini]
extends = env:d1_mini
build_flags =
${common.build_flags_esp8266}
-D USERMOD_BH1750
lib_deps =
${esp8266.lib_deps}
claws/BH1750 @ ^1.2.0
```
### Configuration Options ### Configuration Options
The following settings can be set at compile-time but are configurable on the usermod menu (except First Measurement time): The following settings can be set at compile-time but are configurable on the usermod menu (except First Measurement time):

View File

@ -1,17 +1,15 @@
// force the compiler to show a warning to confirm that this file is included // force the compiler to show a warning to confirm that this file is included
#warning **** Included USERMOD_BME280 version 2.0 **** #warning **** Included USERMOD_BME280 version 2.0 ****
#ifndef WLED_ENABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
#pragma once
#include "wled.h" #include "wled.h"
#include <Arduino.h> #include <Arduino.h>
#include <BME280I2C.h> // BME280 sensor #include <BME280I2C.h> // BME280 sensor
#include <EnvironmentCalculations.h> // BME280 extended measurements #include <EnvironmentCalculations.h> // BME280 extended measurements
#ifdef WLED_DISABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
class UsermodBME280 : public Usermod class UsermodBME280 : public Usermod
{ {
private: private:
@ -241,7 +239,7 @@ public:
// from the UI and values read from sensor, then publish to broker // from the UI and values read from sensor, then publish to broker
if (temperature != lastTemperature || PublishAlways) if (temperature != lastTemperature || PublishAlways)
{ {
publishMqtt("temperature", String(temperature, TemperatureDecimals).c_str()); publishMqtt("temperature", String(temperature, (unsigned) TemperatureDecimals).c_str());
} }
lastTemperature = temperature; // Update last sensor temperature for next loop lastTemperature = temperature; // Update last sensor temperature for next loop
@ -254,17 +252,17 @@ public:
if (humidity != lastHumidity || PublishAlways) if (humidity != lastHumidity || PublishAlways)
{ {
publishMqtt("humidity", String(humidity, HumidityDecimals).c_str()); publishMqtt("humidity", String(humidity, (unsigned) HumidityDecimals).c_str());
} }
if (heatIndex != lastHeatIndex || PublishAlways) if (heatIndex != lastHeatIndex || PublishAlways)
{ {
publishMqtt("heat_index", String(heatIndex, TemperatureDecimals).c_str()); publishMqtt("heat_index", String(heatIndex, (unsigned) TemperatureDecimals).c_str());
} }
if (dewPoint != lastDewPoint || PublishAlways) if (dewPoint != lastDewPoint || PublishAlways)
{ {
publishMqtt("dew_point", String(dewPoint, TemperatureDecimals).c_str()); publishMqtt("dew_point", String(dewPoint, (unsigned) TemperatureDecimals).c_str());
} }
lastHumidity = humidity; lastHumidity = humidity;
@ -281,7 +279,7 @@ public:
if (pressure != lastPressure || PublishAlways) if (pressure != lastPressure || PublishAlways)
{ {
publishMqtt("pressure", String(pressure, PressureDecimals).c_str()); publishMqtt("pressure", String(pressure, (unsigned) PressureDecimals).c_str());
} }
lastPressure = pressure; lastPressure = pressure;
@ -479,3 +477,7 @@ public:
const char UsermodBME280::_name[] PROGMEM = "BME280/BMP280"; const char UsermodBME280::_name[] PROGMEM = "BME280/BMP280";
const char UsermodBME280::_enabled[] PROGMEM = "enabled"; const char UsermodBME280::_enabled[] PROGMEM = "enabled";
static UsermodBME280 bme280_v2;
REGISTER_USERMOD(bme280_v2);

View File

@ -22,7 +22,6 @@ Dependencies
- Libraries - Libraries
- `BME280@~3.0.0` (by [finitespace](https://github.com/finitespace/BME280)) - `BME280@~3.0.0` (by [finitespace](https://github.com/finitespace/BME280))
- `Wire` - `Wire`
- These must be added under `lib_deps` in your `platform.ini` (or `platform_override.ini`).
- Data is published over MQTT - make sure you've enabled the MQTT sync interface. - Data is published over MQTT - make sure you've enabled the MQTT sync interface.
- This usermod also writes to serial (GPIO1 on ESP8266). Please make sure nothing else is listening to the serial TX pin or your board will get confused by log messages! - This usermod also writes to serial (GPIO1 on ESP8266). Please make sure nothing else is listening to the serial TX pin or your board will get confused by log messages!
@ -40,17 +39,11 @@ Methods also exist to read the read/calculated values from other WLED modules th
# Compiling # Compiling
To enable, compile with `USERMOD_BME280` defined (e.g. in `platformio_override.ini`) To enable, add `BME280_v2` to your `custom_usermods` (e.g. in `platformio_override.ini`)
```ini ```ini
[env:usermod_bme280_d1_mini] [env:usermod_bme280_d1_mini]
extends = env:d1_mini extends = env:d1_mini
build_flags = custom_usermods = ${env:d1_mini.custom_usermods} BME280_v2
${common.build_flags_esp8266}
-D USERMOD_BME280
lib_deps =
${esp8266.lib_deps}
BME280@~3.0.0
Wire
``` ```

View File

@ -0,0 +1,6 @@
{
"name:": "BME280_v2",
"dependencies": {
"finitespace/BME280":"~3.0.0"
}
}

View File

@ -6,7 +6,6 @@
* @date 19 Feb 2024 * @date 19 Feb 2024
*/ */
#pragma once
#warning ********************Included USERMOD_BME68X ******************** #warning ********************Included USERMOD_BME68X ********************
#define UMOD_DEVICE "ESP32" // NOTE - Set your hardware here #define UMOD_DEVICE "ESP32" // NOTE - Set your hardware here
@ -1112,3 +1111,7 @@ void UsermodBME68X::saveState() {
if (WLED_MQTT_CONNECTED) mqtt->publish(charbuffer, 0, false, contbuffer); if (WLED_MQTT_CONNECTED) mqtt->publish(charbuffer, 0, false, contbuffer);
} }
} }
static UsermodBME68X bme68x_v2;
REGISTER_USERMOD(bme68x_v2);

View File

@ -118,23 +118,6 @@ Methods also exist to read the read/calculated values from other WLED modules th
- getStabStatus(); - getStabStatus();
- getRunInStatus(); - getRunInStatus();
## Compiling
To enable, compile with `USERMOD_BME68X` defined (e.g. in `platformio_override.ini`) and add the `BSEC Software Library` to the lib_deps.
```
[env:esp32-BME680]
board = esp32dev
platform = ${esp32.platform}
platform_packages = ${esp32.platform_packages}
lib_deps = ${esp32.lib_deps}
boschsensortec/BSEC Software Library @ ^1.8.1492 ; USERMOD: BME680
build_unflags = ${common.build_unflags}
build_flags = ${common.build_flags_esp32}
-D USERMOD_BME68X ; USERMOD: BME680
```
## Revision History ## Revision History
### Version 1.0.0 ### Version 1.0.0
- First version of the BME68X_v user module - First version of the BME68X_v user module

View File

@ -0,0 +1,7 @@
{
"name:": "BME68X_v2",
"build": { "libArchive": false},
"dependencies": {
"boschsensortec/BSEC Software Library":"^1.8.1492"
}
}

View File

@ -1,5 +1,3 @@
#pragma once
#include "wled.h" #include "wled.h"
#include "battery_defaults.h" #include "battery_defaults.h"
#include "UMBattery.h" #include "UMBattery.h"
@ -857,3 +855,7 @@ const char UsermodBattery::_preset[] PROGMEM = "preset";
const char UsermodBattery::_duration[] PROGMEM = "duration"; const char UsermodBattery::_duration[] PROGMEM = "duration";
const char UsermodBattery::_init[] PROGMEM = "init"; const char UsermodBattery::_init[] PROGMEM = "init";
const char UsermodBattery::_haDiscovery[] PROGMEM = "HA-discovery"; const char UsermodBattery::_haDiscovery[] PROGMEM = "HA-discovery";
static UsermodBattery battery;
REGISTER_USERMOD(battery);

View File

@ -0,0 +1,3 @@
{
"name:": "Battery"
}

View File

@ -23,9 +23,7 @@ Enables battery level monitoring of your project.
## 🎈 Installation ## 🎈 Installation
| **Option 1** | **Option 2** | In `platformio_override.ini` (or `platformio.ini`)<br>Under: `custom_usermods =`, add the line: `Battery`<br><br>[Example: platformio_override.ini](assets/installation_platformio_override_ini.png) |
|--------------|--------------|
| In `wled00/my_config.h`<br>Add the line: `#define USERMOD_BATTERY`<br><br>[Example: my_config.h](assets/installation_my_config_h.png) | In `platformio_override.ini` (or `platformio.ini`)<br>Under: `build_flags =`, add the line: `-D USERMOD_BATTERY`<br><br>[Example: platformio_override.ini](assets/installation_platformio_override_ini.png) |
<br><br> <br><br>

View File

@ -1,5 +1,3 @@
#pragma once
#include "wled.h" #include "wled.h"
class UsermodCronixie : public Usermod { class UsermodCronixie : public Usermod {
@ -300,3 +298,6 @@ class UsermodCronixie : public Usermod {
return USERMOD_ID_CRONIXIE; return USERMOD_ID_CRONIXIE;
} }
}; };
static UsermodCronixie cronixie;
REGISTER_USERMOD(cronixie);

View File

@ -0,0 +1,3 @@
{
"name:": "Cronixie"
}

View File

@ -4,5 +4,5 @@ This usermod supports driving the Cronixie M and L clock kits by Diamex.
## Installation ## Installation
Compile and upload after adding `-D USERMOD_CRONIXIE` to `build_flags` of your PlatformIO environment. Compile and upload after adding `Cronixie` to `custom_usermods` of your PlatformIO environment.
Make sure the Auto Brightness Limiter is enabled at 420mA (!) and configure 60 WS281x LEDs. Make sure the Auto Brightness Limiter is enabled at 420mA (!) and configure 60 WS281x LEDs.

View File

@ -1,7 +1,5 @@
#pragma once
#include "wled.h" #include "wled.h"
#ifndef WLED_ENABLE_MQTT #ifdef WLED_DISABLE_MQTT
#error "This user mod requires MQTT to be enabled." #error "This user mod requires MQTT to be enabled."
#endif #endif
@ -245,3 +243,7 @@ class UsermodDHT : public Usermod {
} }
}; };
static UsermodDHT dht;
REGISTER_USERMOD(dht);

View File

@ -0,0 +1,7 @@
{
"name:": "DHT",
"build": { "libArchive": false},
"dependencies": {
"DHT_nonblocking":"https://github.com/alwynallan/DHT_nonblocking"
}
}

View File

@ -1,6 +1,5 @@
; Options ; Options
; ------- ; -------
; USERMOD_DHT - define this to have this user mod included wled00\usermods_list.cpp
; USERMOD_DHT_DHTTYPE - DHT model: 11, 21, 22 for DHT11, DHT21, or DHT22, defaults to 22/DHT22 ; USERMOD_DHT_DHTTYPE - DHT model: 11, 21, 22 for DHT11, DHT21, or DHT22, defaults to 22/DHT22
; USERMOD_DHT_PIN - pin to which DTH is connected, defaults to Q2 pin on QuinLed Dig-Uno's board ; USERMOD_DHT_PIN - pin to which DTH is connected, defaults to Q2 pin on QuinLed Dig-Uno's board
; USERMOD_DHT_CELSIUS - define this to report temperatures in degrees celsious, otherwise fahrenheit will be reported ; USERMOD_DHT_CELSIUS - define this to report temperatures in degrees celsious, otherwise fahrenheit will be reported
@ -11,13 +10,11 @@
[env:d1_mini_usermod_dht_C] [env:d1_mini_usermod_dht_C]
extends = env:d1_mini extends = env:d1_mini
build_flags = ${env:d1_mini.build_flags} -D USERMOD_DHT -D USERMOD_DHT_CELSIUS custom_usermods = ${env:d1_mini.custom_usermods} DHT
lib_deps = ${env:d1_mini.lib_deps} build_flags = ${env:d1_mini.build_flags} -D USERMOD_DHT_CELSIUS
https://github.com/alwynallan/DHT_nonblocking
[env:custom32_LEDPIN_16_usermod_dht_C] [env:custom32_LEDPIN_16_usermod_dht_C]
extends = env:custom32_LEDPIN_16 extends = env:custom32_LEDPIN_16
build_flags = ${env:custom32_LEDPIN_16.build_flags} -D USERMOD_DHT -D USERMOD_DHT_CELSIUS -D USERMOD_DHT_STATS custom_usermods = ${env:custom32_LEDPIN_16.custom_usermods} DHT
lib_deps = ${env.lib_deps} build_flags = ${env:custom32_LEDPIN_16.build_flags} -D USERMOD_DHT_CELSIUS -D USERMOD_DHT_STATS
https://github.com/alwynallan/DHT_nonblocking

View File

@ -15,7 +15,6 @@ Copy the example `platformio_override.ini` to the root directory. This file sho
### Define Your Options ### Define Your Options
* `USERMOD_DHT` - define this to include this user mod wled00\usermods_list.cpp
* `USERMOD_DHT_DHTTYPE` - DHT model: 11, 21, 22 for DHT11, DHT21, or DHT22, defaults to 22/DHT22 * `USERMOD_DHT_DHTTYPE` - DHT model: 11, 21, 22 for DHT11, DHT21, or DHT22, defaults to 22/DHT22
* `USERMOD_DHT_PIN` - pin to which DTH is connected, defaults to Q2 pin on QuinLed Dig-Uno's board * `USERMOD_DHT_PIN` - pin to which DTH is connected, defaults to Q2 pin on QuinLed Dig-Uno's board
* `USERMOD_DHT_CELSIUS` - define this to report temperatures in degrees Celsius, otherwise Fahrenheit will be reported * `USERMOD_DHT_CELSIUS` - define this to report temperatures in degrees Celsius, otherwise Fahrenheit will be reported

View File

@ -0,0 +1,4 @@
{
"name:": "EXAMPLE",
"dependencies": {}
}

View File

@ -4,7 +4,6 @@ In this usermod file you can find the documentation on how to take advantage of
## Installation ## Installation
Copy `usermod_v2_example.h` to the wled00 directory. Add `EXAMPLE` to `custom_usermods` in your PlatformIO environment and compile!
Uncomment the corresponding lines in `usermods_list.cpp` and compile!
_(You shouldn't need to actually install this, it does nothing useful)_ _(You shouldn't need to actually install this, it does nothing useful)_

View File

@ -1,5 +1,3 @@
#pragma once
#include "wled.h" #include "wled.h"
/* /*
@ -404,3 +402,6 @@ void MyExampleUsermod::publishMqtt(const char* state, bool retain)
} }
#endif #endif
} }
static MyExampleUsermod example_usermod;
REGISTER_USERMOD(example_usermod);

View File

@ -1,4 +1,3 @@
#pragma once
#include "TFTs.h" #include "TFTs.h"
#include "wled.h" #include "wled.h"
@ -156,3 +155,7 @@ class ElekstubeIPSUsermod : public Usermod {
const char ElekstubeIPSUsermod::_name[] PROGMEM = "EleksTubeIPS"; const char ElekstubeIPSUsermod::_name[] PROGMEM = "EleksTubeIPS";
const char ElekstubeIPSUsermod::_tubeSeg[] PROGMEM = "tubeSegment"; const char ElekstubeIPSUsermod::_tubeSeg[] PROGMEM = "tubeSegment";
const char ElekstubeIPSUsermod::_digitOffset[] PROGMEM = "digitOffset"; const char ElekstubeIPSUsermod::_digitOffset[] PROGMEM = "digitOffset";
static ElekstubeIPSUsermod elekstube_ips;
REGISTER_USERMOD(elekstube_ips);

View File

@ -0,0 +1,7 @@
{
"name:": "EleksTube_IPS",
"dependencies": {
"TFT_eSPI" : "2.5.33"
}
}
# Seems to add 300kb to the RAM requirement???

View File

@ -1,11 +1,12 @@
#ifndef WLED_ENABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
#include "wled.h" #include "wled.h"
#include <Arduino.h> #include <Arduino.h>
#include <U8x8lib.h> // from https://github.com/olikraus/u8g2/ #include <U8x8lib.h> // from https://github.com/olikraus/u8g2/
#include <DallasTemperature.h> //Dallastemperature sensor #include <DallasTemperature.h> //Dallastemperature sensor
#ifdef WLED_DISABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
//The SCL and SDA pins are defined here. //The SCL and SDA pins are defined here.
//Lolin32 boards use SCL=5 SDA=4 //Lolin32 boards use SCL=5 SDA=4
#define U8X8_PIN_SCL 5 #define U8X8_PIN_SCL 5

View File

@ -1,13 +1,13 @@
#ifndef WLED_ENABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
#include "wled.h" #include "wled.h"
#include <Arduino.h> #include <Arduino.h>
#include <U8x8lib.h> // from https://github.com/olikraus/u8g2/ #include <U8x8lib.h> // from https://github.com/olikraus/u8g2/
#include <Wire.h> #include <Wire.h>
#include <BME280I2C.h> //BME280 sensor #include <BME280I2C.h> //BME280 sensor
#ifdef WLED_DISABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
void UpdateBME280Data(); void UpdateBME280Data();
#define Celsius // Show temperature measurement in Celsius otherwise is in Fahrenheit #define Celsius // Show temperature measurement in Celsius otherwise is in Fahrenheit

View File

@ -0,0 +1,4 @@
{
"name:": "Fix_unreachable_netservices_v2",
"platforms": ["espressif8266"]
}

View File

@ -30,41 +30,6 @@ The usermod supports the following state changes:
## Installation ## Installation
1. Copy the file `usermod_Fix_unreachable_netservices.h` to the `wled00` directory. 1. Add `Fix_unreachable_netservices` to `custom_usermods` in your PlatformIO environment.
2. Register the usermod by adding `#include "usermod_Fix_unreachable_netservices.h"` in the top and `registerUsermod(new FixUnreachableNetServices());` in the bottom of `usermods_list.cpp`.
Example **usermods_list.cpp**:
```cpp
#include "wled.h"
/*
* Register your v2 usermods here!
* (for v1 usermods using just usermod.cpp, you can ignore this file)
*/
/*
* Add/uncomment your usermod filename here (and once more below)
* || || ||
* \/ \/ \/
*/
//#include "usermod_v2_example.h"
//#include "usermod_temperature.h"
//#include "usermod_v2_empty.h"
#include "usermod_Fix_unreachable_netservices.h"
void registerUsermods()
{
/*
* Add your usermod class name here
* || || ||
* \/ \/ \/
*/
//UsermodManager::add(new MyExampleUsermod());
//UsermodManager::add(new UsermodTemperature());
//UsermodManager::add(new UsermodRenameMe());
UsermodManager::add(new FixUnreachableNetServices());
}
```
Hopefully I can help someone with that - @gegu Hopefully I can help someone with that - @gegu

View File

@ -1,12 +1,4 @@
#pragma once
#include "wled.h" #include "wled.h"
#if defined(ESP32)
#warning "Usermod FixUnreachableNetServices works only with ESP8266 builds"
class FixUnreachableNetServices : public Usermod
{
};
#endif
#if defined(ESP8266) #if defined(ESP8266)
#include <ping.h> #include <ping.h>
@ -168,4 +160,11 @@ Delay <input type=\"number\" min=\"5\" max=\"300\" value=\"";
return USERMOD_ID_FIXNETSERVICES; return USERMOD_ID_FIXNETSERVICES;
} }
}; };
static FixUnreachableNetServices fix_unreachable_net_services;
REGISTER_USERMOD(fix_unreachable_net_services);
#else /* !ESP8266 */
#warning "Usermod FixUnreachableNetServices works only with ESP8266 builds"
#endif #endif

View File

@ -1,5 +1,3 @@
#pragma once
#include "wled.h" #include "wled.h"
#include <INA226_WE.h> #include <INA226_WE.h>
@ -210,12 +208,6 @@ private:
} }
} }
~UsermodINA226()
{
delete _ina226;
_ina226 = nullptr;
}
#ifndef WLED_DISABLE_MQTT #ifndef WLED_DISABLE_MQTT
void mqttInitialize() void mqttInitialize()
{ {
@ -551,6 +543,17 @@ public:
_initDone = true; _initDone = true;
return configComplete; return configComplete;
} }
~UsermodINA226()
{
delete _ina226;
_ina226 = nullptr;
}
}; };
const char UsermodINA226::_name[] PROGMEM = "INA226"; const char UsermodINA226::_name[] PROGMEM = "INA226";
static UsermodINA226 ina226_v2;
REGISTER_USERMOD(ina226_v2);

View File

@ -22,13 +22,6 @@ The following settings can be configured in the Usermod Menu:
- **MqttPublishAlways**: Publish always, regardless if there is a change. - **MqttPublishAlways**: Publish always, regardless if there is a change.
- **MqttHomeAssistantDiscovery**: Enable Home Assistant discovery. - **MqttHomeAssistantDiscovery**: Enable Home Assistant discovery.
## Dependencies
These must be added under `lib_deps` in your `platform.ini` (or `platform_override.ini`).
- Libraries
- `wollewald/INA226_WE@~1.2.9` (by [wollewald](https://registry.platformio.org/libraries/wollewald/INA226_WE))
- `Wire`
## Understanding Samples and Conversion Times ## Understanding Samples and Conversion Times
@ -62,16 +55,12 @@ For detailed programming information and register configurations, refer to the [
## Compiling ## Compiling
To enable, compile with `USERMOD_INA226` defined (e.g. in `platformio_override.ini`). To enable, compile with `INA226` in `custom_usermods` (e.g. in `platformio_override.ini`).
```ini ```ini
[env:ina226_example] [env:ina226_example]
extends = env:esp32dev extends = env:esp32dev
build_flags = custom_usermods = ${env:esp32dev.custom_usermods} INA226
${common.build_flags} ${esp32.build_flags} build_flags = ${env:esp32dev.build_flags}
-D USERMOD_INA226
; -D USERMOD_INA226_DEBUG ; -- add a debug status to the info modal ; -D USERMOD_INA226_DEBUG ; -- add a debug status to the info modal
lib_deps =
${esp32.lib_deps}
wollewald/INA226_WE@~1.2.9
``` ```

View File

@ -0,0 +1,6 @@
{
"name:": "INA226_v2",
"dependencies": {
"wollewald/INA226_WE":"~1.2.9"
}
}

View File

@ -1,9 +1,6 @@
[env:ina226_example] [env:ina226_example]
extends = env:esp32dev extends = env:esp32dev
custom_usermods = ${env:esp32dev.custom_usermods} INA226_v2
build_flags = build_flags =
${common.build_flags} ${esp32.build_flags} ${env:esp32dev.build_flags}
-D USERMOD_INA226
; -D USERMOD_INA226_DEBUG ; -- add a debug status to the info modal ; -D USERMOD_INA226_DEBUG ; -- add a debug status to the info modal
lib_deps =
${esp32.lib_deps}
wollewald/INA226_WE@~1.2.9

View File

@ -1,5 +1,3 @@
#pragma once
#include "wled.h" #include "wled.h"
class InternalTemperatureUsermod : public Usermod class InternalTemperatureUsermod : public Usermod
@ -194,3 +192,6 @@ void InternalTemperatureUsermod::publishMqtt(const char *state, bool retain)
} }
#endif #endif
} }
static InternalTemperatureUsermod internal_temperature_v2;
REGISTER_USERMOD(internal_temperature_v2);

View File

@ -0,0 +1,3 @@
{
"name:": "Internal_Temperature_v2"
}

View File

@ -23,8 +23,7 @@
## Installation ## Installation
- Add a build flag `-D USERMOD_INTERNAL_TEMPERATURE` to your `platformio.ini` (or `platformio_override.ini`). - Add `Internal_Temperature` to `custom_usermods` in your `platformio.ini` (or `platformio_override.ini`).
## 📝 Change Log ## 📝 Change Log

View File

@ -1,14 +1,10 @@
#warning **** Included USERMOD_LD2410 ****
#ifndef WLED_ENABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
#pragma once
#include "wled.h" #include "wled.h"
#include <ld2410.h> #include <ld2410.h>
#ifdef WLED_DISABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
class LD2410Usermod : public Usermod { class LD2410Usermod : public Usermod {
private: private:
@ -235,3 +231,7 @@ void LD2410Usermod::publishMqtt(const char* topic, const char* state, bool retai
} }
#endif #endif
} }
static LD2410Usermod ld2410_v2;
REGISTER_USERMOD(ld2410_v2);

View File

@ -0,0 +1,6 @@
{
"name:": "LD2410_v2",
"dependencies": {
"ncmreynolds/ld2410":"^0.1.3"
}
}

View File

@ -10,21 +10,15 @@ The movement and presence state are displayed in both the Info section of the we
## Dependencies ## Dependencies
- Libraries - Libraries
- `ncmreynolds/ld2410@^0.1.3` - `ncmreynolds/ld2410@^0.1.3`
- This must be added under `lib_deps` in your `platformio.ini` (or `platformio_override.ini`).
- Data is published over MQTT - make sure you've enabled the MQTT sync interface. - Data is published over MQTT - make sure you've enabled the MQTT sync interface.
## Compilation ## Compilation
To enable, compile with `USERMOD_LD2410` defined (e.g. in `platformio_override.ini`) To enable, compile with `LD2140` in `custom_usermods` (e.g. in `platformio_override.ini`)
```ini ```ini
[env:usermod_USERMOD_LD2410_esp32dev] [env:usermod_USERMOD_LD2410_esp32dev]
extends = env:esp32dev extends = env:esp32dev
build_flags = custom_usermods = ${env:esp32dev.custom_usermods} LD2140
${common.build_flags_esp32}
-D USERMOD_LD2410
lib_deps =
${esp32.lib_deps}
ncmreynolds/ld2410@^0.1.3
``` ```
### Configuration Options ### Configuration Options

View File

@ -1,4 +1,3 @@
#pragma once
#include "wled.h" #include "wled.h"
#ifndef ARDUINO_ARCH_ESP32 #ifndef ARDUINO_ARCH_ESP32
@ -151,3 +150,7 @@ class LDR_Dusk_Dawn_v2 : public Usermod {
}; };
const char LDR_Dusk_Dawn_v2::_name[] PROGMEM = "LDR_Dusk_Dawn_v2"; const char LDR_Dusk_Dawn_v2::_name[] PROGMEM = "LDR_Dusk_Dawn_v2";
static LDR_Dusk_Dawn_v2 ldr_dusk_dawn_v2;
REGISTER_USERMOD(ldr_dusk_dawn_v2);

View File

@ -2,13 +2,14 @@
This usermod will obtain readings from a Light Dependent Resistor (LDR) and will turn on/off specific presets based on those readings. This is useful for exterior lighting situations where you want the lights to only be on when it is dark out. This usermod will obtain readings from a Light Dependent Resistor (LDR) and will turn on/off specific presets based on those readings. This is useful for exterior lighting situations where you want the lights to only be on when it is dark out.
# Installation # Installation
Add "-D USERMOD_LDR_DUSK_DAWN" to your platformio.ini [common] build_flags and build. Add "LDR_Dusk_Dawn" to your platformio.ini environment's custom_usermods and build.
Example: Example:
``` ```
[common] [env:usermod_LDR_Dusk_Dawn_esp32dev]
build_flags = extends = env:esp32dev
-D USERMOD_LDR_DUSK_DAWN # Enable LDR Dusk Dawn Usermod custom_usermods = ${env:esp32dev.custom_usermods}
LDR_Dusk_Dawn # Enable LDR Dusk Dawn Usermod
``` ```
# Usermod Settings # Usermod Settings

View File

@ -0,0 +1,3 @@
{
"name:": "LDR_Dusk_Dawn_v2"
}

View File

@ -1,8 +1,6 @@
// force the compiler to show a warning to confirm that this file is included // force the compiler to show a warning to confirm that this file is included
#warning **** Included USERMOD_MAX17048 V2.0 **** #warning **** Included USERMOD_MAX17048 V2.0 ****
#pragma once
#include "wled.h" #include "wled.h"
#include "Adafruit_MAX1704X.h" #include "Adafruit_MAX1704X.h"
@ -279,3 +277,7 @@ const char Usermod_MAX17048::_enabled[] PROGMEM = "enabled";
const char Usermod_MAX17048::_maxReadInterval[] PROGMEM = "max-read-interval-ms"; const char Usermod_MAX17048::_maxReadInterval[] PROGMEM = "max-read-interval-ms";
const char Usermod_MAX17048::_minReadInterval[] PROGMEM = "min-read-interval-ms"; const char Usermod_MAX17048::_minReadInterval[] PROGMEM = "min-read-interval-ms";
const char Usermod_MAX17048::_HomeAssistantDiscovery[] PROGMEM = "HomeAssistantDiscovery"; const char Usermod_MAX17048::_HomeAssistantDiscovery[] PROGMEM = "HomeAssistantDiscovery";
static Usermod_MAX17048 max17048_v2;
REGISTER_USERMOD(max17048_v2);

View File

@ -0,0 +1,7 @@
{
"name:": "MAX17048_v2",
"build": { "libArchive": false},
"dependencies": {
"Adafruit_MAX1704X":"https://github.com/adafruit/Adafruit_MAX1704X#1.0.2"
}
}

View File

@ -1,5 +1,3 @@
#pragma once
#include "wled.h" #include "wled.h"
#include "MY92xx.h" #include "MY92xx.h"
@ -43,3 +41,6 @@ class MY9291Usermod : public Usermod {
return USERMOD_ID_MY9291; return USERMOD_ID_MY9291;
} }
}; };
static MY9291Usermod my9291;
REGISTER_USERMOD(my9291);

View File

@ -0,0 +1,4 @@
{
"name:": "MY9291",
"platforms": ["espressif8266"]
}

View File

@ -1,5 +1,3 @@
#pragma once
#include "wled.h" #include "wled.h"
#ifndef PIR_SENSOR_PIN #ifndef PIR_SENSOR_PIN
@ -571,3 +569,7 @@ bool PIRsensorSwitch::readFromConfig(JsonObject &root)
// use "return !top["newestParameter"].isNull();" when updating Usermod with new features // use "return !top["newestParameter"].isNull();" when updating Usermod with new features
return !(pins.isNull() || pins.size() != PIR_SENSOR_MAX_SENSORS); return !(pins.isNull() || pins.size() != PIR_SENSOR_MAX_SENSORS);
} }
static PIRsensorSwitch pir_sensor_switch;
REGISTER_USERMOD(pir_sensor_switch);

View File

@ -0,0 +1,3 @@
{
"name:": "PIR_sensor_switch"
}

View File

@ -1,10 +1,14 @@
#pragma once #include "wled.h"
#if !defined(USERMOD_DALLASTEMPERATURE) && !defined(USERMOD_SHT) #if defined(USERMOD_DALLASTEMPERATURE)
#include "UsermodTemperature.h"
#elif defined(USERMOD_SHT)
#include "ShtUsermod.h"
#else
#error The "PWM fan" usermod requires "Dallas Temeprature" or "SHT" usermod to function properly. #error The "PWM fan" usermod requires "Dallas Temeprature" or "SHT" usermod to function properly.
#endif #endif
#include "wled.h"
// PWM & tacho code curtesy of @KlausMu // PWM & tacho code curtesy of @KlausMu
// https://github.com/KlausMu/esp32-fan-controller/tree/main/src // https://github.com/KlausMu/esp32-fan-controller/tree/main/src
@ -397,3 +401,7 @@ const char PWMFanUsermod::_maxPWMValuePct[] PROGMEM = "max-PWM-percent";
const char PWMFanUsermod::_IRQperRotation[] PROGMEM = "IRQs-per-rotation"; const char PWMFanUsermod::_IRQperRotation[] PROGMEM = "IRQs-per-rotation";
const char PWMFanUsermod::_speed[] PROGMEM = "speed"; const char PWMFanUsermod::_speed[] PROGMEM = "speed";
const char PWMFanUsermod::_lock[] PROGMEM = "lock"; const char PWMFanUsermod::_lock[] PROGMEM = "lock";
static PWMFanUsermod pwm_fan;
REGISTER_USERMOD(pwm_fan);

View File

@ -0,0 +1,6 @@
{
"name:": "PWM_fan",
"build": {
"extraScript": "setup_deps.py"
}
}

View File

@ -11,8 +11,8 @@ If the _tachometer_ is supported, the current speed (in RPM) will be displayed o
## Installation ## Installation
Add the compile-time option `-D USERMOD_PWM_FAN` to your `platformio.ini` (or `platformio_override.ini`) or use `#define USERMOD_PWM_FAN` in `myconfig.h`. Add the `PWM_fan` to `custom_usermods` in your `platformio.ini` (or `platformio_override.ini`)
You will also need `-D USERMOD_DALLASTEMPERATURE`. You will also need `Temperature` or `sht`.
### Define Your Options ### Define Your Options

View File

@ -0,0 +1,12 @@
Import('env')
usermods = env.GetProjectOption("custom_usermods","").split()
# Check for dependencies
if "Temperature" in usermods:
env.Append(CPPDEFINES=[("USERMOD_DALLASTEMPERATURE")])
elif "sht" in usermods:
env.Append(CPPDEFINES=[("USERMOD_SHT")])
else:
raise RuntimeError("PWM_fan usermod requires Temperature or sht to be enabled")

View File

@ -1,5 +1,3 @@
#pragma once
#include "src/dependencies/time/DS1307RTC.h" #include "src/dependencies/time/DS1307RTC.h"
#include "wled.h" #include "wled.h"
@ -49,3 +47,6 @@ class RTCUsermod : public Usermod {
return USERMOD_ID_RTC; return USERMOD_ID_RTC;
} }
}; };
static RTCUsermod rtc;
REGISTER_USERMOD(rtc);

View File

@ -0,0 +1,3 @@
{
"name:": "RTC"
}

View File

@ -1,5 +1,3 @@
#pragma once
#include "wled.h" #include "wled.h"
//Pin defaults for QuinLed Dig-Uno (A0) //Pin defaults for QuinLed Dig-Uno (A0)
@ -210,3 +208,7 @@ const char Usermod_SN_Photoresistor::_referenceVoltage[] PROGMEM = "supplied-vol
const char Usermod_SN_Photoresistor::_resistorValue[] PROGMEM = "resistor-value"; const char Usermod_SN_Photoresistor::_resistorValue[] PROGMEM = "resistor-value";
const char Usermod_SN_Photoresistor::_adcPrecision[] PROGMEM = "adc-precision"; const char Usermod_SN_Photoresistor::_adcPrecision[] PROGMEM = "adc-precision";
const char Usermod_SN_Photoresistor::_offset[] PROGMEM = "offset"; const char Usermod_SN_Photoresistor::_offset[] PROGMEM = "offset";
static Usermod_SN_Photoresistor sn_photoresistor;
REGISTER_USERMOD(sn_photoresistor);

View File

@ -0,0 +1,3 @@
{
"name:": "SN_Photoresistor"
}

View File

@ -27,19 +27,6 @@ This usermod enables display of the following:
### Platformio.ini changes ### Platformio.ini changes
In the `platformio.ini` file, uncomment the `TFT_eSPI` line within the [common] section, under `lib_deps`:
```ini
# platformio.ini
...
[common]
...
lib_deps =
...
#For use of the TTGO T-Display ESP32 Module with integrated TFT display uncomment the following line
#TFT_eSPI
...
```
In the `platformio.ini` file, you must change the environment setup to build for just the esp32dev platform as follows: In the `platformio.ini` file, you must change the environment setup to build for just the esp32dev platform as follows:

View File

@ -1,8 +1,6 @@
// Credits to @mrVanboy, @gwaland and my dearest friend @westward // Credits to @mrVanboy, @gwaland and my dearest friend @westward
// Also for @spiff72 for usermod TTGO-T-Display // Also for @spiff72 for usermod TTGO-T-Display
// 210217 // 210217
#pragma once
#include "wled.h" #include "wled.h"
#include <TFT_eSPI.h> #include <TFT_eSPI.h>
#include <SPI.h> #include <SPI.h>
@ -411,3 +409,6 @@ class St7789DisplayUsermod : public Usermod {
//More methods can be added in the future, this example will then be extended. //More methods can be added in the future, this example will then be extended.
//Your usermod will remain compatible as it does not need to implement all methods from the Usermod base class! //Your usermod will remain compatible as it does not need to implement all methods from the Usermod base class!
}; };
static name. st7789_display;
REGISTER_USERMOD(st7789_display);

View File

@ -0,0 +1,3 @@
{
"name:": "ST7789_display"
}

View File

@ -1,9 +1,3 @@
#ifndef WLED_ENABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
#pragma once
// this is remixed from usermod_v2_SensorsToMqtt.h (sensors_to_mqtt usermod) // this is remixed from usermod_v2_SensorsToMqtt.h (sensors_to_mqtt usermod)
// and usermod_multi_relay.h (multi_relay usermod) // and usermod_multi_relay.h (multi_relay usermod)
@ -11,7 +5,11 @@
#include <Adafruit_Si7021.h> #include <Adafruit_Si7021.h>
#include <EnvironmentCalculations.h> // EnvironmentCalculations::HeatIndex(), ::DewPoint(), ::AbsoluteHumidity() #include <EnvironmentCalculations.h> // EnvironmentCalculations::HeatIndex(), ::DewPoint(), ::AbsoluteHumidity()
Adafruit_Si7021 si7021; #ifdef WLED_DISABLE_MQTT
#error "This user mod requires MQTT to be enabled."
#endif
static Adafruit_Si7021 si7021;
class Si7021_MQTT_HA : public Usermod class Si7021_MQTT_HA : public Usermod
{ {
@ -229,3 +227,7 @@ const char Si7021_MQTT_HA::_name[] PROGMEM = "Si7021 MQTT (Hom
const char Si7021_MQTT_HA::_enabled[] PROGMEM = "enabled"; const char Si7021_MQTT_HA::_enabled[] PROGMEM = "enabled";
const char Si7021_MQTT_HA::_sendAdditionalSensors[] PROGMEM = "Send Dew Point, Abs. Humidity and Heat Index"; const char Si7021_MQTT_HA::_sendAdditionalSensors[] PROGMEM = "Send Dew Point, Abs. Humidity and Heat Index";
const char Si7021_MQTT_HA::_haAutoDiscovery[] PROGMEM = "Home Assistant MQTT Auto-Discovery"; const char Si7021_MQTT_HA::_haAutoDiscovery[] PROGMEM = "Home Assistant MQTT Auto-Discovery";
static Si7021_MQTT_HA si7021_mqtt_ha;
REGISTER_USERMOD(si7021_mqtt_ha);

View File

@ -0,0 +1,7 @@
{
"name:": "Si7021_MQTT_HA",
"dependencies": {
"finitespace/BME280":"3.0.0",
"adafruit/Adafruit Si7021 Library" : "1.5.3"
}
}

View File

@ -1,114 +1,7 @@
#pragma once #include "UsermodTemperature.h"
#include "wled.h"
#include "OneWire.h"
//Pin defaults for QuinLed Dig-Uno if not overriden
#ifndef TEMPERATURE_PIN
#ifdef ARDUINO_ARCH_ESP32
#define TEMPERATURE_PIN 18
#else //ESP8266 boards
#define TEMPERATURE_PIN 14
#endif
#endif
// the frequency to check temperature, 1 minute
#ifndef USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL
#define USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL 60000
#endif
static uint16_t mode_temperature(); static uint16_t mode_temperature();
class UsermodTemperature : public Usermod {
private:
bool initDone = false;
OneWire *oneWire;
// GPIO pin used for sensor (with a default compile-time fallback)
int8_t temperaturePin = TEMPERATURE_PIN;
// measurement unit (true==°C, false==°F)
bool degC = true;
// using parasite power on the sensor
bool parasite = false;
int8_t parasitePin = -1;
// how often do we read from sensor?
unsigned long readingInterval = USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL;
// set last reading as "40 sec before boot", so first reading is taken after 20 sec
unsigned long lastMeasurement = UINT32_MAX - USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL;
// last time requestTemperatures was called
// used to determine when we can read the sensors temperature
// we have to wait at least 93.75 ms after requestTemperatures() is called
unsigned long lastTemperaturesRequest;
float temperature;
// indicates requestTemperatures has been called but the sensor measurement is not complete
bool waitingForConversion = false;
// flag set at startup if DS18B20 sensor not found, avoids trying to keep getting
// temperature if flashed to a board without a sensor attached
byte sensorFound;
bool enabled = true;
bool HApublished = false;
int16_t idx = -1; // Domoticz virtual sensor idx
// strings to reduce flash memory usage (used more than twice)
static const char _name[];
static const char _enabled[];
static const char _readInterval[];
static const char _parasite[];
static const char _parasitePin[];
static const char _domoticzIDX[];
static const char _sensor[];
static const char _temperature[];
static const char _Temperature[];
static const char _data_fx[];
//Dallas sensor quick (& dirty) reading. Credit to - Author: Peter Scargill, August 17th, 2013
float readDallas();
void requestTemperatures();
void readTemperature();
bool findSensor();
#ifndef WLED_DISABLE_MQTT
void publishHomeAssistantAutodiscovery();
#endif
static UsermodTemperature* _instance; // to overcome nonstatic getTemperatureC() method and avoid UsermodManager::lookup(USERMOD_ID_TEMPERATURE);
public:
UsermodTemperature() { _instance = this; }
static UsermodTemperature *getInstance() { return UsermodTemperature::_instance; }
/*
* API calls te enable data exchange between WLED modules
*/
inline float getTemperatureC() { return temperature; }
inline float getTemperatureF() { return temperature * 1.8f + 32.0f; }
float getTemperature();
const char *getTemperatureUnit();
uint16_t getId() override { return USERMOD_ID_TEMPERATURE; }
void setup() override;
void loop() override;
//void connected() override;
#ifndef WLED_DISABLE_MQTT
void onMqttConnect(bool sessionPresent) override;
#endif
//void onUpdateBegin(bool init) override;
//bool handleButton(uint8_t b) override;
//void handleOverlayDraw() override;
void addToJsonInfo(JsonObject& root) override;
//void addToJsonState(JsonObject &root) override;
//void readFromJsonState(JsonObject &root) override;
void addToConfig(JsonObject &root) override;
bool readFromConfig(JsonObject &root) override;
void appendConfigData() override;
};
//Dallas sensor quick (& dirty) reading. Credit to - Author: Peter Scargill, August 17th, 2013 //Dallas sensor quick (& dirty) reading. Credit to - Author: Peter Scargill, August 17th, 2013
float UsermodTemperature::readDallas() { float UsermodTemperature::readDallas() {
byte data[9]; byte data[9];
@ -471,3 +364,7 @@ static uint16_t mode_temperature() {
SEGMENT.fill(SEGMENT.color_from_palette(i, false, false, 255)); SEGMENT.fill(SEGMENT.color_from_palette(i, false, false, 255));
return FRAMETIME; return FRAMETIME;
} }
static UsermodTemperature temperature;
REGISTER_USERMOD(temperature);

View File

@ -0,0 +1,108 @@
#pragma once
#include "wled.h"
#include "OneWire.h"
//Pin defaults for QuinLed Dig-Uno if not overriden
#ifndef TEMPERATURE_PIN
#ifdef ARDUINO_ARCH_ESP32
#define TEMPERATURE_PIN 18
#else //ESP8266 boards
#define TEMPERATURE_PIN 14
#endif
#endif
// the frequency to check temperature, 1 minute
#ifndef USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL
#define USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL 60000
#endif
class UsermodTemperature : public Usermod {
private:
bool initDone = false;
OneWire *oneWire;
// GPIO pin used for sensor (with a default compile-time fallback)
int8_t temperaturePin = TEMPERATURE_PIN;
// measurement unit (true==°C, false==°F)
bool degC = true;
// using parasite power on the sensor
bool parasite = false;
int8_t parasitePin = -1;
// how often do we read from sensor?
unsigned long readingInterval = USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL;
// set last reading as "40 sec before boot", so first reading is taken after 20 sec
unsigned long lastMeasurement = UINT32_MAX - USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL;
// last time requestTemperatures was called
// used to determine when we can read the sensors temperature
// we have to wait at least 93.75 ms after requestTemperatures() is called
unsigned long lastTemperaturesRequest;
float temperature;
// indicates requestTemperatures has been called but the sensor measurement is not complete
bool waitingForConversion = false;
// flag set at startup if DS18B20 sensor not found, avoids trying to keep getting
// temperature if flashed to a board without a sensor attached
byte sensorFound;
bool enabled = true;
bool HApublished = false;
int16_t idx = -1; // Domoticz virtual sensor idx
// strings to reduce flash memory usage (used more than twice)
static const char _name[];
static const char _enabled[];
static const char _readInterval[];
static const char _parasite[];
static const char _parasitePin[];
static const char _domoticzIDX[];
static const char _sensor[];
static const char _temperature[];
static const char _Temperature[];
static const char _data_fx[];
//Dallas sensor quick (& dirty) reading. Credit to - Author: Peter Scargill, August 17th, 2013
float readDallas();
void requestTemperatures();
void readTemperature();
bool findSensor();
#ifndef WLED_DISABLE_MQTT
void publishHomeAssistantAutodiscovery();
#endif
static UsermodTemperature* _instance; // to overcome nonstatic getTemperatureC() method and avoid UsermodManager::lookup(USERMOD_ID_TEMPERATURE);
public:
UsermodTemperature() { _instance = this; }
static UsermodTemperature *getInstance() { return UsermodTemperature::_instance; }
/*
* API calls te enable data exchange between WLED modules
*/
inline float getTemperatureC() { return temperature; }
inline float getTemperatureF() { return temperature * 1.8f + 32.0f; }
float getTemperature();
const char *getTemperatureUnit();
uint16_t getId() override { return USERMOD_ID_TEMPERATURE; }
void setup() override;
void loop() override;
//void connected() override;
#ifndef WLED_DISABLE_MQTT
void onMqttConnect(bool sessionPresent) override;
#endif
//void onUpdateBegin(bool init) override;
//bool handleButton(uint8_t b) override;
//void handleOverlayDraw() override;
void addToJsonInfo(JsonObject& root) override;
//void addToJsonState(JsonObject &root) override;
//void readFromJsonState(JsonObject &root) override;
void addToConfig(JsonObject &root) override;
bool readFromConfig(JsonObject &root) override;
void appendConfigData() override;
};

View File

@ -0,0 +1,7 @@
{
"name:": "Temperature",
"build": { "libArchive": false},
"dependencies": {
"paulstoffregen/OneWire":"~2.3.8"
}
}

View File

@ -1,10 +1,5 @@
; Options ; Options
; ------- ; -------
; USERMOD_DALLASTEMPERATURE - define this to have this user mod included wled00\usermods_list.cpp
; USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL - the number of milliseconds between measurements, defaults to 60 seconds ; USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL - the number of milliseconds between measurements, defaults to 60 seconds
; ;
[env:d1_mini_usermod_dallas_temperature_C]
extends = env:d1_mini
build_flags = ${common.build_flags_esp8266} -D USERMOD_DALLASTEMPERATURE
lib_deps = ${env.lib_deps}
paulstoffregen/OneWire@~2.3.8

View File

@ -11,11 +11,19 @@ Maintained by @blazoncek
## Installation ## Installation
Copy the example `platformio_override.ini` to the root directory. This file should be placed in the same directory as `platformio.ini`. Add `Temperature` to `custom_usermods` in your platformio_override.ini.
Example **platformio_override.ini**:
```ini
[env:usermod_temperature_esp32dev]
extends = env:esp32dev
custom_usermods = ${env:esp32dev.custom_usermods}
Temperature
```
### Define Your Options ### Define Your Options
* `USERMOD_DALLASTEMPERATURE` - enables this user mod wled00/usermods_list.cpp
* `USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL` - number of milliseconds between measurements, defaults to 60000 ms (60s) * `USERMOD_DALLASTEMPERATURE_MEASUREMENT_INTERVAL` - number of milliseconds between measurements, defaults to 60000 ms (60s)
All parameters can be configured at runtime via the Usermods settings page, including pin, temperature in degrees Celsius or Fahrenheit and measurement interval. All parameters can be configured at runtime via the Usermods settings page, including pin, temperature in degrees Celsius or Fahrenheit and measurement interval.
@ -25,28 +33,6 @@ All parameters can be configured at runtime via the Usermods settings page, incl
* [QuinLED-Dig-Uno](https://quinled.info/2018/09/15/quinled-dig-uno/) - Project link * [QuinLED-Dig-Uno](https://quinled.info/2018/09/15/quinled-dig-uno/) - Project link
* [Srg74-WLED-Wemos-shield](https://github.com/srg74/WLED-wemos-shield) - another great DIY WLED board * [Srg74-WLED-Wemos-shield](https://github.com/srg74/WLED-wemos-shield) - another great DIY WLED board
### PlatformIO requirements
If you are using `platformio_override.ini`, you should be able to refresh the task list and see your custom task, for example `env:d1_mini_usermod_dallas_temperature_C`.
If you are not using `platformio_override.ini`, you might have to uncomment `OneWire@~2.3.5 under` `[common]` section in `platformio.ini`:
```ini
# platformio.ini
...
[platformio]
...
; default_envs = esp07
default_envs = d1_mini
...
[common]
...
lib_deps =
...
#For Dallas sensor uncomment following
paulstoffregen/OneWire @ ~2.3.8
```
## Change Log ## Change Log
2020-09-12 2020-09-12

View File

@ -1,5 +1,3 @@
#pragma once
#include "wled.h" #include "wled.h"
#include "FX.h" #include "FX.h"
#include "fcn_declare.h" #include "fcn_declare.h"
@ -250,3 +248,7 @@ public:
return USERMOD_ID_TETRISAI; return USERMOD_ID_TETRISAI;
} }
}; };
static TetrisAIUsermod tetrisai_v2;
REGISTER_USERMOD(tetrisai_v2);

View File

@ -0,0 +1,3 @@
{
"name:": "TetrisAI_v2"
}

View File

@ -13,8 +13,6 @@
* lib_deps = ${env.lib_deps} * lib_deps = ${env.lib_deps}
* pololu/VL53L0X @ ^1.3.0 * pololu/VL53L0X @ ^1.3.0
*/ */
#pragma once
#include "wled.h" #include "wled.h"
#include <Wire.h> #include <Wire.h>
@ -127,3 +125,6 @@ class UsermodVL53L0XGestures : public Usermod {
return USERMOD_ID_VL53L0X; return USERMOD_ID_VL53L0X;
} }
}; };
static UsermodVL53L0XGestures vl53l0x_gestures;
REGISTER_USERMOD(vl53l0x_gestures);

View File

@ -0,0 +1,7 @@
{
"name:": "VL53L0X_gestures",
"build": { "libArchive": false},
"dependencies": {
"pololu/VL53L0X" : "^1.3.0"
}
}

View File

@ -10,20 +10,4 @@ Useful for controlling strips when you want to avoid touching anything.
1. Attach VL53L0X sensor to i2c pins according to default pins for your board. 1. Attach VL53L0X sensor to i2c pins according to default pins for your board.
2. Add `-D USERMOD_VL53L0X_GESTURES` to your build flags at platformio.ini (plaformio_override.ini) for needed environment. 2. Add `-D USERMOD_VL53L0X_GESTURES` to your build flags at platformio.ini (plaformio_override.ini) for needed environment.
In my case, for example: `build_flags = ${env.build_flags} -D USERMOD_VL53L0X_GESTURES`
3. Add "pololu/VL53L0X" dependency below to `lib_deps` like this:
```ini
lib_deps = ${env.lib_deps}
pololu/VL53L0X @ ^1.3.0
```
My entire `platformio_override.ini` for example (for nodemcu board):
```ini
[platformio]
default_envs = nodemcuv2
[env:nodemcuv2]
build_flags = ${env.build_flags} -D USERMOD_VL53L0X_GESTURES
lib_deps = ${env.lib_deps}
pololu/VL53L0X @ ^1.3.0
```

View File

@ -1,4 +1,3 @@
#pragma once
#include "wled.h" #include "wled.h"
@ -2064,3 +2063,6 @@ const char AudioReactive::_digitalmic[] PROGMEM = "digitalmic";
const char AudioReactive::_addPalettes[] PROGMEM = "add-palettes"; 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[] 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 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,15 @@
{
"name": "audioreactive",
"build": {
"libArchive": false,
"extraScript": "override_sqrt.py"
},
"dependencies": [
{
"owner": "kosme",
"name": "arduinoFFT",
"version": "2.0.1",
"platforms": "espressif32"
}
]
}

View File

@ -0,0 +1,5 @@
Import('env')
for lb in env.GetLibBuilders():
if lb.name == "arduinoFFT":
lb.env.Append(CPPDEFINES=[("sqrt_internal", "sqrtf")])

View File

@ -27,11 +27,7 @@ Currently ESP8266 is not supported, due to low speed and small RAM of this chip.
There are however plans to create a lightweight audioreactive for the 8266, with reduced features. There are however plans to create a lightweight audioreactive for the 8266, with reduced features.
## Installation ## Installation
### using latest _arduinoFFT_ library version 2.x Add 'ADS1115_v2' to `custom_usermods` in your platformio environment.
The latest arduinoFFT release version should be used for audioreactive.
* `build_flags` = `-D USERMOD_AUDIOREACTIVE -D sqrt_internal=sqrtf`
* `lib_deps`= `kosme/arduinoFFT @ 2.0.1`
## Configuration ## Configuration

View File

@ -1,5 +1,3 @@
#pragma once
#include "wled.h" #include "wled.h"
/* /*
@ -457,3 +455,7 @@ void BobLightUsermod::pollBob() {
} }
} }
} }
static BobLightUsermod boblight;
REGISTER_USERMOD(boblight);

View File

@ -0,0 +1,3 @@
{
"name:": "boblight"
}

View File

@ -20,8 +20,7 @@ The LEDs should be wired in a clockwise orientation starting in the middle of bo
## Installation ## Installation
Add `-D USERMOD_BOBLIGHT` to your PlatformIO environment. Add `boblight` to `custom_usermods` in your PlatformIO environment.
If you are not using PlatformIO (which you should) try adding `#define USERMOD_BOBLIGHT` to *my_config.h*.
## Configuration ## Configuration

View File

@ -1,5 +1,3 @@
#pragma once
#include "wled.h" #include "wled.h"
#include "Arduino.h" #include "Arduino.h"
@ -79,3 +77,6 @@ class BuzzerUsermod : public Usermod {
return USERMOD_ID_BUZZER; return USERMOD_ID_BUZZER;
} }
}; };
static BuzzerUsermod buzzer;
REGISTER_USERMOD(buzzer);

View File

@ -0,0 +1,3 @@
{
"name:": "buzzer"
}

View File

@ -1,5 +1,3 @@
#pragma once
#include "wled.h" #include "wled.h"
#include "driver/rtc_io.h" #include "driver/rtc_io.h"
@ -225,3 +223,6 @@ void addToConfig(JsonObject& root) override
// add more strings here to reduce flash memory usage // add more strings here to reduce flash memory usage
const char DeepSleepUsermod::_name[] PROGMEM = "DeepSleep"; const char DeepSleepUsermod::_name[] PROGMEM = "DeepSleep";
const char DeepSleepUsermod::_enabled[] PROGMEM = "enabled"; const char DeepSleepUsermod::_enabled[] PROGMEM = "enabled";
static DeepSleepUsermod deep_sleep;
REGISTER_USERMOD(deep_sleep);

View File

@ -0,0 +1,3 @@
{
"name:": "deep_sleep"
}

Some files were not shown because too many files have changed in this diff Show More