Fix 10799 (#10819)
* Document that src/mesh/generated is auto-generated and must not be edited * Fix esp32s2 build by enabling native USB CDC, add S2 to check matrix (#10799)
This commit is contained in:
co-authored by
GitHub
parent
87bb149afb
commit
3edc89d087
@@ -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
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user