800e168b98967efdf727f1a4680f464de033ac66
Co-authored-by: Cursor <cursoragent@cursor.com>
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 |
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
构建 / 烧录
pio run -e cyd -t upload --upload-port COM3
或先导出再刷预编译包:
.\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 |
Description
Languages
C++
42.5%
C
37.7%
PowerShell
8.2%
Python
7.2%
HTML
4.2%
Other
0.2%