Skip to content

Commit f5be339

Browse files
committed
Merge remote-tracking branch 'upstream/main' into mirror
2 parents 2ce0091 + bd933ff commit f5be339

358 files changed

Lines changed: 24905 additions & 15257 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/Dockerfile

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,7 @@
22

33
# [Choice] Python version: 3, 3.9, 3.8, 3.7, 3.6
44
ARG VARIANT="3"
5-
FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT}
6-
7-
# [Option] Install Node.js
8-
ARG INSTALL_NODE="true"
9-
ARG NODE_VERSION="lts/*"
10-
RUN if [ "${INSTALL_NODE}" = "true" ]; then su vscode -c "source /usr/local/share/nvm/nvm.sh && nvm install ${NODE_VERSION} 2>&1"; fi
5+
FROM mcr.microsoft.com/devcontainers/python:0-${VARIANT}
116

127
# [Optional] If your pip requirements rarely change, uncomment this section to add them to the image.
138
# COPY requirements.txt /tmp/pip-tmp/

.devcontainer/devcontainer.json

Lines changed: 24 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,7 @@
55
"context": "..",
66
"args": {
77
// Update 'VARIANT' to pick a Python version: 3, 3.6, 3.7, 3.8, 3.9
8-
"VARIANT": "3",
9-
// Options
10-
"INSTALL_NODE": "true",
11-
"NODE_VERSION": "lts/*"
8+
"VARIANT": "3"
129
}
1310
},
1411

@@ -27,34 +24,35 @@
2724
// risk to running the build directly on the host.
2825
// "runArgs": ["--privileged", "-v", "/dev/bus/usb:/dev/bus/usb", "--group-add", "dialout"],
2926

30-
// Set *default* container specific settings.json values on container create.
31-
"settings": {
32-
"terminal.integrated.shell.linux": "/bin/bash",
33-
"python.pythonPath": "/usr/local/bin/python",
34-
"python.linting.enabled": true,
35-
"python.linting.pylintEnabled": true,
36-
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
37-
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
38-
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
39-
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
40-
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
41-
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
42-
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
43-
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
44-
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
27+
"customizations": {
28+
"vscode": {
29+
"settings": {
30+
"terminal.integrated.shell.linux": "/bin/bash",
31+
"python.pythonPath": "/usr/local/bin/python",
32+
"python.linting.enabled": true,
33+
"python.linting.pylintEnabled": true,
34+
"python.formatting.autopep8Path": "/usr/local/py-utils/bin/autopep8",
35+
"python.formatting.blackPath": "/usr/local/py-utils/bin/black",
36+
"python.formatting.yapfPath": "/usr/local/py-utils/bin/yapf",
37+
"python.linting.banditPath": "/usr/local/py-utils/bin/bandit",
38+
"python.linting.flake8Path": "/usr/local/py-utils/bin/flake8",
39+
"python.linting.mypyPath": "/usr/local/py-utils/bin/mypy",
40+
"python.linting.pycodestylePath": "/usr/local/py-utils/bin/pycodestyle",
41+
"python.linting.pydocstylePath": "/usr/local/py-utils/bin/pydocstyle",
42+
"python.linting.pylintPath": "/usr/local/py-utils/bin/pylint"
43+
},
44+
"extensions": [
45+
"ms-python.python",
46+
"platformio.platformio-ide"
47+
]
48+
}
4549
},
4650

47-
// Add the IDs of extensions you want installed when the container is created.
48-
"extensions": [
49-
"ms-python.python",
50-
"platformio.platformio-ide"
51-
],
52-
5351
// Use 'forwardPorts' to make a list of ports inside the container available locally.
5452
// "forwardPorts": [],
5553

5654
// Use 'postCreateCommand' to run commands after the container is created.
57-
"postCreateCommand": "npm install",
55+
"postCreateCommand": "bash -i -c 'nvm install && npm ci'",
5856

5957
// Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root.
6058
"remoteUser": "vscode"

.github/FUNDING.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
github: [Aircoookie,blazoncek]
1+
github: [Aircoookie,blazoncek,DedeHai,lost-hope,willmmiles]
22
custom: ['https://paypal.me/Aircoookie','https://paypal.me/blazoncek']
3+
thanks_dev: u/gh/netmindz

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ body:
8080
id: terms
8181
attributes:
8282
label: Code of Conduct
83-
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/Aircoookie/WLED/blob/master/CODE_OF_CONDUCT.md)
83+
description: By submitting this issue, you agree to follow our [Code of Conduct](https://github.com/wled-dev/WLED/blob/main/CODE_OF_CONDUCT.md)
8484
options:
8585
- label: I agree to follow this project's Code of Conduct
8686
required: true

.github/copilot-instructions.md

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
# WLED - ESP32/ESP8266 LED Controller Firmware
2+
3+
WLED is a fast and feature-rich implementation of an ESP32 and ESP8266 webserver to control NeoPixel (WS2812B, WS2811, SK6812) LEDs and SPI-based chipsets. The project consists of C++ firmware for microcontrollers and a modern web interface.
4+
5+
Always reference these instructions first and fallback to search or bash commands only when you encounter unexpected information that does not match the info here.
6+
7+
## Working Effectively
8+
9+
### Initial Setup
10+
- Install Node.js 20+ (specified in `.nvmrc`): Check your version with `node --version`
11+
- Install dependencies: `npm ci` (takes ~5 seconds)
12+
- Install PlatformIO for hardware builds: `pip install -r requirements.txt` (takes ~60 seconds)
13+
14+
### Build and Test Workflow
15+
- **ALWAYS build web UI first**: `npm run build` -- takes 3 seconds. NEVER CANCEL.
16+
- **Run tests**: `npm test` -- takes 40 seconds. NEVER CANCEL. Set timeout to 2+ minutes.
17+
- **Development mode**: `npm run dev` -- monitors file changes and auto-rebuilds web UI
18+
- **Hardware firmware build**: `pio run -e [environment]` -- takes 15+ minutes. NEVER CANCEL. Set timeout to 30+ minutes.
19+
20+
### Build Process Details
21+
The build has two main phases:
22+
1. **Web UI Generation** (`npm run build`):
23+
- Processes files in `wled00/data/` (HTML, CSS, JS)
24+
- Minifies and compresses web content
25+
- Generates `wled00/html_*.h` files with embedded web content
26+
- **CRITICAL**: Must be done before any hardware build
27+
28+
2. **Hardware Compilation** (`pio run`):
29+
- Compiles C++ firmware for various ESP32/ESP8266 targets
30+
- Common environments: `nodemcuv2`, `esp32dev`, `esp8266_2m`
31+
- List all targets: `pio run --list-targets`
32+
33+
## Before Finishing Work
34+
35+
**CRITICAL: You MUST complete ALL of these steps before marking your work as complete:**
36+
37+
1. **Run the test suite**: `npm test` -- Set timeout to 2+ minutes. NEVER CANCEL.
38+
- All tests MUST pass
39+
- If tests fail, fix the issue before proceeding
40+
41+
2. **Build at least one hardware environment**: `pio run -e esp32dev` -- Set timeout to 30+ minutes. NEVER CANCEL.
42+
- Choose `esp32dev` as it's a common, representative environment
43+
- See "Hardware Compilation" section above for the full list of common environments
44+
- The build MUST complete successfully without errors
45+
- If the build fails, fix the issue before proceeding
46+
- **DO NOT skip this step** - it validates that firmware compiles with your changes
47+
48+
3. **For web UI changes only**: Manually test the interface
49+
- See "Manual Testing Scenarios" section below
50+
- Verify the UI loads and functions correctly
51+
52+
**If any of these validation steps fail, you MUST fix the issues before finishing. Do NOT mark work as complete with failing builds or tests.**
53+
54+
## Validation and Testing
55+
56+
### Web UI Testing
57+
- **ALWAYS validate web UI changes manually**:
58+
- Start local server: `cd wled00/data && python3 -m http.server 8080`
59+
- Open `http://localhost:8080/index.htm` in browser
60+
- Test basic functionality: color picker, effects, settings pages
61+
- **Check for JavaScript errors** in browser console
62+
63+
### Code Validation
64+
- **No automated linting configured** - follow existing code style in files you edit
65+
- **Code style**: Use tabs for web files (.html/.css/.js), spaces (2 per level) for C++ files
66+
- **C++ formatting available**: `clang-format` is installed but not in CI
67+
- **Always run tests before finishing**: `npm test`
68+
- **MANDATORY: Always run a hardware build before finishing** (see "Before Finishing Work" section below)
69+
70+
### Manual Testing Scenarios
71+
After making changes to web UI, always test:
72+
- **Load main interface**: Verify index.htm loads without errors
73+
- **Navigation**: Test switching between main page and settings pages
74+
- **Color controls**: Verify color picker and brightness controls work
75+
- **Effects**: Test effect selection and parameter changes
76+
- **Settings**: Test form submission and validation
77+
78+
## Common Tasks
79+
80+
### Repository Structure
81+
```
82+
wled00/ # Main firmware source (C++)
83+
├── data/ # Web interface files
84+
│ ├── index.htm # Main UI
85+
│ ├── settings*.htm # Settings pages
86+
│ └── *.js/*.css # Frontend resources
87+
├── *.cpp/*.h # Firmware source files
88+
└── html_*.h # Generated embedded web files (DO NOT EDIT)
89+
tools/ # Build tools (Node.js)
90+
├── cdata.js # Web UI build script
91+
└── cdata-test.js # Test suite
92+
platformio.ini # Hardware build configuration
93+
package.json # Node.js dependencies and scripts
94+
.github/workflows/ # CI/CD pipelines
95+
```
96+
97+
### Key Files and Their Purpose
98+
- `wled00/data/index.htm` - Main web interface
99+
- `wled00/data/settings*.htm` - Configuration pages
100+
- `tools/cdata.js` - Converts web files to C++ headers
101+
- `wled00/wled.h` - Main firmware configuration
102+
- `platformio.ini` - Hardware build targets and settings
103+
104+
### Development Workflow
105+
1. **For web UI changes**:
106+
- Edit files in `wled00/data/`
107+
- Run `npm run build` to regenerate headers
108+
- Test with local HTTP server
109+
- Run `npm test` to validate build system
110+
111+
2. **For firmware changes**:
112+
- Edit files in `wled00/` (but NOT `html_*.h` files)
113+
- Ensure web UI is built first (`npm run build`)
114+
- Build firmware: `pio run -e [target]`
115+
- Flash to device: `pio run -e [target] --target upload`
116+
117+
3. **For both web and firmware**:
118+
- Always build web UI first
119+
- Test web interface manually
120+
- Build and test firmware if making firmware changes
121+
122+
## Build Timing and Timeouts
123+
124+
**IMPORTANT: Use these timeout values when running builds:**
125+
126+
- **Web UI build** (`npm run build`): 3 seconds typical - Set timeout to 30 seconds minimum
127+
- **Test suite** (`npm test`): 40 seconds typical - Set timeout to 120 seconds (2 minutes) minimum
128+
- **Hardware builds** (`pio run -e [target]`): 15-20 minutes typical for first build - Set timeout to 1800 seconds (30 minutes) minimum
129+
- Subsequent builds are faster due to caching
130+
- First builds download toolchains and dependencies which takes significant time
131+
- **NEVER CANCEL long-running builds** - PlatformIO downloads and compilation require patience
132+
133+
**When validating your changes before finishing, you MUST wait for the hardware build to complete successfully. Set the timeout appropriately and be patient.**
134+
135+
## Troubleshooting
136+
137+
### Common Issues
138+
- **Build fails with missing html_*.h**: Run `npm run build` first
139+
- **Web UI looks broken**: Check browser console for JavaScript errors
140+
- **PlatformIO network errors**: Try again, downloads can be flaky
141+
- **Node.js version issues**: Ensure Node.js 20+ is installed (check `.nvmrc`)
142+
143+
### When Things Go Wrong
144+
- **Clear generated files**: `rm -f wled00/html_*.h` then rebuild
145+
- **Force web UI rebuild**: `npm run build -- --force` or `npm run build -- -f`
146+
- **Clean PlatformIO cache**: `pio run --target clean`
147+
- **Reinstall dependencies**: `rm -rf node_modules && npm install`
148+
149+
## Important Notes
150+
151+
- **DO NOT edit `wled00/html_*.h` files** - they are auto-generated
152+
- **Always commit both source files AND generated html_*.h files**
153+
- **Web UI must be built before firmware compilation**
154+
- **Test web interface manually after any web UI changes**
155+
- **Use VS Code with PlatformIO extension for best development experience**
156+
- **Hardware builds require appropriate ESP32/ESP8266 development board**
157+
158+
## CI/CD Pipeline
159+
160+
**The GitHub Actions CI workflow will:**
161+
1. Installs Node.js and Python dependencies
162+
2. Runs `npm test` to validate build system (MUST pass)
163+
3. Builds web UI with `npm run build` (automatically run by PlatformIO)
164+
4. Compiles firmware for ALL hardware targets listed in `default_envs` (MUST succeed for all)
165+
5. Uploads build artifacts
166+
167+
**To ensure CI success, you MUST locally:**
168+
- Run `npm test` and ensure it passes
169+
- Run `pio run -e esp32dev` (or another common environment from "Hardware Compilation" section) and ensure it completes successfully
170+
- If either fails locally, it WILL fail in CI
171+
172+
**Match this workflow in your local development to ensure CI success. Do not mark work complete until you have validated builds locally.**

.github/workflows/build.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626

2727

2828
build:
29-
name: Build Enviornments
29+
name: Build Environments
3030
runs-on: ubuntu-latest
3131
needs: get_default_envs
3232
strategy:
@@ -38,8 +38,12 @@ jobs:
3838
- name: Set up Node.js
3939
uses: actions/setup-node@v4
4040
with:
41+
node-version-file: '.nvmrc'
4142
cache: 'npm'
42-
- run: npm ci
43+
- run: |
44+
npm ci
45+
VERSION=`date +%y%m%d0`
46+
sed -i -r -e "s/define VERSION .+/define VERSION $VERSION/" wled00/wled.h
4347
- name: Cache PlatformIO
4448
uses: actions/cache@v4
4549
with:
@@ -56,6 +60,7 @@ jobs:
5660
cache: 'pip'
5761
- name: Install PlatformIO
5862
run: pip install -r requirements.txt
63+
5964
- name: Build firmware
6065
run: pio run -e ${{ matrix.environment }}
6166
- uses: actions/upload-artifact@v4
@@ -74,7 +79,7 @@ jobs:
7479
- name: Use Node.js
7580
uses: actions/setup-node@v4
7681
with:
77-
node-version: '20.x'
82+
node-version-file: '.nvmrc'
7883
cache: 'npm'
7984
- run: npm ci
8085
- run: npm test

.github/workflows/nightly.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
2+
name: Deploy Nightly
3+
on:
4+
# This can be used to automatically publish nightlies at UTC nighttime
5+
schedule:
6+
- cron: '0 2 * * *' # run at 2 AM UTC
7+
# This can be used to allow manually triggering nightlies from the web interface
8+
workflow_dispatch:
9+
10+
jobs:
11+
wled_build:
12+
uses: ./.github/workflows/build.yml
13+
nightly:
14+
name: Deploy nightly
15+
runs-on: ubuntu-latest
16+
needs: wled_build
17+
steps:
18+
- name: Download artifacts
19+
uses: actions/download-artifact@v4
20+
with:
21+
merge-multiple: true
22+
- name: Show Files
23+
run: ls -la
24+
- name: "✏️ Generate release changelog"
25+
id: changelog
26+
uses: janheinrichmerker/action-github-changelog-generator@v2.3
27+
with:
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
sinceTag: v0.15.0
30+
# Exclude issues that were closed without resolution from changelog
31+
exclude-labels: 'stale,wontfix,duplicate,invalid'
32+
- name: Update Nightly Release
33+
uses: andelf/nightly-release@main
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
36+
with:
37+
tag_name: nightly
38+
name: 'Nightly Release $$'
39+
prerelease: true
40+
body: ${{ steps.changelog.outputs.changelog }}
41+
files: |
42+
*.bin
43+
*.bin.gz
44+
- name: Repository Dispatch
45+
uses: peter-evans/repository-dispatch@v3
46+
with:
47+
repository: wled/WLED-WebInstaller
48+
event-type: release-nightly
49+
token: ${{ secrets.PAT_PUBLIC }}

.github/workflows/pr-merge.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Notify Discord on PR Merge
2+
on:
3+
workflow_dispatch:
4+
pull_request_target:
5+
types: [closed]
6+
7+
jobs:
8+
notify:
9+
runs-on: ubuntu-latest
10+
if: github.event.pull_request.merged == true
11+
steps:
12+
- name: Get User Permission
13+
id: checkAccess
14+
uses: actions-cool/check-user-permission@v2
15+
with:
16+
require: write
17+
username: ${{ github.triggering_actor }}
18+
env:
19+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20+
- name: Check User Permission
21+
if: steps.checkAccess.outputs.require-result == 'false'
22+
run: |
23+
echo "${{ github.triggering_actor }} does not have permissions on this repo."
24+
echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}"
25+
echo "Job originally triggered by ${{ github.actor }}"
26+
exit 1
27+
- name: Send Discord notification
28+
env:
29+
PR_NUMBER: ${{ github.event.pull_request.number }}
30+
PR_TITLE: ${{ github.event.pull_request.title }}
31+
PR_URL: ${{ github.event.pull_request.html_url }}
32+
ACTOR: ${{ github.actor }}
33+
run: |
34+
jq -n \
35+
--arg content "Pull Request #${PR_NUMBER} \"${PR_TITLE}\" merged by ${ACTOR}
36+
${PR_URL} . It will be included in the next nightly builds, please test" \
37+
'{content: $content}' \
38+
| curl -H "Content-Type: application/json" -d @- ${{ secrets.DISCORD_WEBHOOK_BETA_TESTERS }}

0 commit comments

Comments
 (0)