API Status Display and Fan Control / Screen Glitch when updating UI

I’m working on a project where the ESP32-S3 receives an ESP-NOW message from a sensor node and updates the UI using LVGL. Everything works well until I trigger a command to send a “Fan OFF” ESP-NOW message back to the sensor.

After this send, my screen glitches, as if the draw buffers are corrupted or invalid. Areas of the LVGL UI becomes unreadable, and I have to reset the board to clear.

Here are a few specifics on the two esp boards.

LCD: WT32-SC01 Plus (ESP32-S3)
Sensor Node: ESP-WROOM-32 ESP32 ESP-32S Dev Board
Graphics: LVGL 8.3.11 + LovyanGFX
Framework: Arduino via PlatformIO
PSRAM: Enabled

I’ve confirmed:

  • The glitch only happens after calling esp_now_send()
  • Using lv_disp_get_inactive_time() to delay the send doesn’t help consistently
  • LVGL is rendering correctly otherwise (boot logo, pills, layout, etc.)
  • I am not modifying LVGL from any other thread or interrupt

What I’ve Tried:

  • Deferring the ESP-NOW send until lv_disp_get_inactive_time() is > 50ms
  • Disabling LVGL rendering just before the send (by halting updateLVGL())
  • Replacing deferred timer logic with a simple flag in loop()
  • Reducing SPI speed
  • Using a separate LVGL task (no improvement)

Right now my only option for fan control is to eliminate the “Fan OFF” all together. The fan PWM control is through a MOSFET, which does allow for the fan to maintain a complete OFF status without the use of a relay, but I’m running into this glitch. I’ve attached a photo for reference as well. I’m not really sure which parts of the code to share, as its quite extensive.