diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 6639407eb..e036f846a 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -481,6 +481,7 @@ Key defines in variant.h: - Regenerate with `bin/regen-protos.sh` - Message types prefixed with `meshtastic_` - Nanopb `.options` files control field sizes and encoding +- **Never edit or commit files under `src/mesh/generated/`.** They are regenerated from the [`meshtastic/protobufs`](https://github.com/meshtastic/protobufs) submodule by the `update_protobufs.yml` GitHub Action and any hand edits will be overwritten — guaranteed merge conflict on the next sync. To change a wire format, open a PR against the protobufs repo first; the workflow then re-runs `bin/regen-protos.sh` and opens a PR here with the regenerated sources. ### Conditional Compilation diff --git a/AGENTS.md b/AGENTS.md index 0a0c82406..7c3d01e8a 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -83,6 +83,7 @@ Key rotation to never trigger casually: only the **full** factory reset (`factor - **`userPrefs.jsonc` is session state during tests.** The `_session_userprefs` fixture snapshots + restores it; never edit it from inside a test. - **Don't speculate about firmware root causes.** When evidence doesn't support a classification, say "unknown" and list what would disambiguate. - **Run `trunk fmt` before proposing a commit.** The `trunk_check` CI gate will reject unformatted code. Claude Code runs it automatically via the PostToolUse hook in `.claude/settings.json`; trunk's launcher needs `curl` or `wget` to bootstrap its pinned CLI — see **Formatting & the trunk toolchain** in `.github/copilot-instructions.md` for the no-curl bootstrap procedure. +- **Never edit or commit files under `src/mesh/generated/`.** They are regenerated from the [`meshtastic/protobufs`](https://github.com/meshtastic/protobufs) repo by the `update_protobufs.yml` workflow (entry point: `bin/regen-protos.sh`). Local edits will be overwritten and create merge conflicts. If a `.proto` change is needed, open a PR against the protobufs repo first, then let the workflow re-sync this repo. - **`confirm=True` on destructive MCP tools is a real gate, not a formality.** Don't bypass it via auto-approve settings. - **Keep code comments minimal — one or two lines, max.** Comment only when the _why_ isn't obvious from the code; never restate what the next line does. No multi-paragraph block comments explaining straightforward changes. The diff and commit message carry the rationale; the code carries the behavior. - **Use `Throttle` for time-based rate limiting, not raw `millis()` math.** `src/mesh/Throttle.h` provides `Throttle::isWithinTimespanMs(lastMs, intervalMs)` (returns true while inside the cooldown) and `Throttle::execute(&lastMs, intervalMs, func)` (function-pointer form that updates the timestamp on fire). Use these for any "did N ms pass since X" check — raw `millis() > lastMs + N` is rollover-unsafe (breaks after ~49.7 days) and inconsistent with the rest of the codebase. The helpers compute `now - lastMs` with unsigned subtraction, which wraps correctly. diff --git a/variants/esp32s2/esp32s2.ini b/variants/esp32s2/esp32s2.ini index 189f51898..ff017e186 100644 --- a/variants/esp32s2/esp32s2.ini +++ b/variants/esp32s2/esp32s2.ini @@ -16,6 +16,9 @@ build_flags = custom_sdkconfig = ${esp32_common.custom_sdkconfig} + ; ESP32-S2 has no USB-Serial-JTAG peripheral (issue #10799) + CONFIG_TINYUSB_ENABLED=y + CONFIG_TINYUSB_CDC_ENABLED=y lib_ignore = ${esp32_common.lib_ignore} diff --git a/variants/esp32s2/nugget_s2_lora/platformio.ini b/variants/esp32s2/nugget_s2_lora/platformio.ini index a091a705f..91b0664e9 100644 --- a/variants/esp32s2/nugget_s2_lora/platformio.ini +++ b/variants/esp32s2/nugget_s2_lora/platformio.ini @@ -2,6 +2,7 @@ extends = esp32s2_base board = lolin_s2_mini board_level = extra +board_check = true build_flags = ${esp32s2_base.build_flags} -D PRIVATE_HW