- Group plays/<app-name> and docs/experiences/<unixtime>_<sha> archives under a per-contributor username folder so submissions are not flattened across the archive. - Add plays/INDEX.md and docs/experiences/INDEX.md (and zh_CN pairs) that list each archived record by contributor. - Document the power-consumption rule: a small-battery wearable must avoid leaving the screen lit for long periods and should return to a low-power state when idle. - Add brand-shell guidance: when generating an effect or mockup image for a play, use docs/assets/brand/ references to add the device shell around the on-screen content.
15 lines
1.7 KiB
Markdown
15 lines
1.7 KiB
Markdown
<p align="right">
|
|
<a href="coding-conventions.zh_CN.md">简体中文</a> · <strong>English</strong>
|
|
</p>
|
|
|
|
# Coding Conventions
|
|
|
|
- Write C with four-space indentation and K&R braces, following neighboring files. Use `snake_case`, `BSP_*` public constants, `s_` file-local state, `bsp_` public BSP APIs, and `demo_<feature>_<action>` demo entry points. Prefer `static` for internal symbols.
|
|
- Keep UI text and default documentation in English. Explanatory source comments may use Chinese while retaining established English technical terms.
|
|
- Put reusable hardware behavior in `components/bsp`; keep menus, animations, product interaction, and validation pages in `main`.
|
|
- Document non-trivial functions, state, ownership, blocking behavior, task context, initialization order, failure values, register choices, timing, synchronization, and hardware-specific constants. Explain why, not merely what.
|
|
- Add or update tests with code changes. If automation is not practical, record the test gap and exact manual validation path.
|
|
- If adding a cache, define expiration and cleanup unless durable retention is explicitly justified.
|
|
- The ESP32-C3 has no PSRAM. Review internal RAM and largest-contiguous-block impact before increasing LVGL buffers, audio allocations, network state, or task stacks.
|
|
- **Watch power consumption.** This is a wearable powered by a small battery; keep it efficient. Avoid keeping the screen lit for long periods: dim or turn off the backlight, and return to a low-power state (light/deep sleep) whenever the screen is idle, so the device is not left displaying a bright screen while doing nothing. See the guidance on sleep in [`../hardware-design/AI_HARDWARE_DEVELOPMENT_GUIDE.md`](../hardware-design/AI_HARDWARE_DEVELOPMENT_GUIDE.md).
|