Files
phtotest/README.md
DESKTOP-PUHFO60\dsx2016 4bd97975eb Keep album full-screen after GIF and reduce motion-region flicker.
Unify STRETCH layout for all photos, decode GIF 1:1 with disposal restore, and ship a 160x120 sample GIF.

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

1.7 KiB
Raw Blame History

CYD Photo Album

ESP32-2432S028R 电子相册:从 TF 卡读取 JPG / PNG / GIF,触控切换相片。

硬件与触摸标定复用 tftest(SoftSPI + BL/TR 对角修正,勿改 src/touch.cpp)。

功能

  • 扫描 TF 卡 /photos 与根目录的 .jpg / .jpeg / .png / .gif
  • 半分辨率画布 160×120,界面始终全屏 STRETCH 到 320×240
  • JPG / PNG cover 铺满;GIF 建议 ≤160×120(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
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