Skip to content

Commit 17c6bb9

Browse files
authored
Merge branch 'MoonModules:mdev' into mdev
2 parents 986a0ad + f4d15d1 commit 17c6bb9

23 files changed

Lines changed: 690 additions & 187 deletions

.coderabbit.yaml

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# CodeRabbit configuration — references existing guideline files to avoid
44
# duplicating conventions. See:
55
# .github/copilot-instructions.md — project overview & general rules
6-
# .github/cpp.instructions.md — C++ coding conventions
7-
# .github/web.instructions.md — Web UI coding conventions
8-
# .github/cicd.instructions.md — GitHub Actions / CI-CD conventions
9-
# .github/esp-idf.instructions.md — ESP-IDF / chip-specific coding guidelines
6+
# docs/cpp.instructions.md — C++ coding conventions
7+
# docs/web.instructions.md — Web UI coding conventions
8+
# docs/cicd.instructions.md — GitHub Actions / CI-CD conventions
9+
# docs/esp-idf.instructions.md — ESP-IDF / chip-specific coding guidelines
1010
# (apply when code directly uses ESP-IDF APIs:
1111
# esp_idf_*, I2S, RMT, ADC, GPIO, heap_caps, etc.)
1212
#
@@ -17,14 +17,27 @@
1717
language: en-US
1818

1919
reviews:
20+
# generic review setting, see https://docs.coderabbit.ai/reference/configuration#reference
21+
auto_apply_labels: true
22+
# abort_on_close: false
23+
high_level_summary: true
24+
review_status: true
25+
collapse_walkthrough: false
26+
poem: false
27+
# sequence_diagrams: false
28+
auto_review:
29+
enabled: true
30+
ignore_title_keywords:
31+
- WIP
32+
2033
path_instructions:
2134
- path: "**/*.{cpp,h,hpp,ino}"
2235
instructions: >
23-
Follow the C++ coding conventions documented in .github/cpp.instructions.md
36+
Follow the C++ coding conventions documented in docs/cpp.instructions.md
2437
and the general project guidelines in .github/copilot-instructions.md.
2538
If the code under review directly uses ESP-IDF APIs (e.g. heap_caps_malloc,
2639
I2S, RMT, ADC, GPIO, esp_timer, or any esp_idf_* / soc_* symbols), also
27-
apply the guidelines in .github/esp-idf.instructions.md.
40+
apply the guidelines in docs/esp-idf.instructions.md.
2841
2942
Key rules: 2-space indentation (no tabs), camelCase functions/variables,
3043
PascalCase classes, UPPER_CASE macros. Mark WLED-MM-specific changes with
@@ -36,10 +49,10 @@ reviews:
3649
3750
- path: "wled00/data/**"
3851
instructions: >
39-
Follow the web UI conventions documented in .github/web.instructions.md.
52+
Follow the web UI conventions documented in docs/web.instructions.md.
4053
4154
Key rules: indent HTML and JavaScript with tabs, CSS with tabs or spaces.
42-
Files here are built into wled00/html_*.h by tools/cdata.js — never
55+
Files here are built into wled00/html_*.h and wled00/js_*.h by tools/cdata.js — never
4356
edit those generated headers directly.
4457
4558
- path: "wled00/html_*.h"
@@ -48,17 +61,23 @@ reviews:
4861
They must never be manually edited or committed. Flag any PR that
4962
includes changes to these files.
5063
64+
- path: "wled00/js_*.h"
65+
instructions: >
66+
These files are auto-generated from wled00/data/ by tools/cdata.js.
67+
They must never be manually edited or committed. Flag any PR that
68+
includes changes to these files.
69+
5170
- path: "usermods/**"
5271
instructions: >
5372
Usermods are community add-ons following the upstream WLED 0.15.x style.
5473
Each usermod lives in its own directory under usermods/ and is implemented
5574
as a .h file that is pulled in by wled00/usermods_list.cpp (guarded by
5675
#ifdef). Usermods do not use library.json. Follow the same C++ conventions
57-
as the core firmware (.github/cpp.instructions.md).
76+
as the core firmware (docs/cpp.instructions.md).
5877
5978
- path: ".github/workflows/*.{yml,yaml}"
6079
instructions: >
61-
Follow the CI/CD conventions documented in .github/cicd.instructions.md.
80+
Follow the CI/CD conventions documented in docs/cicd.instructions.md.
6281
6382
Key rules: 2-space indentation, descriptive name: on every workflow/job/step.
6483
Third-party actions must be pinned to a specific version tag — branch pins
@@ -67,7 +86,7 @@ reviews:
6786
into run: steps — pass them through an env: variable to prevent script
6887
injection. Do not use pull_request_target unless fully justified.
6988
70-
- path: ".github/*.instructions.md"
89+
- path: "**/*.instructions.md"
7190
instructions: |
7291
This file contains both AI-facing rules and human-only reference sections.
7392
Human-only sections are enclosed in `<!-- HUMAN_ONLY_START -->` /
@@ -81,4 +100,14 @@ reviews:
81100
2. Flag any HUMAN_ONLY section whose content has drifted from the surrounding
82101
AI-facing rules due to edits introduced in this PR.
83102
3. If new AI-facing rules were added without updating a related HUMAN_ONLY
84-
reference section, note this as a suggestion (not a required fix).
103+
reference section, note this as a suggestion (not a required fix).
104+
105+
finishing_touches:
106+
# Docstrings | Options for generating Docstrings for your PRs/MRs.
107+
docstrings:
108+
# Docstrings | Allow CodeRabbit to generate docstrings for PRs/MRs.
109+
# default: true - disabled in WLED-MM: has caused confusion in the past
110+
enabled: false
111+
unit_tests:
112+
# default: true - disabled in WLED-MM: we don't have a unit test framework, this option just confuses contributors
113+
enabled: false

.github/ISSUE_TEMPLATE/bug.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ body:
55
- type: markdown
66
attributes:
77
value: |
8-
Please quickly search existing issues first before submitting a bug.
8+
Please quickly search existing issues first before submitting a bug.
9+
Please don't submit long error analyses created by an AI agent, these are often totally wrong.
10+
Just describe the problem in your own words.
911
- type: textarea
1012
id: what-happened
1113
attributes:

.github/agent-build.instructions.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Use these timeout values when running builds:
1111

1212
| Command | Typical Time | Minimum Timeout | Notes |
1313
|---|---|---|---|
14-
| `npm run build` | ~3 s | 30 s | Web UI → `wled00/html_*.h` headers |
14+
| `npm run build` | ~3 s | 30 s | Web UI → `wled00/html_*.h` `wled00/js_*.h` headers |
1515
| `npm test` | ~40 s | 2 min | Validates build system |
1616
| `npm run dev` | continuous || Watch mode, auto-rebuilds on changes |
1717
| `pio run -e <env>` | 15–20 min | 30 min | First build downloads toolchains; subsequent builds are faster |
@@ -20,16 +20,21 @@ Use these timeout values when running builds:
2020

2121
## Development Workflow
2222

23+
### Code Style Summary
24+
- **C++** files in `wled00/` and `usermods/`: 2-space indentation (no tabs), camelCase functions/variables, PascalCase classes, UPPER_CASE macros. No C++ exceptions — use return codes and debug macros.
25+
- **Web UI** files in `wled00/data`: indent HTML and JavaScript with tabs, CSS with tabs.
26+
- **CI/CD workflows** in `.github/workflows`: 2-space indentation, descriptive `name:` on every workflow/job/step. Third-party actions must be pinned to a specific version tag — branch pins such as `@main` or `@master` are not allowed. SHA pinning recommended.
27+
2328
### Web UI Changes
2429

2530
1. Edit files in `wled00/data/`
26-
2. Run `npm run build` to regenerate `wled00/html_*.h` headers
31+
2. Run `npm run build` to regenerate `wled00/html_*.h` `wled00/js_*.h` headers
2732
3. Test with local HTTP server (see Manual Testing below)
2833
4. Run `npm test` to validate
2934

3035
### Firmware Changes
3136

32-
1. Edit files in `wled00/` (but **never** `html_*.h` files)
37+
1. Edit files in `wled00/` (but **never** `html_*.h` and `js_*.h` files)
3338
2. Ensure web UI is built first: `npm run build`
3439
3. Build firmware: `pio run -e esp32_4MB_V4_M` (set timeout ≥ 30 min)
3540
4. Flash to device: `pio run -e [target] --target upload`
@@ -85,8 +90,8 @@ Test these scenarios after every web UI change:
8590
### Recovery Steps
8691

8792
- **Force web UI rebuild**: `npm run build -- -f`
88-
- **Clear generated files**: `rm -f wled00/html_*.h` then `npm run build`
89-
- **Clean PlatformIO cache**: `pio run --target clean`
93+
- **Clear generated files**: `rm -f wled00/html_*.h wled00/js_*.h` then `npm run build`
94+
- **Clean PlatformIO build artifacts**: `pio run --target clean`
9095
- **Reinstall Node deps**: `rm -rf node_modules && npm ci`
9196

9297
## CI/CD Validation
@@ -106,7 +111,8 @@ Match this workflow in local development to catch failures before pushing.
106111

107112
## Important Reminders
108113

109-
- **Never edit or commit** `wled00/html_*.h` — auto-generated from `wled00/data/`
114+
- Always **commit source code**
115+
- **Never edit or commit** `wled00/html_*.h` and `wled00/js_*.h` — auto-generated from `wled00/data/`
110116
- Web UI rebuild is part of the PlatformIO firmware compilation pipeline
111-
- Common firmware environments: `esp32_4MB_V4_M`, `esp32_16MB_V4_S_HUB75`, `esp32S3_8MB_PSRAM_M_qspi`, `esp32_16MB_V4_M_eth`, `esp8266_4MB_S` (deprecated), `esp32dev_compat`
117+
- Common firmware environments: `esp32_4MB_V4_M`, `esp32_16MB_V4_S_HUB75`, `esp32S3_8MB_PSRAM_M_qspi`, `esp32S3_16MB_PSRAM_M_HUB75`, `esp32_16MB_V4_M_eth` (ethernet support), `esp32_16MB_V4_M_debug` (debug), `esp8266_4MB_S` (deprecated), `esp32dev_compat` (V3 legacy framework)
112118
- List all PlatformIO targets: `pio run --list-targets`

.github/copilot-instructions.md

Lines changed: 45 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,29 +33,28 @@ Always reference these instructions first and fallback to search or bash command
3333

3434
| Command | Purpose | Typical Time |
3535
|---|---|---|
36-
| `npm run build` | Build web UI → generates `wled00/html_*.h` headers | ~3 s |
36+
| `npm run build` | Build web UI → generates `wled00/html_*.h` and `wled00/js_*.h` headers | ~3 s |
3737
| `npm test` | Run test suite | ~40 s |
3838
| `npm run dev` | Watch mode — auto-rebuilds web UI on file changes ||
3939
| `pio run -e <env>` | Build firmware for a hardware target | 15–20 min |
4040

4141
<!-- HUMAN_ONLY_END -->
4242

43-
**Always run `npm ci; npm run build` before `pio run`.** The web UI build generates `wled00/html_*.h` header files required by firmware compilation.
44-
**Build firmware to validate code changes**: `pio run -e esp32_4MB_V4_M` — must succeed, never skip this step.
45-
Common firmware environments: `esp32_4MB_V4_M`, `esp32_16MB_V4_S_HUB75`, `esp32S3_8MB_PSRAM_M_qspi`, `esp32_16MB_V4_M_eth`, `esp32dev_compat`, `esp8266_4MB_S` (deprecated)
43+
- **Always run `npm run build` before any `pio run`** (and run `npm ci` first on fresh clones or when lockfile/dependencies change).
44+
- The web UI build generates required `wled00/html_*.h` and `wled00/js_*.h` headers for firmware compilation.
45+
- **Build firmware to validate code changes**: `pio run -e esp32_4MB_V4_M` — must succeed, never skip this step.
46+
- Common firmware environments: `esp32_4MB_V4_M`, `esp32_16MB_V4_S_HUB75`, `esp32S3_8MB_PSRAM_M_qspi`, `esp32_16MB_V4_M_eth`, `esp32dev_compat`, `esp8266_4MB_S` (deprecated)
4647

4748
For detailed build timeouts, development workflows, troubleshooting, and validation steps, see [agent-build.instructions.md](agent-build.instructions.md).
4849

4950
## Repository Structure
5051

5152
tl;dr:
52-
* Firmware source: `wled00/` (C++).
53-
* Build targets: `platformio.ini`.
54-
* Web UI source: `wled00/data/`.
55-
* Auto-generated headers: `wled00/html_*.h`**never edit or commit**.
56-
* ArduinoJSON + AsyncJSON: `wled00/src/dependencies/json`
53+
* Firmware source: `wled00/` (C++). Web UI source: `wled00/data/`. Build targets: `platformio.ini`.
54+
* Auto-generated headers: `wled00/html_*.h` and `wled00/js_*.h`**never edit or commit**.
55+
* ArduinoJSON + AsyncJSON: `wled00/src/dependencies/json` (included via `wled.h`). CI/CD: `.github/workflows/`.
5756
* Usermods: `usermods/` (`.h` files, included via `usermods_list.cpp`).
58-
* CI/CD: `.github/workflows/`.
57+
* Contributor docs: `docs/` (coding guidelines, design docs).
5958

6059
Main development trunk: `mdev` branch. Make PRs against this branch.
6160

@@ -79,31 +78,60 @@ tools/ # Build tools (Node.js), partition files, and generi
7978
tools/cdata.js # Web UI → header build script
8079
tools/cdata-test.js # Test suite
8180
package.json # Node.js scripts and release ID
81+
docs/ # Contributor docs: coding guidelines and design documentation
8282
.github/workflows/ # CI/CD pipelines
8383
```
84-
<!-- HUMAN_ONLY_END -->
8584

85+
<!-- HUMAN_ONLY_END -->
8686
## General Guidelines
8787

88-
- **Never edit or commit** `wled00/html_*.h` — auto-generated from `wled00/data/`.
8988
- **Repository language is English.** Suggest translations for non-English content.
9089
- **Use VS Code with PlatformIO extension** for best development experience.
90+
- **Never edit or commit** `wled00/html_*.h` and `wled00/js_*.h` — auto-generated from `wled00/data/`.
9191
- **When unsure, say so.** Gather more information rather than guessing.
92-
- **Acknowledge good patterns** when you see them. Summarize good practices as part of your review - positive feedback always helps.
92+
- **Acknowledge good patterns** when you see them. Positive feedback always helps.
9393
- **Provide references** when making analyses or recommendations. Base them on the correct branch or PR.
94-
- **Look for user-visible breaking changes and ripple effects**. Ask for confirmation that these were introduced intentionally.
94+
- **Highlight user-visible breaking changes and ripple effects**. Ask for confirmation that these were introduced intentionally.
9595
- **Unused / dead code must be justified or removed**. This helps to keep the codebase clean, maintainable and readable.
9696
- **C++ formatting available**: `clang-format` is installed but not in CI
97-
- No automated linting is configured — match existing code style in files you edit. See `cpp.instructions.md` and `web.instructions.md` for language-specific conventions, and `cicd.instructions.md` for GitHub Actions workflows.
97+
- No automated linting is configured — match existing code style in files you edit.
98+
99+
Refer to `docs/cpp.instructions.md`, `docs/esp-idf.instructions.md` and `docs/web.instructions.md` for language-specific conventions, and `docs/cicd.instructions.md` for GitHub Actions workflows.
100+
101+
### Feature Flags
102+
- **Verify feature-flag names.** Every `WLED_ENABLE_*` / `WLED_DISABLE_*` flag must exactly match one of the names below — misspellings are silently ignored by the preprocessor (e.g. `WLED_IR_DISABLE` instead of `WLED_DISABLE_INFRARED`), causing silent build variations. Flag unrecognised names as likely typos and suggest the correct spelling.
103+
104+
**`WLED_DISABLE_*`**: `2D`, `ADALIGHT`, `ALEXA`, `BROWNOUT_DET`, `ESPNOW`, `FILESYSTEM`, `HUESYNC`, `IMPROV_WIFISCAN`, `INFRARED`, `LOXONE`, `MQTT`, `OTA`, `PARTICLESYSTEM1D`, `PARTICLESYSTEM2D`, `PIXELFORGE`, `WEBSOCKETS`
105+
106+
**`WLED_ENABLE_*`**: `ADALIGHT`, `AOTA`, `DMX`, `DMX_INPUT`, `DMX_OUTPUT`, `FS_EDITOR`, `GIF`, `HUB75MATRIX`, `JSONLIVE`, `LOXONE`, `MQTT`, `PIXART`, `PXMAGIC`, `USERMOD_PAGE`, `WEBSOCKETS`, `WPA_ENTERPRISE`
107+
108+
<!-- HUMAN_ONLY_START -->
109+
```cpp
110+
#ifdef WLED_DMX_ENABLED // wrong flag - initialization silently skipped
111+
initDMX();
112+
#endif
113+
114+
#ifdef WLED_ENABLE_DMX // correct flag - initialization performed only when the build supports DMX
115+
initDMX();
116+
#endif
117+
```
118+
<!-- HUMAN_ONLY_END -->
119+
98120

99121
### Attribution for AI-generated code
100122
Using AI-generated code can hide the source of the inspiration / knowledge / sources it used.
101123
- Document attribution of inspiration / knowledge / sources used in the code, e.g. link to GitHub repositories or other websites describing the principles / algorithms used.
102-
- When a larger block of code is generated by an AI tool, mark it with an `// AI: below section was generated by an AI` comment (see C++ guidelines).
124+
- When a larger block of code is generated by an AI tool, embed it into `// AI: below section was generated by an AI` ... `// AI: end` comments (see C++ guidelines).
103125
- Every non-trivial AI-generated function should have a brief comment describing what it does. Explain parameters when their names alone are not self-explanatory.
104-
- AI-generated code must be well documented; comment-to-code ratio > 15% is expected. Do not rephrase source code, but explain the concepts/logic behind the code.
126+
- AI-generated code must be well documented with meaningful comments that explain intent, assumptions, and non-obvious logic. Do not rephrase source code; explain concepts and reasoning.
105127

106128
### Pull Request Expectations
107129

108130
- **No force-push on open PRs.** Once a pull request is open and being reviewed, do not force-push (`git push --force`) to the branch. Force-pushing rewrites history that reviewers may have already commented on, making it impossible to track incremental changes. Use regular commits or `git merge` to incorporate feedback; the branch will be squash-merged when it is accepted.
131+
- **Modifications to ``platformio.ini`` MUST be approved explicitly** by a *maintainer* or *WLED organisation Member*. Modifications to the global build environment may break github action builds. Always flag them.
109132
- **Document your changes in the PR.** Every pull request should include a clear description of *what* changed and *why*. If the change affects user-visible behavior, describe the expected impact. Link to related issues where applicable. Provide screenshots to showcase new features.
133+
134+
### Supporting Reviews and Discussions
135+
- **For "is it worth doing?" debates** about proposed reliability, safety, or data-integrity mechanisms (CRC checks, backups, power-loss protection): suggest a software **FMEA** (Failure Mode and Effects Analysis).
136+
Clarify the main feared events, enumerate failure modes, assess each mitigation's effectiveness per failure mode, note common-cause failures, and rate credibility for the typical WLED use case.
137+

0 commit comments

Comments
 (0)