MarlinFirmware / Marlin

Marlin is an optimized firmware for RepRap 3D printers based on the Arduino platform. Many commercial 3D printers come with Marlin installed. Check with your vendor if you need source code for your specific machine.
https://marlinfw.org
GNU General Public License v3.0
16.34k stars 19.26k forks source link

[BUG] MKS_WIFI_MODULE feature broken in latest firmware releases #27432

Open SMH17 opened 2 months ago

SMH17 commented 2 months ago

Did you test the latest bugfix-2.1.x code?

Yes, and the problem still exists.

Bug Description

I have migrated the firmware of MKS Nano 1.2 to Marlin 2.1.2.4 with LVGL UI, the firmware compiles correctly and works but if a Wifi module is installed in the motherboard and you need to have MKS_WIFI_MODULE enabled to use WifFi module with LVGL UI, 3D printer remains frozen with black screen at the point where normally the Wifi module (in this case a MKS Robin WIFI V1.1 based on ESP-12S\ESP8266) firmware flashing should start.

It seems some commit has broken the proper initialization of the MKS wifi module.

Expected behavior

The WiFi module firmware upload should be correctly completed.

Actual behavior

The WiFi module firmware fails making the firmware with LVGL unusable unless MKS_WIFI_MODULE is disabled in the firmware config, that as consequence makes the WiFi feature unusable in LVGL mode.

Steps to Reproduce

Upload the firmware with LVGL UI on a MKS Nano 1.x based 3D printer with a Wifi module installed in the motherboard and MKS_WIFI_MODULE function enabled (that should be enabled by default with TFT_LVGL_UI since the following directive is present

#if ENABLED(TFT_LVGL_UI)
  #define MKS_WIFI_MODULE  // MKS WiFi module
#endif

)

Version of Marlin Firmware

2.1.2.4

SMH17 commented 2 months ago

The problem seems related to LVGL timing and memory access that when MKS_WIFI_MODULE is in use causes the crash, preventing correct initialization.

Turning on IRAM_ATTR flag and reducing the video buffer of the LVGL library I managed to have a functional firmware based on Marlin 2.1.2.4 + LVGL UI on MKS Nano 1.2 with ESP-12S\ESP8266. But the issue should be further investigated, this wasn't necessary with older Marlin 2.0.x, so at some point some commit introduced the issue.