Skip to content

Commit 231373a

Browse files
committed
small update to AI instructions
upstream sync
1 parent eb23527 commit 231373a

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

.github/copilot-instructions.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ Always reference these instructions first and fallback to search or bash command
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.
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.
4445
- **Build firmware to validate code changes**: `pio run -e esp32_4MB_V4_M` — must succeed, never skip this step.
4546
- 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

@@ -51,7 +52,7 @@ For detailed build timeouts, development workflows, troubleshooting, and validat
5152
tl;dr:
5253
* Firmware source: `wled00/` (C++). Web UI source: `wled00/data/`. Build targets: `platformio.ini`.
5354
* Auto-generated headers: `wled00/html_*.h` and `wled00/js_*.h`**never edit or commit**.
54-
* ArduinoJSON + AsyncJSON: `wled00/src/dependencies/json`. CI/CD: `.github/workflows/`.
55+
* ArduinoJSON + AsyncJSON: `wled00/src/dependencies/json` (included via `wled.h`). CI/CD: `.github/workflows/`.
5556
* Usermods: `usermods/` (`.h` files, included via `usermods_list.cpp`).
5657

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

.github/cpp.instructions.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,7 @@ Prefer blocking FreeRTOS primitives (`xQueueReceive`, `ulTaskNotifyTake`, `vTask
562562
- If possible, use `static` for local (C-style) variables and functions (keeps the global namespace clean)
563563
- Avoid unexplained "magic numbers". Prefer named constants (`constexpr`) or C-style `#define` constants for repeated numbers that have the same meaning
564564
- Include `"wled.h"` as the primary project header where needed
565+
565566
- **Float-to-unsigned conversion is undefined behavior when the value is out of range.** Converting a negative `float` directly to an unsigned integer type (`uint8_t`, `uint16_t`, …) is UB per the C++ standard — the Xtensa (ESP32) toolchain may silently wrap, but RISC-V (ESP32-C3/C5/C6/P4) can produce different results due to clamping. Cast through a signed integer first:
566567
```cpp
567568
// Undefined behavior — avoid:

0 commit comments

Comments
 (0)