From 231373acac3e30af036475cf8a142db4feed881f Mon Sep 17 00:00:00 2001 From: Frank <91616163+softhack007@users.noreply.github.com> Date: Mon, 6 Apr 2026 18:07:48 +0200 Subject: [PATCH] small update to AI instructions upstream sync --- .github/copilot-instructions.md | 5 +++-- .github/cpp.instructions.md | 1 + 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 008af37e..e25f740c 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -40,7 +40,8 @@ Always reference these instructions first and fallback to search or bash command -- **Always run `npm ci; npm run build` before `pio run`.** The web UI build generates `wled00/html_*.h` header files required by firmware compilation. +- **Always run `npm run build` before any `pio run`** (and run `npm ci` first on fresh clones or when lockfile/dependencies change). +- The web UI build generates required `wled00/html_*.h` and `wled00/js_*.h` headers for firmware compilation. - **Build firmware to validate code changes**: `pio run -e esp32_4MB_V4_M` — must succeed, never skip this step. - 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) @@ -51,7 +52,7 @@ For detailed build timeouts, development workflows, troubleshooting, and validat tl;dr: * Firmware source: `wled00/` (C++). Web UI source: `wled00/data/`. Build targets: `platformio.ini`. * Auto-generated headers: `wled00/html_*.h` and `wled00/js_*.h` — **never edit or commit**. -* ArduinoJSON + AsyncJSON: `wled00/src/dependencies/json`. CI/CD: `.github/workflows/`. +* ArduinoJSON + AsyncJSON: `wled00/src/dependencies/json` (included via `wled.h`). CI/CD: `.github/workflows/`. * Usermods: `usermods/` (`.h` files, included via `usermods_list.cpp`). Main development trunk: `mdev` branch. Make PRs against this branch. diff --git a/.github/cpp.instructions.md b/.github/cpp.instructions.md index b4ff9950..29e5c12b 100644 --- a/.github/cpp.instructions.md +++ b/.github/cpp.instructions.md @@ -562,6 +562,7 @@ Prefer blocking FreeRTOS primitives (`xQueueReceive`, `ulTaskNotifyTake`, `vTask - If possible, use `static` for local (C-style) variables and functions (keeps the global namespace clean) - Avoid unexplained "magic numbers". Prefer named constants (`constexpr`) or C-style `#define` constants for repeated numbers that have the same meaning - Include `"wled.h"` as the primary project header where needed + - **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: ```cpp // Undefined behavior — avoid: