Skip to content

Commit 021dd3b

Browse files
authored
Merge branch 'wled:0_15_x' into 0_15_x
2 parents 20a32e0 + d9831f6 commit 021dd3b

28 files changed

+1539
-114
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ wled-update.sh
2323
/wled00/Release
2424
/wled00/wled00.ino.cpp
2525
/wled00/html_*.h
26+
_codeql_detected_source_root

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "wled",
3-
"version": "0.15.2-beta1",
3+
"version": "0.15.3-beta",
44
"description": "Tools for WLED project",
55
"main": "tools/cdata.js",
66
"directories": {

pio-scripts/output_bins.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import shutil
44
import gzip
5+
import json
56

67
OUTPUT_DIR = "build_output{}".format(os.path.sep)
78
#OUTPUT_DIR = os.path.join("build_output")
@@ -22,7 +23,8 @@ def create_release(source):
2223
release_name_def = _get_cpp_define_value(env, "WLED_RELEASE_NAME")
2324
if release_name_def:
2425
release_name = release_name_def.replace("\\\"", "")
25-
version = _get_cpp_define_value(env, "WLED_VERSION")
26+
with open("package.json", "r") as package:
27+
version = json.load(package)["version"]
2628
release_file = os.path.join(OUTPUT_DIR, "release", f"WLED_{version}_{release_name}.bin")
2729
release_gz_file = release_file + ".gz"
2830
print(f"Copying {source} to {release_file}")

pio-scripts/set_metadata.py

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
Import('env')
2+
import subprocess
3+
import json
4+
import re
5+
6+
def get_github_repo():
7+
"""Extract GitHub repository name from git remote URL.
8+
9+
Uses the remote that the current branch tracks, falling back to 'origin'.
10+
This handles cases where repositories have multiple remotes or where the
11+
main remote is not named 'origin'.
12+
13+
Returns:
14+
str: Repository name in 'owner/repo' format for GitHub repos,
15+
'unknown' for non-GitHub repos, missing git CLI, or any errors.
16+
"""
17+
try:
18+
remote_name = 'origin' # Default fallback
19+
20+
# Try to get the remote for the current branch
21+
try:
22+
# Get current branch name
23+
branch_result = subprocess.run(['git', 'rev-parse', '--abbrev-ref', 'HEAD'],
24+
capture_output=True, text=True, check=True)
25+
current_branch = branch_result.stdout.strip()
26+
27+
# Get the remote for the current branch
28+
remote_result = subprocess.run(['git', 'config', f'branch.{current_branch}.remote'],
29+
capture_output=True, text=True, check=True)
30+
tracked_remote = remote_result.stdout.strip()
31+
32+
# Use the tracked remote if we found one
33+
if tracked_remote:
34+
remote_name = tracked_remote
35+
except subprocess.CalledProcessError:
36+
# If branch config lookup fails, continue with 'origin' as fallback
37+
pass
38+
39+
# Get the remote URL for the determined remote
40+
result = subprocess.run(['git', 'remote', 'get-url', remote_name],
41+
capture_output=True, text=True, check=True)
42+
remote_url = result.stdout.strip()
43+
44+
# Check if it's a GitHub URL
45+
if 'github.com' not in remote_url.lower():
46+
return None
47+
48+
# Parse GitHub URL patterns:
49+
# https://github.com/owner/repo.git
50+
# [email protected]:owner/repo.git
51+
# https://github.com/owner/repo
52+
53+
# Remove .git suffix if present
54+
if remote_url.endswith('.git'):
55+
remote_url = remote_url[:-4]
56+
57+
# Handle HTTPS URLs
58+
https_match = re.search(r'github\.com/([^/]+/[^/]+)', remote_url, re.IGNORECASE)
59+
if https_match:
60+
return https_match.group(1)
61+
62+
# Handle SSH URLs
63+
ssh_match = re.search(r'github\.com:([^/]+/[^/]+)', remote_url, re.IGNORECASE)
64+
if ssh_match:
65+
return ssh_match.group(1)
66+
67+
return None
68+
69+
except FileNotFoundError:
70+
# Git CLI is not installed or not in PATH
71+
return None
72+
except subprocess.CalledProcessError:
73+
# Git command failed (e.g., not a git repo, no remote, etc.)
74+
return None
75+
except Exception:
76+
# Any other unexpected error
77+
return None
78+
79+
# WLED version is managed by package.json; this is picked up in several places
80+
# - It's integrated in to the UI code
81+
# - Here, for wled_metadata.cpp
82+
# - The output_bins script
83+
# We always take it from package.json to ensure consistency
84+
with open("package.json", "r") as package:
85+
WLED_VERSION = json.load(package)["version"]
86+
87+
def has_def(cppdefs, name):
88+
""" Returns true if a given name is set in a CPPDEFINES collection """
89+
for f in cppdefs:
90+
if isinstance(f, tuple):
91+
f = f[0]
92+
if f == name:
93+
return True
94+
return False
95+
96+
97+
def add_wled_metadata_flags(env, node):
98+
cdefs = env["CPPDEFINES"].copy()
99+
100+
if not has_def(cdefs, "WLED_REPO"):
101+
repo = get_github_repo()
102+
if repo:
103+
cdefs.append(("WLED_REPO", f"\\\"{repo}\\\""))
104+
105+
cdefs.append(("WLED_VERSION", WLED_VERSION))
106+
107+
# This transforms the node in to a Builder; it cannot be modified again
108+
return env.Object(
109+
node,
110+
CPPDEFINES=cdefs
111+
)
112+
113+
env.AddBuildMiddleware(
114+
add_wled_metadata_flags,
115+
"*/wled_metadata.cpp"
116+
)

pio-scripts/set_version.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

platformio.ini

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ ldscript_4m1m = eagle.flash.4m1m.ld
110110

111111
[scripts_defaults]
112112
extra_scripts =
113-
pre:pio-scripts/set_version.py
113+
pre:pio-scripts/set_metadata.py
114114
post:pio-scripts/output_bins.py
115115
post:pio-scripts/strip-floats.py
116116
pre:pio-scripts/user_config_copy.py
@@ -138,7 +138,7 @@ lib_compat_mode = strict
138138
lib_deps =
139139
fastled/FastLED @ 3.6.0
140140
IRremoteESP8266 @ 2.8.2
141-
makuna/NeoPixelBus @ 2.8.3
141+
https://github.com/Makuna/NeoPixelBus.git#a0919d1c10696614625978dd6fb750a1317a14ce
142142
https://github.com/Aircoookie/ESPAsyncWebServer.git#v2.4.2
143143
# for I2C interface
144144
;Wire

tools/cdata.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -370,12 +370,6 @@ const char PAGE_dmxmap[] PROGMEM = R"=====()=====";
370370
name: "PAGE_update",
371371
method: "gzip",
372372
filter: "html-minify",
373-
mangle: (str) =>
374-
str
375-
.replace(
376-
/function GetV().*\<\/script\>/gms,
377-
"</script><script src=\"/settings/s.js?p=9\"></script>"
378-
)
379373
},
380374
{
381375
file: "welcome.htm",

usermods/audioreactive/audio_reactive.h

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@
77
#include <driver/i2s.h>
88
#include <driver/adc.h>
99

10-
#ifdef WLED_ENABLE_DMX
11-
#error This audio reactive usermod is not compatible with DMX Out.
12-
#endif
13-
1410
#endif
1511

1612
#if defined(ARDUINO_ARCH_ESP32) && (defined(WLED_DEBUG) || defined(SR_DEBUG))
@@ -1225,14 +1221,20 @@ class AudioReactive : public Usermod {
12251221
#if !defined(CONFIG_IDF_TARGET_ESP32S2) && !defined(CONFIG_IDF_TARGET_ESP32C3) && !defined(CONFIG_IDF_TARGET_ESP32S3)
12261222
// ADC over I2S is only possible on "classic" ESP32
12271223
case 0:
1228-
default:
12291224
DEBUGSR_PRINTLN(F("AR: Analog Microphone (left channel only)."));
12301225
audioSource = new I2SAdcSource(SAMPLE_RATE, BLOCK_SIZE);
12311226
delay(100);
12321227
useBandPassFilter = true; // PDM bandpass filter seems to help for bad quality analog
12331228
if (audioSource) audioSource->initialize(audioPin);
12341229
break;
12351230
#endif
1231+
1232+
case 255: // 255 = -1 = no audio source
1233+
// falls through to default
1234+
default:
1235+
if (audioSource) delete audioSource; audioSource = nullptr;
1236+
enabled = false;
1237+
break;
12361238
}
12371239
delay(250); // give microphone enough time to initialise
12381240

@@ -1319,7 +1321,7 @@ class AudioReactive : public Usermod {
13191321
disableSoundProcessing = true;
13201322
} else {
13211323
#if defined(ARDUINO_ARCH_ESP32) && defined(WLED_DEBUG)
1322-
if ((disableSoundProcessing == true) && (audioSyncEnabled == 0) && audioSource->isInitialized()) { // we just switched to "enabled"
1324+
if ((disableSoundProcessing == true) && (audioSyncEnabled == 0) && audioSource && audioSource->isInitialized()) { // we just switched to "enabled"
13231325
DEBUG_PRINTLN(F("[AR userLoop] realtime mode ended - audio processing resumed."));
13241326
DEBUG_PRINTF_P(PSTR(" RealtimeMode = %d; RealtimeOverride = %d\n"), int(realtimeMode), int(realtimeOverride));
13251327
}
@@ -1331,7 +1333,7 @@ class AudioReactive : public Usermod {
13311333
if (audioSyncEnabled & 0x02) disableSoundProcessing = true; // make sure everything is disabled IF in audio Receive mode
13321334
if (audioSyncEnabled & 0x01) disableSoundProcessing = false; // keep running audio IF we're in audio Transmit mode
13331335
#ifdef ARDUINO_ARCH_ESP32
1334-
if (!audioSource->isInitialized()) disableSoundProcessing = true; // no audio source
1336+
if (!audioSource || !audioSource->isInitialized()) disableSoundProcessing = true; // no audio source
13351337

13361338

13371339
// Only run the sampling code IF we're not in Receive mode or realtime mode

wled00/FX.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ uint16_t mode_twinkle(void) {
580580
SEGENV.step = it;
581581
}
582582

583-
unsigned PRNG16 = SEGENV.aux1;
583+
uint16_t PRNG16 = SEGENV.aux1;
584584

585585
for (unsigned i = 0; i < SEGENV.aux0; i++)
586586
{

0 commit comments

Comments
 (0)