Update README.md
基于 openvela 平台、C + LVGL 编写的简化版智能手环应用,含表盘、心率监测、计步三个页面。
将本项目源代码放入已经编译好的 openvela 框架下的 packages/demos/ , 然后执行以下 bash 命令进行编译:
cd ~/Desktop/openvela ./build.sh vendor/openvela/boards/vela/configs/goldfish-arm64-v8a-ap/
如果提示组件未启用,先执行菜单配置:
./build.sh vendor/openvela/boards/vela/configs/goldfish-arm64-v8a-ap/ menuconfig
按 / 搜索以下两项并设为 y:
/
y
LV_USE_FRAGMENT
LVX_USE_DEMO_SMARTBAND
然后按 Q → Y 保存退出,再执行编译。
Q
Y
./emulator.sh vela
在模拟器终端中输入:
smartband &
< back
┌──────────────────────┐ │ BT BAT 85% │ ← 状态栏 │ 05-30 SAT │ ← 日期 │ 14:26 │ ← 时间 │ ┌────────────────┐ │ │ │ STEPS ███ 42% │ │ ← 点击进入计步页 │ │ 4253 │ │ │ └────────────────┘ │ │ ┌────────────────┐ │ │ │ HR ███ 58% │ │ ← 点击进入心率页 │ │ HR:72 │ │ │ └────────────────┘ │ └──────────────────────┘
┌──────────────────────┐ │ < back Heart Rate │ │ ● (脉动) │ ← 红色圆 24↔36px 脉动动画 │ 72 │ ← 当前心率大字 │ bpm │ │ Range 58-92 │ ← 本次会话最小值 - 最大值 │ Recent 14:26 │ │ ┌──────────────────┐ │ │ │ ··· ····· ···· │ │ ← 趋势图(20 个数据点) │ └──────────────────┘ │ │ [Reset] │ ← 重置统计数据 └──────────────────────┘
lv_chart
┌──────────────────────┐ │ < back Steps │ │ │ │ ╭──────────╮ │ │ ╱ 42% ◀━ ╲ │ ← 蓝色弧形进度环 │ │ steps │ │ │ ╲ 42% ╱ │ │ ╰──────────╯ │ │ 4253 │ ← 步数大字 │ dist 3.187 km │ ← 距离(步 × 0.75m) │ carl 187 kcal │ ← 卡路里(步 × 0.044) │ target 5000 steps │ ← 目标值 └──────────────────────┘
packages/demos/smartband/ ├── smartband_main.c # 入口:LVGL + libuv 初始化 ├── smartband.c # 根容器 + Fragment Manager ├── smartband.h # 公开接口 │ ├── hal/ │ ├── clock.c/.h # 系统时间读取 │ ├── step_sim.c/.h # 步数模拟 │ └── heartrate_sim.c/.h # 心率模拟 │ ├── page/ │ ├── page.h/.c # 页面管理器 │ ├── page.inc # 页面注册表 │ ├── dialplate.c # 表盘页面 │ ├── heartrate.c # 心率页面 │ └── stepcounter.c # 计步页面 │ ├── CMakeLists.txt # CMake 构建 ├── Makefile # Make 构建 ├── Kconfig # 配置开关 ├── smartband_dev_plan.md # 方案文档 └── .gitignore # 忽略编译产物
Q: 提示 smartband: command not found
smartband: command not found
A: 说明应用没有被编译进去。执行 menuconfig 确认 LVX_USE_DEMO_SMARTBAND 和 LV_USE_FRAGMENT 均已启用,然后重新编译。
Q: 页面显示空白
A: 第一次运行时的 lv_obj_remove_style_all() bug 已修复。如果还是空白,执行 distclean 后重编:
lv_obj_remove_style_all()
distclean
./build.sh vendor/openvela/boards/vela/configs/goldfish-arm64-v8a-ap/ distclean -j8 ./build.sh vendor/openvela/boards/vela/configs/goldfish-arm64-v8a-ap/
Q: 点击 STEPS/HR 条提示 unknown page name
unknown page name
A: 需要删除 page.c 的旧 .o 文件强制重编:
page.c
.o
rm -f packages/demos/smartband/page/page.c.home.anqmaly.Desktop.openvela.packages.demos.smartband.o rm -f packages/demos/smartband/page/page.c.home.anqmaly.Desktop.openvela.packages.demos.smartband_1.o ./build.sh vendor/openvela/boards/vela/configs/goldfish-arm64-v8a-ap/
Q: 新增页面怎么加?
A: 三步:① 创建 page/xxx.c(末尾加 PAGE_CLASS_DEF(xxx))→ ② page.inc 添加 PAGE_DEF(xxx) → ③ 删 page/page.o 重编。
page/xxx.c
PAGE_CLASS_DEF(xxx)
page.inc
PAGE_DEF(xxx)
page/page.o
Q: 为什么不用图标和手势?
A: 为简化外部依赖,所有图标用纯文本替代;手势在模拟器中需要鼠标拖拽操作不直观,改为点击信息条导航。
版权所有:中国计算机学会技术支持:开源发展技术委员会 京ICP备13000930号-9 京公网安备 11010802047560号
SmartBand — openvela 智能手环 Demo
基于 openvela 平台、C + LVGL 编写的简化版智能手环应用,含表盘、心率监测、计步三个页面。
快速开始
1. 编译
将本项目源代码放入已经编译好的 openvela 框架下的 packages/demos/ , 然后执行以下 bash 命令进行编译:
如果提示组件未启用,先执行菜单配置:
按
/搜索以下两项并设为y:LV_USE_FRAGMENTLVX_USE_DEMO_SMARTBAND然后按
Q→Y保存退出,再执行编译。2. 运行
在模拟器终端中输入:
3. 操作
< back页面展示
表盘(Dialplate)
心率(Heart Rate)
lv_chart圆形缓冲模式计步(Step Counter)
项目结构
常见问题
Q: 提示
smartband: command not foundA: 说明应用没有被编译进去。执行 menuconfig 确认
LVX_USE_DEMO_SMARTBAND和LV_USE_FRAGMENT均已启用,然后重新编译。Q: 页面显示空白
A: 第一次运行时的
lv_obj_remove_style_all()bug 已修复。如果还是空白,执行distclean后重编:Q: 点击 STEPS/HR 条提示
unknown page nameA: 需要删除
page.c的旧.o文件强制重编:Q: 新增页面怎么加?
A: 三步:① 创建
page/xxx.c(末尾加PAGE_CLASS_DEF(xxx))→ ②page.inc添加PAGE_DEF(xxx)→ ③ 删page/page.o重编。Q: 为什么不用图标和手势?
A: 为简化外部依赖,所有图标用纯文本替代;手势在模拟器中需要鼠标拖拽操作不直观,改为点击信息条导航。
技术参数