I am wanting to snapshot the current display. It seems to mostly work, but I’m only getting part of the image. Maybe because of double buffering? Is there a better way? I am running on ESP32 with ST7735 driver. The screen is currently set to a green background, which seems to be about right in the captured image.
import lvgl as lv
import utime
lv.init()
# Global variable to store the pixel data
snapshot = None
def take(file_name="/app/mcc/images/snapshot.bin"):
global snapshot # Indicate that we're using the global variable
scr = lv.screen_active()
# Take a snapshot of the screen
start_time = utime.ticks_us()
snapshot = lv.snapshot_take(scr, lv.COLOR_FORMAT.NATIVE)
end_time = utime.ticks_us()
#print(f"Snapshot taken in {utime.ticks_diff(end_time, start_time)} microseconds")
Edit:
Image has now changed to all noise.