lvgl / lv_binding_micropython

LVGL binding for MicroPython
MIT License
237 stars 156 forks source link

fix(display): fix random crash of ESP32 ili9XXX driver #330

Closed PGNetHun closed 4 months ago

PGNetHun commented 4 months ago

Fix random crash of ESP32 ili9XXX display driver.

During testing an ESP32 device I have noticed that after reset the following line randomly stops the execution: self.disp_drv.set_flush_cb(esp.ili9xxx_flush if hybrid and hasattr(esp, 'ili9xxx_flush') else self.flush)

The problem occurs only every time in that line. When the if-else statement is moved out from the function, and stored in a variable, then the problem disappears.

Other change: moved out esp.MALLOC_CAP.DMA flag from functions into a global variable (_MALLOC_DMA), and added esp.MALLOC_CAP.INTERNAL flag too (just to make sure DMA-able memory is always allocated in internal memory)