Files
phtotest/README.md
DESKTOP-PUHFO60\dsx2016 99618a46b0 Add CYD photo album with jpg/png/gif viewer and sample assets.
Ship TF-card album UI, half-res decode canvas, prebuilt firmware, and documented flash/upload workflow.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-19 18:07:56 +08:00

58 lines
1.7 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# CYD Photo Album
ESP32-2432S028R 电子相册:从 TF 卡读取 **JPG / PNG / GIF**,触控切换相片。
硬件与触摸标定复用 `tftest`(SoftSPI + BL/TR 对角修正,**勿改** `src/touch.cpp`)。
## 功能
- 扫描 TF 卡 `/photos` 与根目录的 `.jpg` / `.jpeg` / `.png` / `.gif`
- 半分辨率画布 160×120,界面 2× 放大到 320×240(适配无 PSRAM 的 DRAM)
- JPG 过大自动 1/2、1/4、1/8 缩放;PNG / GIF 等比缩入画布
- **点左半屏 = 上一张,点右半屏 = 下一张**;底栏 `<` / `>` 同样切换
- GIF 自动播帧;右上角显示 TF 状态
- 串口 `#PUT` 传文件到卡(`tools/sd_put.py`)
## 测试图
样张在 `assets/photos/`(已入库):
| 文件 | 格式 |
|------|------|
| `01_blue.jpg` | JPG |
| `02_red.jpg` | JPG |
| `03_green.png` | PNG |
| `04_bounce.gif` | GIF |
```bash
python tools/make_test_photos.py
python tools/sd_put.py assets/photos/01_blue.jpg --port COM3 --remote /01_blue.jpg
python tools/sd_put.py assets/photos/02_red.jpg --port COM3 --remote /02_red.jpg
python tools/sd_put.py assets/photos/03_green.png --port COM3 --remote /03_green.png
python tools/sd_put.py assets/photos/04_bounce.gif --port COM3 --remote /04_bounce.gif
```
## 构建 / 烧录
```bash
pio run -e cyd -t upload --upload-port COM3
```
或先导出再刷预编译包:
```powershell
.\firmware\export_from_build.ps1
cd firmware\cyd
.\flash.ps1 -Port COM3
```
## 目录要点
| 路径 | 说明 |
|------|------|
| `src/touch.cpp` | 触摸标定,勿改 |
| `src/photo_list.cpp` | 扫描相册文件 |
| `src/photo_view.cpp` | JPG/PNG/GIF 解码 |
| `src/ui.cpp` | 相册界面与切换 |
| `firmware/cyd/` | 预编译固件 + `flash.ps1` |