chore: 新增大量静态资源、测试桩文件与配置文件,清理旧无用资源
本次提交新增了多种字体、UI图片、音频剪辑等静态资源,添加了测试桩文件与项目配置文件,同时清理了部分已废弃的旧图片与测试桩代码文件。
This commit is contained in:
1 parent
1051209d80
commit
6a7f4e010b
1761 files changed
+195222
-6037
No files matched your search
@@ -7,13 +7,6 @@
|
||||
Use ESP-IDF 5.5.3. On a clean machine or when the toolchain is missing, follow
|
||||
the [environment bootstrap](environment-setup.md) first.
|
||||
|
||||
> **No original-firmware backup is required before downloading (flashing) new
|
||||
> firmware to the device.** Reading out the installed firmware is not a
|
||||
> prerequisite. Flashing replaces the installed firmware and does not provide
|
||||
> automatic restoration of it. This does not mean user data is preserved: if
|
||||
> you need existing settings or records, export or otherwise save them first.
|
||||
> See [flashing and stored data](firmware-layout.md#flashing-and-stored-data).
|
||||
|
||||
> Prefer `./tools/validate.sh --firmware` for firmware builds. Flash its
|
||||
> verified `build/FoloToy-AI-Passport-full.bin` at offset `0x0` for a blank
|
||||
> device or an intentional complete refresh. The merged image may reset NVS;
|
||||
@@ -36,116 +29,16 @@ changed defaults. Preserve intentional local settings, then run
|
||||
`idf.py set-target esp32c3` when the target or tracked defaults must be
|
||||
regenerated.
|
||||
|
||||
### Speeding up repeated builds
|
||||
|
||||
ccache can reuse previous compiler results when sources need to be compiled
|
||||
again. ESP-IDF 5.5.3 disables it by default. After activating ESP-IDF, check that
|
||||
ccache is available and enable it for an individual build (the same command
|
||||
works in Linux/macOS shells and native Windows ESP-IDF terminals):
|
||||
|
||||
```text
|
||||
ccache --version
|
||||
idf.py --ccache build
|
||||
```
|
||||
|
||||
Alternatively, enable it for the current Linux/macOS shell and its child
|
||||
processes, including the validation script:
|
||||
|
||||
```bash
|
||||
export IDF_CCACHE_ENABLE=1
|
||||
idf.py build
|
||||
```
|
||||
|
||||
This is an `idf.py` option, not a `sdkconfig` or `menuconfig` setting. For
|
||||
repeatable project or CI builds, pass `--ccache` explicitly or set
|
||||
`IDF_CCACHE_ENABLE=1` in that build environment; do not silently edit shell
|
||||
startup files. See the [ESP-IDF 5.5.3 option definition](https://github.com/espressif/esp-idf/blob/v5.5.3/tools/idf_py_actions/core_ext.py).
|
||||
|
||||
Inspect the active cache configuration instead of assuming a fixed path:
|
||||
|
||||
```text
|
||||
ccache --show-config
|
||||
ccache --show-stats
|
||||
```
|
||||
|
||||
The effective `cache_dir` depends on the ccache version, platform,
|
||||
configuration, and `CCACHE_DIR`; it is not always `~/.ccache`. Keep it outside
|
||||
`build/` and temporary validation directories so their removal preserves it.
|
||||
Cache clearing is not a routine build step. Only when intentionally clearing
|
||||
the active cache, use `ccache --clear`, which preserves the configuration file,
|
||||
instead of deleting the directory. This also discards cached compiler results
|
||||
for other projects sharing that cache. See the [ccache manual](https://ccache.dev/manual/latest.html).
|
||||
|
||||
On Windows, real-time antivirus or endpoint scanning can contribute to slow
|
||||
builds, but diagnose the bottleneck first. For Microsoft Defender, use its
|
||||
[performance analyzer](https://learn.microsoft.com/en-us/defender-endpoint/performance-analyzer-reference);
|
||||
its results are not automatic exclusion recommendations. Exclusions reduce
|
||||
protection and are optional: obtain user or administrator approval under the
|
||||
applicable security policy, then limit any exception to the smallest confirmed
|
||||
scope. Do not routinely exclude the entire ESP-IDF installation, tools tree,
|
||||
or project, and do not disable real-time protection.
|
||||
This badge derivative requires `CONFIG_COMPILER_OPTIMIZATION_SIZE=y` in the
|
||||
active configuration. CMake rejects a stale debug build by default. Use
|
||||
`-D BADGE_ALLOW_DEBUG_BUILD=ON` only for intentional diagnostic builds, never
|
||||
for a release artifact. Verify the generated configuration, not just defaults.
|
||||
|
||||
The tracked `dependencies.lock` pins Managed Component resolution. After changing an `idf_component.yml`, regenerate the lock with ESP-IDF 5.5.3, review version changes, and commit it with the manifest. An ordinary build must not leave an unexplained lock-file diff.
|
||||
|
||||
Firmware validation uses a fresh temporary build directory and an isolated `sdkconfig` generated from the tracked defaults. It does not consume or overwrite a developer's root `sdkconfig`. Before cleaning the temporary build, it archives the verified firmware and matching debug artifacts, then copies the verified merged image to `build/FoloToy-AI-Passport-full.bin`. The gate also validates the [configured firmware layout](firmware-layout.md): image offsets from `flash_args`, partition-table MD5, bounds and non-overlap, and an application that starts in and fits its configured app partition. User-defined partition layouts are allowed.
|
||||
Firmware validation uses a fresh temporary build directory and an isolated `sdkconfig` generated from the tracked defaults. It does not consume or overwrite a developer's root `sdkconfig`, and it copies only the verified merged image to `build/FoloToy-AI-Passport-full.bin`. The gate also validates the [configured firmware layout](firmware-layout.md): image offsets from `flash_args`, partition-table MD5, bounds and non-overlap, and an application that starts in and fits its configured app partition. User-defined partition layouts are allowed.
|
||||
|
||||
### Retain matching crash-debugging artifacts
|
||||
|
||||
Each successful firmware gate retains a local bundle under
|
||||
`build/firmware/<full-bin-sha256>/`. Its `manifest.json` records full-image and ELF
|
||||
SHA-256 values, project/application/IDF version fields, offsets, and each retained
|
||||
file's size and hash. The archive includes:
|
||||
|
||||
- The verified merged image and its application ELF, MAP, and application image.
|
||||
- `bootloader/bootloader.bin`, `partition_table/partition-table.bin`, and `flash_args`.
|
||||
|
||||
Verify a bundle without rebuilding or writing to it:
|
||||
|
||||
```text
|
||||
python3 tools/archive_firmware.py verify <archive-directory>
|
||||
```
|
||||
|
||||
For an existing build directory, `python3 tools/archive_firmware.py create
|
||||
<build-directory>` performs the same archival checks, but does not run host
|
||||
tests or prove that the build used the current source/configuration. It is not a
|
||||
replacement for the gate. The archive tool needs no activated ESP-IDF environment.
|
||||
|
||||
The tool checks that the ELF's SHA-256 matches the identity embedded in the
|
||||
application image and that the retained component images match the merged image.
|
||||
Use that ELF to decode a crash from the corresponding firmware, not an ELF from
|
||||
a later rebuild, especially when the version contains `-dirty`. MAP files have
|
||||
no embedded identity: they are retained with the build and protected by the
|
||||
manifest checksum. For byte-identical firmware/ELF and other retained files,
|
||||
repeat archival reuses the first verified bundle and MAP; temporary build paths
|
||||
may otherwise change MAP contents. Existing conflicting bundles are not replaced.
|
||||
|
||||
Extra custom partition images are not retained as separate files. Their payloads
|
||||
can still be inside the merged image; this is **not** a complete segmented-flash
|
||||
package or a sanitization guarantee. Preserve any additional matching images
|
||||
needed for a user-specific segmented workflow separately, after reviewing their
|
||||
content. Treat `flash_args` as data, not a shell script.
|
||||
|
||||
A failed validation may leave a previous `build/FoloToy-AI-Passport-full.bin`
|
||||
and older bundles intact. Never present those as the failed run's new output.
|
||||
Hand off the exact successful bundle path and full-image hash. Hash consistency
|
||||
is not proof of hardware behavior or a trusted publisher.
|
||||
|
||||
`build/` remains Git-ignored. Firmware and debug artifacts can contain embedded
|
||||
credentials or other private data; do not commit or upload bundles automatically.
|
||||
Existing CI/release workflows still upload only their configured artifacts, not
|
||||
these debug bundles; runner-local archives disappear when the runner is removed.
|
||||
Any additional retention/upload policy needs an explicit content and access review.
|
||||
No build/archive command flashes a device.
|
||||
|
||||
The static gate also compiles the actual BSP and demo implementations against
|
||||
small platform stubs. These fault-injection tests cover task handoff and stop
|
||||
retries, recording failures, Wi-Fi/BLE startup rollback, button allocation and
|
||||
ADC failures, LVGL initialization locking/retry, and codec open/sleep/wake
|
||||
recovery. They need only a host C compiler and Python, not ESP-IDF or downloaded
|
||||
Managed Components. They do not establish real timing, electrical behavior or
|
||||
device compatibility; the firmware gate compiles against the pinned dependencies.
|
||||
|
||||
To run an individual pure-logic test:
|
||||
The baseline also has a hardware-independent logic test:
|
||||
|
||||
```bash
|
||||
cc -std=c11 -Wall -Wextra -Werror -Imain \
|
||||
|
||||
@@ -7,11 +7,6 @@
|
||||
使用 ESP-IDF 5.5.3。全新机器或缺少工具链时,先按
|
||||
[环境引导](environment-setup.zh_CN.md)完成安装。
|
||||
|
||||
> **向设备下载(烧录)新固件前,无需备份设备内部原有固件。** 不要求先读出
|
||||
> 原固件,也不把原固件备份作为烧录前置条件。烧录会覆盖原固件,不会自动恢复
|
||||
> 原固件。这不代表用户数据会被保留:如果需要保留已有设置或记录,应事先
|
||||
> 导出或另行保存。详见[烧录与已存数据](firmware-layout.zh_CN.md#烧录与已存数据)。
|
||||
|
||||
> 固件编译优先运行 `./tools/validate.sh --firmware`。空白设备初始化或有意完整
|
||||
> 刷新时,把验证通过的 `build/FoloToy-AI-Passport-full.bin` 从 `0x0` 写入;
|
||||
> 合并镜像可能重置 NVS,需要保留已有 NVS 状态时使用分段 `idf.py flash`。
|
||||
@@ -32,92 +27,14 @@ idf.py fullclean # 只清空过期生成状态(勿用于清理用
|
||||
target 或已跟踪 defaults 时,先保留有意的本地设置,再运行
|
||||
`idf.py set-target esp32c3`。
|
||||
|
||||
### 加速重复编译
|
||||
|
||||
ccache 能在源码需要重新编译时复用已有编译结果。ESP-IDF 5.5.3 默认不启用
|
||||
ccache。激活 ESP-IDF 后,先确认 ccache 可用,再为单次构建启用(以下命令
|
||||
同样适用于 Linux/macOS shell 和 Windows 原生 ESP-IDF 终端):
|
||||
|
||||
```text
|
||||
ccache --version
|
||||
idf.py --ccache build
|
||||
```
|
||||
|
||||
也可以在当前 Linux/macOS shell 及其子进程中启用,让验证脚本一并使用:
|
||||
|
||||
```bash
|
||||
export IDF_CCACHE_ENABLE=1
|
||||
idf.py build
|
||||
```
|
||||
|
||||
这是 `idf.py` 选项,不是 `sdkconfig` 或 `menuconfig` 配置。需要在项目或 CI
|
||||
中重复启用时,显式传入 `--ccache`,或在该构建环境设置
|
||||
`IDF_CCACHE_ENABLE=1`;不要擅自修改 shell 启动文件。参见
|
||||
[ESP-IDF 5.5.3 选项定义](https://github.com/espressif/esp-idf/blob/v5.5.3/tools/idf_py_actions/core_ext.py)。
|
||||
|
||||
先检查当前缓存配置,不要假定固定路径:
|
||||
|
||||
```text
|
||||
ccache --show-config
|
||||
ccache --show-stats
|
||||
```
|
||||
|
||||
实际 `cache_dir` 取决于 ccache 版本、平台、配置以及 `CCACHE_DIR`,并不总是
|
||||
`~/.ccache`。把它放在 `build/` 和临时验证目录之外,清理这些目录时才能保留
|
||||
缓存。清缓存不是日常构建步骤。只有明确需要清空当前缓存时,才使用保留
|
||||
配置文件的 `ccache --clear`,而不是删除整个目录;这也会清除共用该缓存的
|
||||
其他项目的编译结果。参见 [ccache 手册](https://ccache.dev/manual/latest.html)。
|
||||
|
||||
Windows 上的杀毒或终端安全软件实时扫描可能拖慢构建,但应先诊断瓶颈。
|
||||
Microsoft Defender 可使用其
|
||||
[性能分析器](https://learn.microsoft.com/en-us/defender-endpoint/performance-analyzer-reference),
|
||||
分析结果不等于自动建议添加排除项。排除项会降低防护能力,且属于可选措施:
|
||||
必须按适用安全策略取得用户或管理员批准,再把例外限制在已确认问题的最小
|
||||
范围内。不要例行排除整个 ESP-IDF 安装目录、工具链目录或工程,也不要关闭
|
||||
实时防护。
|
||||
本工牌分支要求实际生效的配置包含 `CONFIG_COMPILER_OPTIMIZATION_SIZE=y`。
|
||||
CMake 默认拒绝沿用旧的调试配置;只有明确进行诊断构建时才使用
|
||||
`-D BADGE_ALLOW_DEBUG_BUILD=ON`,不得将其作为发布包。检查生成后的配置,
|
||||
不能只看 defaults 文件。
|
||||
|
||||
仓库提交 `dependencies.lock` 以固定 ESP-IDF Managed Components 的解析结果。修改 `idf_component.yml` 后必须使用 ESP-IDF 5.5.3 重新生成锁文件、review 版本变化并与 manifest 一起提交;普通构建不应产生未提交的锁文件差异。
|
||||
|
||||
固件门禁使用全新的临时构建目录,并从仓库 `sdkconfig.defaults` 生成隔离的 `sdkconfig`。它不会读取或覆盖开发者根目录的 `sdkconfig`。清理临时构建前,先归档已验证固件及匹配的调试产物,再把已验证合并镜像复制到 `build/FoloToy-AI-Passport-full.bin`。门禁同时验证[当前配置的固件布局](firmware-layout.zh_CN.md):从 `flash_args` 读取镜像偏移,检查分区表 MD5、边界和不重叠,并确认应用从所配置的 app 分区起点开始且未超出分区。允许用户自定义分区布局。
|
||||
|
||||
### 保留匹配的崩溃调试产物
|
||||
|
||||
每次成功的固件门禁都会在本地保留 `build/firmware/<full-bin-sha256>/`
|
||||
归档。`manifest.json` 记录完整镜像与 ELF 的 SHA-256、项目/应用/IDF
|
||||
版本字段、偏移,以及每个保留文件的大小和哈希。归档包含:
|
||||
|
||||
- 已校验合并镜像及其应用 ELF、MAP、应用镜像。
|
||||
- `bootloader/bootloader.bin`、`partition_table/partition-table.bin` 和 `flash_args`。
|
||||
|
||||
不重新构建、不写入归档即可复验:
|
||||
|
||||
```text
|
||||
python3 tools/archive_firmware.py verify <archive-directory>
|
||||
```
|
||||
|
||||
对已有构建目录,`python3 tools/archive_firmware.py create <build-directory>`
|
||||
会执行同样的归档校验,但不会运行 host tests,也不能证明使用了当前源码/
|
||||
配置;不能代替门禁。归档工具本身不要求激活 ESP-IDF。
|
||||
|
||||
工具检查 ELF 的 SHA-256 是否与应用镜像内嵌身份一致,并检查保留的分段
|
||||
镜像是否与合并镜像一致。分析对应固件崩溃时使用该 ELF,不拿后续重新编译
|
||||
的 ELF 替代,尤其是版本带 `-dirty` 时。MAP 没有内嵌身份,依靠同次构建
|
||||
留存和清单哈希保护;固件/ELF 与其他保留文件逐字节一致时,重复归档复用
|
||||
首份已验证归档及 MAP,因为临时构建路径可能改变 MAP 内容。不覆盖冲突归档。
|
||||
|
||||
额外自定义分区镜像不作为独立文件留存,但其内容仍可能包含在合并镜像中;
|
||||
这**不是**完整的分段烧录包,也不保证已脱敏。用户特定分段烧录需要的额外
|
||||
匹配镜像,应在审核内容后另行保留。把 `flash_args` 当作数据,不作为 shell
|
||||
脚本执行。
|
||||
|
||||
验证失败可能仍保留旧 `build/FoloToy-AI-Passport-full.bin` 和历史归档,
|
||||
不能将它们当成本轮失败构建的新产物。交接时给出实际成功归档路径和完整
|
||||
镜像哈希;哈希一致不代表硬件通过验收,也不能证明发布者可信。
|
||||
|
||||
`build/` 仍被 Git 忽略。固件与调试文件可能含内嵌凭证或其他私密数据,
|
||||
不能自动提交或上传。现有 CI/发布流程仍只上传其配置的产物,不上传这些
|
||||
调试包;runner 删除时,本地归档也会消失。扩大留存/上传范围前须明确审核
|
||||
内容和访问权限。构建/归档命令不会烧录设备。
|
||||
固件门禁使用全新的临时构建目录,并从仓库 `sdkconfig.defaults` 生成隔离的 `sdkconfig`。它不会读取或覆盖开发者根目录的 `sdkconfig`,只把验证通过的合并镜像复制到 `build/FoloToy-AI-Passport-full.bin`。门禁同时验证[当前配置的固件布局](firmware-layout.zh_CN.md):从 `flash_args` 读取镜像偏移,检查分区表 MD5、边界和不重叠,并确认应用从所配置的 app 分区起点开始且未超出分区。允许用户自定义分区布局。
|
||||
|
||||
当前基线含一个可独立运行的纯逻辑测试:
|
||||
|
||||
@@ -128,8 +45,6 @@ cc -std=c11 -Wall -Wextra -Werror -Imain \
|
||||
/tmp/test_ui_pixel_math
|
||||
```
|
||||
|
||||
静态门禁还将真实 BSP 和 demo 实现与轻量平台桩编译在一起,故障注入覆盖任务退出交接与停止重试、录音失败、Wi-Fi/BLE 启动回滚、按键分配与 ADC 错误、LVGL 初始化锁与重试、codec 打开/休眠/唤醒恢复。只需主机 C 编译器和 Python,不依赖 ESP-IDF 或已下载的 Managed Components。这些测试不代表真实时序、电气行为或设备兼容性;固件门禁会使用锁定依赖进行编译。
|
||||
|
||||
统一验证入口:
|
||||
|
||||
```bash
|
||||
|
||||
@@ -5,55 +5,13 @@
|
||||
# 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 baseline-demo UI text and default documentation in English. Application UI may use Chinese when its font support is implemented and verified. Explanatory source comments may use Chinese while retaining established English technical terms.
|
||||
- Before adding Chinese UI text, complete the [font checklist](#chinese-fonts-and-missing-glyphs); changing strings to UTF-8 alone does not add missing glyphs.
|
||||
- Keep UI text and default documentation in English. Explanatory source comments may use Chinese while retaining established English technical terms.
|
||||
- The baseline enables only LVGL Montserrat 14 and 20, which do not contain CJK glyphs. Chinese UTF-8 text therefore renders as missing-glyph boxes; changing source-file encoding does not fix it. Before adding Chinese UI text, compile and select a CJK font that covers every displayed character, prefer a glyph subset over a full font, configure a suitable fallback for mixed-language text, budget Flash and internal RAM, and verify the result on the device.
|
||||
- Put reusable hardware behavior in `components/bsp`; keep menus, animations, product interaction, and validation pages in `main`.
|
||||
- Derivative applications must implement a redesigned UI and must not reuse the current demo test screens or `ui_pixel` visual shell. Renaming or recoloring the demo is not a redesign; follow the [mandatory UI redesign rule](../ai-guide.md#mandatory-ui-redesign-for-derivative-applications). Preserving the existing theme applies only to maintenance of the baseline hardware-test demo itself, not to application development.
|
||||
- Show the battery level in the top-right corner of a user interface by default, unless the developer specifies a different placement or explicitly does not want it. Read it from `bsp_battery_soc()` (and `bsp_battery_mv()` where useful); render it as a small battery indicator or percentage in the top-right area of the screen, and degrade gracefully when it reads `-1` (unavailable). Avoid overlapping the application's own content. When maintaining the baseline theme, also avoid its cloud decoration (`add_cloud`, around `x≈188, y≈8`).
|
||||
- The `ui_pixel` theme (sky background, grass, title plate, mascot, ink-outlined panels) is part of the user interface, not a removable component. When trimming components or routing straight to a feature screen, keep the theme and build the screen through `ui_pixel_screen_create()` / `ui_pixel_panel_create()`.
|
||||
- Show the battery level in the top-right corner of a user interface by default, unless the developer specifies a different placement or explicitly does not want it. Read it from `bsp_battery_soc()` (and `bsp_battery_mv()` where useful); render it as a small battery indicator or percentage in the top-right area of the screen, and degrade gracefully when it reads `-1` (unavailable). Place it where it does not overlap the existing cloud decoration (`add_cloud`, around `x≈188, y≈8`): use the clear sky space beside or below the cloud, or the very top-right edge, rather than covering the cloud.
|
||||
- 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).
|
||||
|
||||
## Chinese fonts and missing glyphs
|
||||
|
||||
For configuration, converter commands, CMake integration, safe fallback code, and glyph-check examples, follow the [detailed LVGL Chinese text guide](lvgl-chinese-fonts.md).
|
||||
|
||||
The baseline enables Montserrat 14 and 20 in [`sdkconfig.defaults`](../../../sdkconfig.defaults); neither contains Chinese glyphs. A correct UTF-8 string can therefore appear as boxes or blank text. Serial-console output, an installed computer font, and a successful firmware build do not prove that LVGL can render that text.
|
||||
|
||||
### Before implementing or changing Chinese UI
|
||||
|
||||
1. **Define coverage.** Collect all displayed text: titles, buttons, hints, empty/error states, units, punctuation, and dynamic content. Include Latin letters, digits, full-width punctuation, and any `LV_SYMBOL_*` icons in the chosen font or fallback chain. Regenerate each affected size/subset when text changes. A built-in CJK subset or a subset extracted from fixed UI strings does not guarantee arbitrary Chinese names, Wi-Fi SSIDs, or server/user input; define the supported character set and an explicit unsupported-character policy.
|
||||
2. **Generate reproducible assets.** Select a licensed font whose source actually contains the required glyphs. Prefer a subset at the sizes needed by the application instead of embedding an entire font family. Keep reusable sources/generated files under `assets/fonts/` and record the license, converter version, command, character inventory, size, and bit depth in the [assets documentation](../../../assets/README.md). Use output compatible with the LVGL version pinned in [`dependencies.lock`](../../../dependencies.lock) (currently 9.5.0). See the [official font converter](https://github.com/lvgl/lv_font_conv) for generation options; this baseline does not bundle an application-specific Chinese font.
|
||||
3. **Compile and select the font.** Add the generated `.c` file to the consuming component's CMake `SRCS`, declare its exported symbol with `LV_FONT_DECLARE`, and assign it to the actual text widget/part. Copying a TTF/OTF or `.c` into `assets/` does not automatically compile, load, or select it. Check the generated `sdkconfig` has `CONFIG_LV_TXT_ENC_UTF8=y`; changing defaults alone does not necessarily update an existing configuration (see [build and test](build-and-test.md)).
|
||||
4. **Check style overrides and fallback.** Changing the default font or a screen's inherited font does not override explicit child fonts. [`main/ui_pixel.c`](../../../main/ui_pixel.c) sets a local font in `ui_pixel_label()` and explicitly uses Montserrat 20 for its title; menu/demo labels also select fonts directly. Audit titles, labels, widget parts, and focused/pressed/disabled states. For mixed text, use a font containing all required glyphs or a deliberate fallback chain. Do not cast away `const` to modify Flash-resident font descriptors, create fallback cycles, or free a font while widgets still use it.
|
||||
5. **Budget resources.** Inspect Flash/static RAM after generation and free heap/largest free block at runtime, including when networking is active. Constant bitmap font data can reside in Flash; runtime font loading, decoding, and caches may need RAM. Do not blindly enlarge the LVGL heap or display buffers to treat missing glyphs; more memory cannot supply glyphs absent from the font.
|
||||
|
||||
For example, after generating and linking `app_font_20` with the required glyphs, select it explicitly. This symbol is illustrative, not a font supplied by this repository. Run object operations in the LVGL task or while holding `bsp_lvgl_lock()`:
|
||||
|
||||
```c
|
||||
LV_FONT_DECLARE(app_font_20);
|
||||
|
||||
/* Inside the application's UI creation function. */
|
||||
lv_obj_t *label = lv_label_create(parent);
|
||||
lv_obj_set_style_text_font(label, &app_font_20, LV_PART_MAIN | LV_STATE_DEFAULT);
|
||||
lv_label_set_text(label, "\u4E2D\u6587 ABC 123");
|
||||
```
|
||||
|
||||
### Troubleshooting order
|
||||
|
||||
| Symptom | Check first |
|
||||
| --- | --- |
|
||||
| Latin text works; Chinese is blank or boxed | Actual widget font and its fallback coverage, UTF-8 input, and `CONFIG_LV_TXT_ENC_UTF8`; disabling `CONFIG_LV_USE_FONT_PLACEHOLDER` only hides the missing-glyph indicator, not the defect |
|
||||
| Only some characters or new text fail | Missing subset entries, punctuation, each font size, and dynamic text outside the supported set; regenerate and relink the affected assets |
|
||||
| Body text works but titles/buttons or selected states fail | Explicit local fonts, theme/state overrides, and the font on the widget part that draws the text |
|
||||
| Glyph coverage is correct but text is invisible or cut off | Text color/opacity, hidden flags, label size, line height, parent clipping, and draw/allocation errors; do not assume every blank label is a font defect |
|
||||
|
||||
### Required acceptance
|
||||
|
||||
- Check every required printable Unicode code point against each font/fallback chain actually used. With the pinned LVGL API, `lv_font_get_glyph_dsc()` must succeed and `is_placeholder` must be false; a placeholder is not coverage. Decode UTF-8 into code points rather than testing individual bytes. Record uncovered code points and add a repeatable coverage check alongside the application's font-generation pipeline.
|
||||
- On the device, verify all pages and error/empty states, Chinese/Latin/digit/punctuation/icon mixtures, different sizes and interaction states, long text, and dynamic content both inside and outside the declared supported set. Check for boxes, blanks, clipping, and fallback baseline/line-height mismatches; do not accept one successful sample label as whole-application validation.
|
||||
- Report the tested text/character set, font sizes, and resource changes. The baseline's host tests do not validate a derivative application's font coverage or screen output. Without a physical-device check, report `Device tests: NOT RUN` and explicitly list Chinese rendering under `Unverified`.
|
||||
|
||||
Font selection and fallback semantics: [LVGL 9.5 font overview](https://docs.lvgl.io/9.5/main-modules/fonts/overview.html). Missing-glyph handling: [LVGL 9.5 implementation](https://github.com/lvgl/lvgl/blob/v9.5.0/src/font/lv_font.c).
|
||||
Loaded 3 of 1761 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user