Documentation
SCREENSHOTS
Capturing Screenshots
The firmware includes a screenshot capture mode that dumps the LVGL display buffer over USB serial as base64-encoded RGB565 data. A Python script on the host decodes it to PNG files.
How It Works
SCREENSHOT_ENABLED flag in main/main.c controls the featurelv_snapshot_take_to_draw_buf() into a PSRAM bufferEnabling Screenshot Mode
In main/main.c, set:
#define SCREENSHOT_ENABLED 1
Also ensure these are in sdkconfig.defaults:
CONFIG_LV_USE_SNAPSHOT=y
CONFIG_ESP_CONSOLE_USB_SERIAL_JTAG=yThen rebuild and flash:
source ~/esp/esp-idf/export.sh
rm sdkconfig # force sdkconfig rebuild with new defaults
idf.py build
idf.py -p /dev/ttyACM0 flash
Running the Capture Script
Requirements: Python 3 with pyserial and Pillow.
python3 tools/capture-screenshots.py /dev/ttyACM0 ./screenshotsThe script:
Disabling After Capture
Set SCREENSHOT_ENABLED back to 0, rebuild, and flash to restore normal operation. The screenshot code compiles out completely when disabled.
Serial Protocol
Each screenshot is framed as:
===SCREENSHOT:name:width:height===
<base64 data line>
<base64 data line>
...
===END===The base64 data encodes raw RGB565 pixels (little-endian, 2 bytes per pixel, row-major). The Python script strips any ESP-IDF log prefixes and validates base64 content before decoding.
Adding New Screens
To capture additional screen states, add entries to the screenshot_demo() function in main/main.c. The pattern is:
screenshot_capture("name")