diff --git a/README.md b/README.md index 26014d5..08b9852 100644 --- a/README.md +++ b/README.md @@ -5,48 +5,105 @@ # FoloToy AI Passport — Projects This fork of [`FoloToy/ai-passport`](https://github.com/FoloToy/ai-passport) -hosts several independent applications developed on the AI Passport wearable -(ESP32-C3, 8 MB Flash, no PSRAM). Each project lives on its own `feature/*` -branch and is introduced below. This page is the **catalog of the projects in -this fork**; see the upstream -[`docs/README.md`](docs/README.md) for the board baseline, hardware, and the -development workflow. +develops independent applications on the AI Passport wearable (ESP32-C3, 8 MB +Flash, no PSRAM). Each project lives on its own `feature/*` branch, and this page +presents the **full content of each project** — what it does and how to use it — +so the collection is discoverable from the repository's landing page. The board +baseline, hardware, BSP, and contribution rules come from the upstream +repository. ## Projects ### Voice Keychain A sound-effects keychain that turns the AI Passport into a pocket audio player. -Open it and play one of hundreds of Chinese voice clips from dozens of character -packs — jojo, meme cat, Liu Huaqiang, Haji Mi, Nailong, and more. Three keys -drive it: **UP / DOWN** to move in a list, **OK** to enter a directory, select a -clip, or play it, and **OK (hold)** for settings (battery and volume) or to go -back. A top bar shows the battery percentage. +Open it and instantly play one of hundreds of Chinese voice clips from dozens of +character packs — jojo, meme cat, Liu Huaqiang, Haji Mi, Nailong, Xiao Ming +Jian Mo, and more. + +**What it does** + +- **Character directory**: browse all character packs as a scrollable list; each + entry is a pack of voice clips (e.g. jojo, MC, meme cat, Liu Huaqiang, + Liu Haizhu, Kaqiu Mixue'er, Luyin, Indian A-san, Ji Yi Kawai, Haji Mi, + Nailong, Bao Bao Duda Leilei, Xiao TuanTuan, Xiao Ming Jian Mo). +- **Clip list**: enter a pack to see its clips by name. +- **One-tap playback**: press OK to play the selected clip; built-in decoding + plays 8 kHz mono IMA-ADPCM audio. +- **Settings** (hold OK): show the current battery percentage and voltage, and + adjust the playback volume. + +**Interaction** + +Three keys drive the whole app. A top bar shows the title and, on the home +screen, the battery percentage (e.g. `97%`). + +- **UP / DOWN** — move selection (hold to scroll). +- **OK** — enter a directory / select a clip / play. +- **OK (hold)** — open settings, or go back. + +Long entries scroll horizontally so the full name is readable; the selected row +is highlighted in blue. The clips live in a `voicefs` SPIFFS data partition +(mounted at `/voices`), built via `tools/encode_voice.py` (decode → resample to +8 kHz mono → IMA-ADPCM 4-bit → `main/voice_index.h` + `voicefs.img`), and the app +flashes the merged firmware image and that data partition separately. - Branch: [`feature/voice-keychain`](https://github.com/Shinku-Chen/ai-passport/tree/feature/voice-keychain) - Archive: [`plays/shinku-chen/voice-keychain/`](plays/shinku-chen/voice-keychain/README.md) ### What to Eat Today -A food-roulette decision helper. Hold **UP** to run the "what should we eat for -lunch?" guide animation, hold **DOWN** to spin through the food selector, and -release to stop on a random food. It shows a live battery reading and -auto-poweroffs after a period of idle. The frames are embedded as index-colored -SPIFFS/LVGL assets so the animation runs without a PSRAM buffer. +A food-roulette decision helper. Not sure what to eat? Hold the buttons to spin +through a food lottery and release to land on a random food. + +**Interaction** + +Three keys drive the app (button callbacks run in the button task, so they stay +non-blocking; the animation loop runs on an LVGL timer): + +- **Hold UP** — play the guide animation ("what should we eat for lunch?"). +- **Hold DOWN** — spin through the food-selector animation. +- **Release** — stop on the current frame (the food you landed on). +- **OK (hold)** — return to the menu (intercepted by `main.c`). + +The "release" is detected by polling `bsp_button_read_mv()` (this BSP has no +RELEASE event): released ≈ 3300 mV, pressed < 2000 mV. + +**What it does** + +- A top-right battery indicator (read from `bsp_battery_soc()`) shows the live + charge, degrading gracefully when the reading is `-1`. +- Auto-poweroff after a period of idle. +- No PSRAM needed: the food frames are embedded as LVGL `LV_COLOR_FORMAT_I8` + index-color binary (via CMake `EMBED_FILES`), so the animation runs from Flash + without a frame buffer. + +The frames come from `main/eat_what_g1.bin` / `main/eat_what_g2.bin` (256-color +palette + pixel index per frame, generated by +`tools/generate_eat_what_assets.py`). Cover art is +`assets/images/eat-what-cover.png` (2048 × 2048): "a cute cartoon TV showing +burgers, ramen, dumplings, hotpot, and milk tea." - Branch: [`feature/cheerful-goodall`](https://github.com/Shinku-Chen/ai-passport/tree/feature/cheerful-goodall) -- Entry: `main/demo_eat_what.c`; cover art at `assets/images/eat-what-cover.png` +- Entry: `main/demo_eat_what.c` ### Shengzi Cards -A Chinese-character flashcard memorization app. Three modes: +A Chinese-character flashcard memorization app. The firmware boots straight into +this application using the `ui_pixel` theme (sky background, grass, title plate, +mascot, ink-outlined panels) on the 240 × 320 display. -- **Browse** — scroll through character cards. +**Three modes**, switched by holding **UP / DOWN**: + +- **Browse** — scroll through the character cards (a large character card with + its pinyin above and a hint line below). - **Self-test** — mark each character as learned / not learned. - **Spell** — see the pinyin and guess the character. -Hold **UP / DOWN** to switch modes; a short **OK** press reveals the answer in -the self-test / spell modes. The "learned" marks persist to NVS. +A short **OK** press reveals the answer in the self-test / spell modes. The +"learned" marks persist to NVS (`sz_data`), so progress survives a reboot. The +screen layout is a title bar (≈ y0–46), a pinyin row (y ≈ 58), the large +character-card region (y ≈ 78–218), and a bottom info line (y ≈ 255–290). - Branch: [`feature/shengzi-cards`](https://github.com/Shinku-Chen/ai-passport/tree/feature/shengzi-cards) - Entry: `main/demo_shengzi.c` diff --git a/README.zh_CN.md b/README.zh_CN.md index f85f92f..ab67d32 100644 --- a/README.zh_CN.md +++ b/README.zh_CN.md @@ -5,40 +5,82 @@ # FoloToy AI Passport — 项目 本仓库是 [`FoloToy/ai-passport`](https://github.com/FoloToy/ai-passport) 的 fork, -在 AI Passport 可穿戴设备(ESP32-C3、8 MB Flash、无 PSRAM)上开发了多个独立应用。 -每个项目各自位于一个 `feature/*` 分支上,下面逐个介绍。本页是**该 fork 所承载各项目的目录**; -板卡基线、硬件与开发流程见上游 [`docs/README.md`](docs/README.md)。 +在 AI Passport 可穿戴设备(ESP32-C3、8 MB Flash、无 PSRAM)上开发了多个独立应用。每个项目各自位于 +一个 `feature/*` 分支上,本页呈现**每个项目的完整内容**——它做什么、怎么用——让这套作品能从仓库 +落地页被检索到。板卡基线、硬件、BSP 与贡献规则来自上游仓库。 ## 项目 ### 音效钥匙扣(Voice Keychain) -把 AI Passport 变成口袋音频播放器的音效钥匙扣。打开即可播放来自几十个角色包的数百条中文语音片段 -——jojo、meme cat、刘华强、哈吉米、奶龙等等。三个按键驱动:**UP / DOWN** 在列表中移动, -**OK** 进入目录、选择片段或播放,**OK(长按)** 进入设置(电量与音量)或返回。顶部栏显示电量 -百分比。 +一个把 AI Passport 变成口袋音频播放器的音效钥匙扣。打开即可播放来自几十个角色包的数百条中文语音片段 +——jojo、meme cat、刘华强、哈吉米、奶龙、小明剪膜等等。 + +**功能** + +- **角色目录**:以可滚动列表浏览所有角色包;每个条目是一个语音包(如 jojo、MC、meme cat、刘华强、 + 刘海柱、卡丘美雪、路银、印度阿三、吉一卡哇伊、哈吉米、奶龙、抱抱嘟大磊磊、小团团、小明剪膜)。 +- **片段列表**:进入某个包查看其中的片段名。 +- **一键播放**:按 OK 播放选中的片段;内置解码播放 8 kHz 单声道 IMA-ADPCM 音频。 +- **设置**(长按 OK):显示当前电量百分比与电压,调节播放音量。 + +**交互** + +三个按键驱动整个应用。顶部栏显示标题,主界面显示电量百分比(如 `97%`)。 + +- **UP / DOWN** —— 移动选中项(长按滚动)。 +- **OK** —— 进入目录 / 选择片段 / 播放。 +- **OK(长按)** —— 打开设置,或返回。 + +长条目横向滚动以便看清全名;选中行高亮为蓝色。语音片段存放在挂载于 `/voices` 的 `voicefs` SPIFFS +数据分区,由 `tools/encode_voice.py` 生成(解码 → 重采样到 8 kHz 单声道 → IMA-ADPCM 4bit → +`main/voice_index.h` + `voicefs.img`),应用分别烧录合并固件镜像与该数据分区。 - 分支:[`feature/voice-keychain`](https://github.com/Shinku-Chen/ai-passport/tree/feature/voice-keychain) - 档案:[`plays/shinku-chen/voice-keychain/`](plays/shinku-chen/voice-keychain/README.zh_CN.md) ### 今天吃啥(What to Eat Today) -一个食物转盘决策小助手。按住 **UP** 播放"今天午餐要吃什么呢?"引导动画,按住 **DOWN** 滚动食物 -选择器,松开停在某个随机食物上。实时显示电量,空闲一段时间后自动关机。帧画面以索引色素材嵌入, -无需 PSRAM 缓冲即可运行。 +一个食物转盘决策小助手。不知道吃什么?按住按键滚动食物彩票,松开停在某个随机食物上。 + +**交互** + +三个按键驱动应用(按键回调跑在 button 任务里、保持非阻塞;动画循环用 LVGL timer 跑): + +- **按住 UP** —— 播放引导动画("今天午餐要吃什么呢?")。 +- **按住 DOWN** —— 滚动食物选择器动画。 +- **松开** —— 停在当前帧(落在的食物)。 +- **OK(长按)** —— 返回菜单(由 `main.c` 统一拦截)。 + +"松开"靠轮询 `bsp_button_read_mv()` 检测(本 BSP 无 RELEASE 事件):松开 ≈ 3300 mV,按住 < 2000 mV。 + +**功能** + +- 右上角电量指示(读取 `bsp_battery_soc()`)实时显示电量;读值为 `-1`(不可用)时优雅降级。 +- 空闲一段时间后自动关机。 +- 无需 PSRAM:食物帧以 LVGL `LV_COLOR_FORMAT_I8` 索引色二进制嵌入(CMake `EMBED_FILES`),动画直接 + 从 Flash 播放,无需帧缓冲。 + +帧画面来自 `main/eat_what_g1.bin` / `main/eat_what_g2.bin`(256 色调色板 + 每帧像素索引,由 +`tools/generate_eat_what_assets.py` 生成)。封面素材 `assets/images/eat-what-cover.png` +(2048 × 2048):"展示汉堡、拉面、饺子、火锅、奶茶的可爱卡通电视"。 - 分支:[`feature/cheerful-goodall`](https://github.com/Shinku-Chen/ai-passport/tree/feature/cheerful-goodall) -- 入口:`main/demo_eat_what.c`;封面素材 `assets/images/eat-what-cover.png` +- 入口:`main/demo_eat_what.c` ### 生字卡片识记(Shengzi Cards) -一个汉字闪卡识记应用。三种模式: +一个汉字闪卡识记应用。固件启动后直接进入该应用,使用 `ui_pixel` 主题(天空底色、草地、标题牌、吉祥物、 +墨色描边面板)在 240 × 320 屏幕上呈现。 -- **浏览(Browse)** — 滚动浏览字卡。 -- **自测(Self-test)** — 标记每个字认识/不认识。 -- **拼读(Spell)** — 看拼音猜字。 +**三种模式**,长按 **UP / DOWN** 切换: -长按 **UP / DOWN** 切换模式;**OK 短按**在自测/拼读模式里"揭晓"。已认识标记持久化到 NVS。 +- **浏览(Browse)** —— 滚动浏览字卡(一张大字卡,上方拼音、下方一行提示)。 +- **自测(Self-test)** —— 标记每个字认识/不认识。 +- **拼读(Spell)** —— 看拼音猜字。 + +**OK 短按** 在自测/拼读模式里"揭晓"答案。"已认识"标记持久化到 NVS(`sz_data`),重启后进度不丢。 +屏幕布局:标题栏(≈ y0–46)、拼音行(y ≈ 58)、大字卡片区(y ≈ 78–218)、底部信息行(y ≈ 255–290)。 - 分支:[`feature/shengzi-cards`](https://github.com/Shinku-Chen/ai-passport/tree/feature/shengzi-cards) - 入口:`main/demo_shengzi.c`