-
-
Notifications
You must be signed in to change notification settings - Fork 123
Swap to using external repo for AudioReactive #331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: mdev
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| Import("env") | ||
| import os | ||
| import json | ||
|
|
||
| def patch_audioreactive_lib(source, target, env): | ||
| """Patch the AudioReactive library.json to exclude .cpp from compilation""" | ||
| libdeps_dir = env.subst("$PROJECT_LIBDEPS_DIR/$PIOENV") | ||
| library_json_path = os.path.join(libdeps_dir, "wled-audioreactive", "library.json") | ||
|
|
||
| if os.path.exists(library_json_path): | ||
| try: | ||
| with open(library_json_path, 'r') as f: | ||
| content = f.read() | ||
| # Handle malformed JSON (missing opening brace) | ||
| if not content.strip().startswith('{'): | ||
| content = '{' + content | ||
| if not content.strip().endswith('}'): | ||
| content = content + '}' | ||
| library_config = json.loads(content) | ||
|
|
||
| # Add srcFilter to exclude all source files from library compilation | ||
| if "build" not in library_config: | ||
| library_config["build"] = {} | ||
|
|
||
| if "srcFilter" not in library_config["build"]: | ||
| library_config["build"]["srcFilter"] = ["-<*>"] | ||
|
|
||
| with open(library_json_path, 'w') as f: | ||
| json.dump(library_config, f, indent=2) | ||
|
|
||
| print("✓ Patched wled-audioreactive library.json to exclude .cpp from compilation") | ||
| except Exception as e: | ||
| print(f"Warning: Could not patch wled-audioreactive library.json: {e}") | ||
|
|
||
| # Run immediately when script is loaded | ||
| patch_audioreactive_lib(None, None, env) | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -228,6 +228,7 @@ extra_scripts = | |||||||||||||||||||||||||||||||||||||||||
| pre:pio-scripts/build_ui.py | ||||||||||||||||||||||||||||||||||||||||||
| pre:pio-scripts/conditional_usb_mode.py | ||||||||||||||||||||||||||||||||||||||||||
| pre:pio-scripts/set_repo.py | ||||||||||||||||||||||||||||||||||||||||||
| pre:pio-scripts/patch_audioreactive.py | ||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Search for the patch script and verify its existence
find . -name "patch_audioreactive.py" -o -name "*patch*" -type f | head -20Repository: MoonModules/WLED-MM Length of output: 99 🏁 Script executed: # Check the pio-scripts directory structure
ls -la pio-scripts/ 2>/dev/null || echo "pio-scripts directory check"
git ls-files | grep -E "pio-scripts|patch" | head -20Repository: MoonModules/WLED-MM Length of output: 1426 🏁 Script executed: # Examine the platformio.ini file around line 231 to see the context
sed -n '225,235p' platformio.iniRepository: MoonModules/WLED-MM Length of output: 524 🏁 Script executed: cat pio-scripts/patch_audioreactive.pyRepository: MoonModules/WLED-MM Length of output: 1607 Script exists and has error handling, but failures are non-critical. The Consider adding explicit verification that the patch was successfully applied, or make patch failures fatal to the build if the patched library is required for compilation. 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||
| post:pio-scripts/output_bins.py | ||||||||||||||||||||||||||||||||||||||||||
| post:pio-scripts/strip-floats.py | ||||||||||||||||||||||||||||||||||||||||||
| pre:pio-scripts/user_config_copy.py | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -316,6 +317,7 @@ lib8266_deps = | |||||||||||||||||||||||||||||||||||||||||
| https://github.com/Aircoookie/ESPAsyncWebServer.git#v2.2.1 ;; use proven version for 8266 | ||||||||||||||||||||||||||||||||||||||||||
| ;; bitbank2/AnimatedGIF@^1.4.7 | ||||||||||||||||||||||||||||||||||||||||||
| ;; https://github.com/Aircoookie/GifDecoder.git#bc3af189b6b1e06946569f6b4287f0b79a860f8e | ||||||||||||||||||||||||||||||||||||||||||
| ${common_mm.AR_lib_deps} | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| lib_deps = | ||||||||||||||||||||||||||||||||||||||||||
| #https://github.com/lorol/LITTLEFS.git | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1185,8 +1187,17 @@ build_disable_sync_interfaces = | |||||||||||||||||||||||||||||||||||||||||
| -D WLED_DISABLE_ADALIGHT ;; WLEDMM this board does not have a serial-to-USB chip. Better to disable serial protocols, to avoid crashes (see upstream #3128) | ||||||||||||||||||||||||||||||||||||||||||
| -D WLED_DISABLE_ESPNOW ;; ESP-NOW requires wifi, may crash with ethernet only | ||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||
| AR_build_flags = -D USERMOD_AUDIOREACTIVE -D UM_AUDIOREACTIVE_USE_NEW_FFT ;; WLEDMM audioreactive usermod, licensed under EUPL-1.2 | ||||||||||||||||||||||||||||||||||||||||||
| AR_lib_deps = https://github.com/softhack007/arduinoFFT.git#develop @ 1.9.2 ;; used for USERMOD_AUDIOREACTIVE - optimized version, 10% faster on -S2/-C3 | ||||||||||||||||||||||||||||||||||||||||||
| AR_build_flags = | ||||||||||||||||||||||||||||||||||||||||||
| -D USERMOD_AUDIOREACTIVE | ||||||||||||||||||||||||||||||||||||||||||
| -D UM_AUDIOREACTIVE_USE_NEW_FFT | ||||||||||||||||||||||||||||||||||||||||||
| -I wled00 ;; Allow external AudioReactive library to access wled.h | ||||||||||||||||||||||||||||||||||||||||||
| -I $PROJECT_LIBDEPS_DIR/$PIOENV/wled-audioreactive ;; Allow main project to find audio_reactive.h | ||||||||||||||||||||||||||||||||||||||||||
| -D WLED_USE_PINMANAGER_V14 | ||||||||||||||||||||||||||||||||||||||||||
| ;; WLEDMM audioreactive usermod, licensed under EUPL-1.2 | ||||||||||||||||||||||||||||||||||||||||||
| ;; NOTE: External repo needs library.json updated with "srcFilter": ["-<*>"] to prevent .cpp compilation | ||||||||||||||||||||||||||||||||||||||||||
| AR_lib_deps = | ||||||||||||||||||||||||||||||||||||||||||
| https://github.com/netmindz/WLED-AudioReactive-Usermod.git#compat-MM ;; MM version 14 | ||||||||||||||||||||||||||||||||||||||||||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be swapped to MoonModules once we are good to merge the compat-MM PR |
||||||||||||||||||||||||||||||||||||||||||
| https://github.com/softhack007/arduinoFFT.git#develop @ 1.9.2 ;; used for USERMOD_AUDIOREACTIVE - optimized version, 10% faster on -S2/-C3 | ||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
1190
to
1200
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: In 1) PlatformIO Registry libraries (SemVer / version requirements)Syntax:
Examples:
2) VCS (Git) dependencies (pin branch/tag/commit with
|
||||||||||||||||||||||||||||||||||||||||||
| AR_build_flags = | |
| -D USERMOD_AUDIOREACTIVE | |
| -D UM_AUDIOREACTIVE_USE_NEW_FFT | |
| -I wled00 ;; Allow external AudioReactive library to access wled.h | |
| -I $PROJECT_LIBDEPS_DIR/$PIOENV/wled-audioreactive ;; Allow main project to find audio_reactive.h | |
| ;; WLEDMM audioreactive usermod, licensed under EUPL-1.2 | |
| ;; NOTE: External repo needs library.json updated with "srcFilter": ["-<*>"] to prevent .cpp compilation | |
| AR_lib_deps = | |
| https://github.com/MoonModules/WLED-AudioReactive-Usermod.git#39fee0aebc4f7581f23723acc710ea9cacc199d1 ;; MM version 14 | |
| https://github.com/softhack007/arduinoFFT.git#develop @ 1.9.2 ;; used for USERMOD_AUDIOREACTIVE - optimized version, 10% faster on -S2/-C3 | |
| AR_build_flags = | |
| -D USERMOD_AUDIOREACTIVE | |
| -D UM_AUDIOREACTIVE_USE_NEW_FFT | |
| -I wled00 ;; Allow external AudioReactive library to access wled.h | |
| -I $PROJECT_LIBDEPS_DIR/$PIOENV/wled-audioreactive ;; Allow main project to find audio_reactive.h | |
| ;; WLEDMM audioreactive usermod, licensed under EUPL-1.2 | |
| ;; NOTE: External repo needs library.json updated with "srcFilter": ["-<*>"] to prevent .cpp compilation | |
| AR_lib_deps = | |
| https://github.com/MoonModules/WLED-AudioReactive-Usermod.git#39fee0aebc4f7581f23723acc710ea9cacc199d1 ;; MM version 14 | |
| https://github.com/softhack007/arduinoFFT.git#develop ;; used for USERMOD_AUDIOREACTIVE - optimized version, 10% faster on -S2/-C3 |
🤖 Prompt for AI Agents
In `@platformio.ini` around lines 1189 - 1198, The AR_lib_deps entry for
arduinoFFT is an invalid mixed-format spec; update the AR_lib_deps line
referencing arduinoFFT (currently
"https://github.com/softhack007/arduinoFFT.git#develop @ 1.9.2") to a valid
VCS-only spec by removing the "@ 1.9.2" suffix (or alternatively pin a specific
git tag/commit after the "#" instead of using "@version"); ensure AR_lib_deps
contains a clean VCS URL for arduinoFFT so PlatformIO can resolve it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
# First, let's locate and examine the esp8266_2MB_S environment section
rg -n "esp8266_2MB_S" platformio.ini -A 10 -B 2Repository: MoonModules/WLED-MM
Length of output: 1430
🏁 Script executed:
# Find where common_mm.AR_lib_deps and common_mm.AR_build_flags are defined
rg -n "AR_lib_deps|AR_build_flags" platformio.ini -B 2 -A 2Repository: MoonModules/WLED-MM
Length of output: 5568
🏁 Script executed:
# Check the structure of the file to understand the context better
wc -l platformio.iniRepository: MoonModules/WLED-MM
Length of output: 82
🏁 Script executed:
# Check for comments around the 2MB, 4MB, and 16MB environments
sed -n '1608,1625p' platformio.ini
sed -n '1638,1650p' platformio.ini
sed -n '1736,1745p' platformio.iniRepository: MoonModules/WLED-MM
Length of output: 1839
🏁 Script executed:
# Verify that common_mm.AR_build_flags is properly defined
sed -n '1189,1200p' platformio.iniRepository: MoonModules/WLED-MM
Length of output: 872
Add AR_build_flags to esp8266_2MB_S build configuration.
The environment pulls ${common_mm.AR_lib_deps} but omits ${common_mm.AR_build_flags}, which includes the -D USERMOD_AUDIOREACTIVE define and required include paths. Without these flags, the AudioReactive library will fail to compile. This is inconsistent with esp8266pro_16MB_S and all ESP32 AR-enabled environments, which include both.
✅ Suggested fix:
build_flags = ${common.build_flags_esp8266}
+ ${common_mm.AR_build_flags}
-D WLED_RELEASE_NAME=esp8266_2MB_S🤖 Prompt for AI Agents
In `@platformio.ini` around lines 1612 - 1614, The esp8266 AR-enabled env is
pulling ${common_mm.AR_lib_deps} but missing the matching build flags; update
the esp8266_2MB_S environment so its build_flags include
${common_mm.AR_build_flags} (in the same place where build_flags =
${common.build_flags_esp8266} is declared) so the -D USERMOD_AUDIOREACTIVE
define and include paths from common_mm.AR_build_flags are applied; ensure the
change mirrors how esp8266pro_16MB_S and ESP32 AR environments include both
${common_mm.AR_lib_deps} and ${common_mm.AR_build_flags}.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add AR_build_flags to esp8266_4MB_S build configuration.
The environment pulls ${common_mm.AR_lib_deps} but omits ${common_mm.AR_build_flags}, which includes the -D USERMOD_AUDIOREACTIVE define and required include paths. Without these flags, the AudioReactive library will fail to compile. This is the same issue flagged in esp8266_2MB_S and should be fixed consistently across all AudioReactive-enabled ESP8266 environments.
✅ Suggested fix:
+ ${common_mm.AR_build_flags}
-D WLED_RELEASE_NAME=esp8266_4MB_S🤖 Prompt for AI Agents
In `@platformio.ini` around lines 1641 - 1643, The esp8266_4MB_S environment
imports ${common_mm.AR_lib_deps} but misses ${common_mm.AR_build_flags}, so
AudioReactive-specific defines and include paths (notably -D
USERMOD_AUDIOREACTIVE) are not applied and compilation fails; update the
esp8266_4MB_S env to add ${common_mm.AR_build_flags} alongside
${common.build_flags_esp8266} (mirror the fix used in esp8266_2MB_S) so the AR
build flags are passed into build_flags for that environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
cat -n pio-scripts/patch_audioreactive.py | head -40Repository: MoonModules/WLED-MM
Length of output: 1866
Enforce
srcFiltereven when it already existsThe patch only applies when
srcFilteris missing. If the upstream library is updated with a differentsrcFiltervalue that still includes sources, the patch won't override it and builds will unintentionally compile those.cppfiles. Update the logic to compare the current value with the desired one and enforce["-<*>"]whenever it differs.🛠️ Suggested fix
🤖 Prompt for AI Agents