-
-
Notifications
You must be signed in to change notification settings - Fork 132
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 1 commit
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 | ||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -1185,8 +1186,16 @@ 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 | ||||||||||||||||||||||||||||||||||||||||||
| ;; 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 | ||||||||||||||||||||||||||||||||||||||||||
|
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:
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