Files
phtotest/README.md
DESKTOP-PUHFO60\dsx2016 d19341339b Fix 3.5C backlight (GPIO27) and GT911 INT handling per CYD guide.
Wrong BL=21 caused black screen; INT is separate from backlight and stays INPUT after reset.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-25 18:57:41 +08:00

70 lines
2.3 KiB
Markdown
Raw Permalink 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
电子相册:从 TF 卡读取 **JPG / PNG / GIF**,触控切换相片。
| 板型 | env | 屏 / 触控 | 背光 |
|------|-----|-----------|------|
| **2.8" ESP32-2432S028R**(默认) | `cyd` | ILI9341 + XPT2046 SoftSPI | GPIO**21** |
| **3.5" ESP32-3248S035C** | `cyd_35r` | ST7796 + GT911 I2C | GPIO**27** |
硬件与触摸复用 `tftest`(2.8 SoftSPI 对角修正 / 3.5 最小 GT911)。**禁止**把 2.8 的 `pins` 原样套到 3.5。约定见上级目录 `CYD_PROJECT_GUIDE.md`。
## 功能
- 扫描 TF 卡 `/photos` 与根目录的 `.jpg` / `.jpeg` / `.png` / `.gif`
- 半分辨率画布,界面全屏 STRETCH(2.8 → 320×240;3.5 → 480×320)
- JPG / PNG cover 铺满;GIF 建议偏小(1:1 解码,减少动区闪烁)
- **点左半屏 = 上一张,点右半屏 = 下一张**;底栏 `<` / `>` 同样切换
- 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
# 2.8"
pio run -e cyd -t upload --upload-port COM3
# 3.5C(确认丝印 3248S035C;BL=27、GT911)
pio run -e cyd_35r -t upload --upload-port COM3
```
或先导出再刷预编译包:
```powershell
.\firmware\export_from_build.ps1 # → firmware\cyd
.\firmware\export_from_build.ps1 -Env cyd_35r # → firmware\cyd_35r
cd firmware\cyd # 或 cyd_35r
.\flash.ps1 -Port COM3
```
## 目录要点
| 路径 | 说明 |
|------|------|
| `include/pins.h` | 板型分支(BL / 触控 / UI 分辨率) |
| `src/touch.cpp` | 2.8 SoftSPI / 3.5 GT911,勿乱改映射 |
| `src/photo_list.cpp` | 扫描相册文件 |
| `src/photo_view.cpp` | JPG/PNG/GIF 解码 |
| `src/ui.cpp` | 相册界面与切换 |
| `firmware/cyd/` | 2.8 预编译包 |
| `firmware/cyd_35r/` | 3.5 预编译包 |