-
-
Notifications
You must be signed in to change notification settings - Fork 122
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 | ||
|
|
@@ -1185,8 +1186,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 | ||
|
|
||
| animartrix_build_flags = -D USERMOD_ANIMARTRIX ;; WLEDMM usermod: CC BY-NC 3.0 licensed effects by Stefan Petrick | ||
| ;;animartrix_lib_deps = https://github.com/netmindz/animartrix.git#af02653aaabdce08929389ca16d0d86071573dd4 ;; custom PSRAM allocator | ||
|
|
@@ -1600,6 +1610,8 @@ build_flags = ${esp32_4MB_M_base.build_flags} | |
| extends = env:esp8266_2m | ||
| upload_speed = 460800 ;115200 | ||
| board_build.f_cpu = 160000000L ;; we want 160Mhz (default = 80Mhz) | ||
| lib_deps = ${esp8266.lib_deps} | ||
| ${common_mm.AR_lib_deps} | ||
| build_flags = ${common.build_flags_esp8266} | ||
|
Comment on lines
+1613
to
1615
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: # 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 ✅ Suggested fix: build_flags = ${common.build_flags_esp8266}
+ ${common_mm.AR_build_flags}
-D WLED_RELEASE_NAME=esp8266_2MB_S🤖 Prompt for AI Agents |
||
| -D WLED_RELEASE_NAME=esp8266_2MB_S | ||
| -D WLED_USE_UNREAL_MATH ;; may cause some wrong sunset/sunrise times, but saves 7064 bytes FLASH and 975 bytes RAM | ||
|
|
@@ -1625,6 +1637,8 @@ build_flags = ${common.build_flags_esp8266} | |
| extends = env:d1_mini | ||
| upload_speed = 460800 ;115200 | ||
| board_build.f_cpu = 160000000L ;; we want 160Mhz (default = 80Mhz) | ||
| lib_deps = ${esp8266.lib_deps} | ||
| ${common_mm.AR_lib_deps} | ||
| build_flags = ${common.build_flags_esp8266} | ||
| -D WLED_RELEASE_NAME=esp8266_4MB_S | ||
| -D WLED_DISABLE_ALEXA | ||
|
|
@@ -1721,7 +1735,10 @@ board_build.flash_mode = qio ;; quad IO - fastest speed, in case your chip | |
| board_build.ldscript = ${common.ldscript_16m14m} ;; 16MB flash, use 14MB for LittleFS | ||
|
|
||
| upload_speed = 460800 ;115200 | ||
| lib_deps = ${esp8266.lib_deps} | ||
| ${common_mm.AR_lib_deps} | ||
| build_flags = ${common.build_flags_esp8266} | ||
| ${common_mm.AR_build_flags} | ||
| -D WLED_RELEASE_NAME=esp8266pro_16MB_S | ||
| -D WLED_WATCHDOG_TIMEOUT=0 | ||
| -D WLED_DISABLE_ALEXA | ||
|
|
@@ -1779,6 +1796,7 @@ build_flags = ${common.build_flags_esp8266} | |
| ; -D WLED_DEBUG | ||
| monitor_filters = esp8266_exception_decoder | ||
| lib_deps = ${esp8266.lib_deps} | ||
| ${common_mm.AR_lib_deps} | ||
| OneWire@~2.3.5 ; used for USERMOD_FOUR_LINE_DISPLAY and USERMOD_DALLASTEMPERATURE | ||
| olikraus/U8g2 @ ^2.28.8 ; used for USERMOD_FOUR_LINE_DISPLAY | ||
| ElectronicCats/MPU6050 @ 0.6.0 ; used for USERMOD_MPU6050_IMU | ||
|
|
||
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