Rotate LVGL objects with rotation magnetic encoder


I have a AS5600 magnetic encoder connected to the esp32.
I need to rotate a LVGL object with the angle I get.

I have two problems when I run the code.
1: When I quickly turn the knob connected to the encoder some pieces of graphics remain in the old position. Here is an example:

2: When the object I rotate exceeds a certain size (depends on how much LV_MEM_SIZE is set) esp32 panics and restarts.
With 64kb of LV_MEM_SIZE I can rotate objects up to 90 x 90 px, with 96kb I get up to 120ppx, but I need to rotate larger objects.
It is not possible to set more than 100kb of LV_MEM_SIZE.

What MCU/Processor/Board and compiler are you using?

ESP32, Arduino IDE on Mac.
Display is a ILI9341 320x240px

What LVGL version are you using?


What do you want to achieve?

A smooth rotation of a large object, am I doing this correctly or is there a better way to do it?

What have you tried so far?

Already explained above

Code to reproduce

Using arduino-timer.h library I read rotation data every 25ms

timer.every(25, handleAS5600);

bool handleAS5600(void *) {
  int16_t rawAngle = (as5600.rawAngle() * AS5600_RAW_TO_DEGREES);
  lv_obj_set_style_transform_angle(btnObj, rawAngle * 10, 0);
  return true;

lv_obj_t is declared as global pointer

lv_obj_t *btnObj;

in the setup function I call this function to render the Button

void button(void) {
  btnObj = lv_btn_create(lv_scr_act()); /*Add a button the current screen*/
  lv_obj_set_size(btnObj, 90, 90); /*Set its size*/
  lv_obj_set_style_transform_pivot_x(btnObj, 45, 0); /*Sets x pivot position*/
  lv_obj_set_style_transform_pivot_y(btnObj, 45, 0); /*Sets y pivot position*/
  lv_obj_t *label = lv_label_create(btnObj); /*Add a label to the button*/
  lv_label_set_text(label, "Button");        /*Set the labels text*/
  lv_obj_center(label); /*Centers label*/
  lv_obj_center(btnObj); /*Centers button*/