ESP32 and LVGL: sleep modes

Hi all,

I’m looking at the stuff on sleeping in the porting section of the LVGL documentation and trying to figure out how one would apply this to Micropython. I’d like to detect that LVGL is idle and play with various sleep modes of the ESP32 (in an M5Stack Core2 in my case) as well as putting the display to sleep after a timeout. Some of this is clearly LVGL specific, some is more generic and applies to all of Micropython, some is ESP32 and some is M5Stack/ILI9341 specific.

First off, I’d appreciate any pointers as to where to put the idle detection in Micropython. Also: has anyone seen anything related to ESP32 sleep modes and Microyphon?

Eventually there is some event loop which calls lv_task_handler.
You could put the device/display to sleep between calls to lv_task_handler inside the event loop.

The event loop has multiple implementations:

  • On stm32 that’s lvstm32
  • On ESP32 with uasyncio that’s in lv_async
  • On ESP32 without uasyncio that’s lvesp32
  • On the unix port that’s in the SDL or FB drivers

I’m working on consolidating these on v8 to a single cross-platform event loop on lv_utils.py but that’s work in progress.

Yes machine.sleep.
This can also be achieved through lvesp32 in case Micropython is missing some espidf API.

Thanks. Will experiment. First I’l try to make it all work on my platform in C, then see about python.