Fix LVGL GIF decoder: start with transparent canvas

LVGL 8.3.11 gifdec filled the initial canvas opaque with the GIF background
color, so transparent-background GIFs (loligod.gif) showed dark gray until
'restore to background' frames cleared each area to the screen color.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
patriandClaude Opus 5.5 committed 2026-10-23 00:27:33 +02:00
1 parent 65431703c1
commit 3e412f8231
2 files changed
+11 -5

No files matched your search

+3 -1
View File
@@ -94,7 +94,9 @@ AliExpress "ELM327 Mini V2.1 Bluetooth OBD **Dual Mode** 5.1" — dual mode = Bl
Cheap dual-mode clones typically expose BLE service `FFF0` (notify `FFF1`, write `FFF2`) — **not yet verified** on this adapter; scan it first. Adapter is powered from the car's OBD port (pin 16, 12 V).
## Gotchas / observations
- **GIF transparency → black background:** almost all GIFs in `10-OBD-Display-2024/assets/gifs` are *optimized* (frames mark unchanged pixels transparent, disposal 1/2). LVGL 8.3's gifdec shows the screen background (black in the sketches) wherever no frame has painted yet. Fix by using un-optimized GIFs (full frames, no transparency) or a non-black screen background.
- **LVGL GIF bug (patched locally):** LVGL 8.3.11 `gifdec.c` (`gd_open_gif`) filled the canvas *opaque* with the GIF's background color. GIFs with a transparent background (e.g. `loligod.gif`, bg = RGB 28,29,49) showed that dark gray except where "restore to background" frames had cleared to transparent (→ screen black). **Patched** in the vendor copy `2-Program Example/Demo_Arduino/library/lvgl/src/extra/libs/gif/gifdec.c`: initial canvas alpha 0x00 (marked `LOCAL PATCH`). Re-apply if LVGL is ever replaced/upgraded.
- Most GIFs in `assets/gifs` are optimized (transparent unchanged pixels, disposal 1/2); `loligod.gif` has a fully transparent background (~84 % of each frame).
- LVGL version: all JC3636W518 projects use the vendor-bundled **LVGL 8.3.11**. LVGL 9 would require porting `scr_st77916.h` (display/touch driver glue).
- Display is round: corners of the 360×360 framebuffer are not visible — design UI within a 360 px circle.
- Compiling a 13.9 MB GIF into the firmware will not fit "Huge APP" (3 MB); large media should live on SD (or in a custom partition).
- The top-level demo `setup()` returns early if no SD card is present, before showing anything.