Skip to content

config: unify settings into ~/.config/cardputerzero/config.json#86

Merged
eggfly merged 1 commit into
masterfrom
fix/camera-resolution-config
Jul 1, 2026
Merged

config: unify settings into ~/.config/cardputerzero/config.json#86
eggfly merged 1 commit into
masterfrom
fix/camera-resolution-config

Conversation

@eggfly

@eggfly eggfly commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • 把 launcher 的配置存储从 /var/lib/applaunch/settings(扁平 key=value)整体迁到单一的用户级 JSON 文件 ~/.config/cardputerzero/config.json,与其它 app 共享。
  • 新增 header-only 极简 JSON 读写 cp0_config_json.h:dotted key ↔ 嵌套结构,launcher 自身设置为顶层键,camera.resolution.{width,height} 为嵌套对象(与 camera 开发者的读取契约一致)。
  • 重写设备版 cp0_lvgl_config.cpp 与模拟器版 sdl_lvgl_config.cpp 走 JSON 读写。
  • 修复「Setting 里设置 Camera Resolution 无效」:现在写真实宽高到 camera.resolution,而不是无人读取的选项索引。
  • 不做旧文件迁移(尚无正式用户)。

Camera 开发者契约

读取 ~/.config/cardputerzero/config.json 里的 camera.resolution.width / camera.resolution.height(整数),缺失时用自身默认值兜底。示例:

{
  "camera": { "resolution": { "width": 640, "height": 480 } }
}

Test plan

  • Docker 交叉编译通过(APPLaunch)
  • 部署到设备 192.168.50.150,服务正常
  • 本机往返测试:扁平键顶层、camera 嵌套、数字/字符串区分、解析还原正确
  • 设备上切换 app 隐藏 + 改分辨率,确认都落到同一 JSON

Made with Cursor

Move the launcher config store from the flat key=value file at
/var/lib/applaunch/settings to a single per-user JSON file at
~/.config/cardputerzero/config.json, shared with other apps.

- Add a small header-only JSON reader/writer (cp0_config_json.h) that
  maps dotted keys to nested JSON, so flat launcher keys stay top-level
  while camera.resolution.{width,height} is a nested object the camera
  app reads.
- Rewrite the cp0 and sdl config backends to load/save JSON.
- Camera Resolution in Settings now writes real width/height under
  camera.resolution instead of an unused option index, fixing the bug
  where the resolution setting had no effect.

No migration from the legacy file (no shipped users yet).

Co-authored-by: Cursor <cursoragent@cursor.com>
@eggfly eggfly merged commit 5c877f6 into master Jul 1, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant