Micropython, LVGL onan ESP32, touch screen timer

I have an ESP32-WROVER-B connected to an st7796 display via SPI. One of the thing I noticed was the jittery nature of the scrolling. The touch interface which is an FT6336 has an interrupt pin. This pin is actually useless because it send interrupts where there are no touches being made even when it is set to polling mode it still does this. I started out with wanting to use the interrupt which LVGL does not have a mechanism in place that gets exposed to MicroPython in order to process the touch screen input. So I write a function that pretty much does the same thing that LVGL does internally and added it to espidf.c with a declaration in espidf.h. It would be perfect if the interrupt functioned properly. So I shifted gears to seeing how LVGL would run if I created a thread that polled the touch driver and then passed any touch input to the function I made.

I have to say there is a significant improvement in the jitter when scrolling. That jitter was being caused by the timer that is used to call the callback function for the touch driver. I was able to delete the timer once the driver was registered. It works out well for me because I have to run a loop in order to check sensors and control a motor so having it also check the touch was easy to do. The sensor update is done every 0.5 seconds and the checking for touch is as fast as it possibly can.

I believe that the high CPU use in LVGL even when idling may be due to the timer in the touch driver. I have not tested this theory yet and I will soon enough.

I just thought it worth mentioning because of how much the improvement was.