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.03k stars 19.13k forks source link

[BUG] DWIN_LCD_PROUI won't draw screen #27141

Open lonelyhero77 opened 1 month ago

lonelyhero77 commented 1 month ago

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

Yes, and the problem still exists.

Bug Description

DWIN_LCD_PROUI is not working

Bug Timeline

No response

Expected behavior

The DWIN LCD should be working

Actual behavior

The DWIN LCD won't draw anything except showing black screen

Steps to Reproduce

  1. define DWIN_LCD_PROUI in /Marlin/Configuration.h
  2. Build the firmware
  3. Upload to the machine
  4. Update the machine

Version of Marlin Firmware

head of bugfix-2.1.x branch

Printer model

Ender-3 V2

Electronics

BOARD_CREALITY_V422

LCD/Controller

Stock Ender-3 V2 DWIN LCD

Other add-ons

BLTouch

Bed Leveling

UBL Bilinear mesh

Your Slicer

Prusa Slicer

Host Software

SD Card (headless)

Don't forget to include

Additional information & file uploads

I use OrcaSlicer(forked from PrusaSlicer) for slicing configuration.zip

ellensp commented 1 month ago

Did you actually update the firmware in the display? (this is separate from the controller firmware) https://github.com/MarlinFirmware/Configurations/tree/import-2.1.x/config/examples/Creality/Ender-3%20V2

thisiskeithb commented 1 month ago

I'm going to mark this as confirmed since someone else on Discord is having the same issue with ProUI, even with the updated/matched DWIN set.

MarlinUI works fine.

lonelyhero77 commented 1 month ago

Did you actually update the firmware in the display? (this is separate from the controller firmware) https://github.com/MarlinFirmware/Configurations/tree/import-2.1.x/config/examples/Creality/Ender-3%20V2

Yes, my DWIN Display is up to date.

classicrocker883 commented 1 month ago

I address this issue in this https://github.com/MarlinFirmware/Marlin/pull/26917

MarlinCore.cpp


#if HAS_DWIN_E3V2
  #include "lcd/e3v2/common/encoder.h"
  #if ENABLED(DWIN_CREALITY_LCD)
    #include "lcd/e3v2/creality/dwin.h"
  #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
    #include "lcd/e3v2/jyersui/dwin.h"
+ #elif ENABLED(DWIN_LCD_PROUI)
+   #include "lcd/extui/ui_api.h"
  #endif
#endif

    @@ -1599,6 +1601,8 @@ void setup() {

  #if ENABLED(DWIN_CREALITY_LCD)
    SETUP_RUN(dwinInitScreen());
+ #elif ENABLED(DWIN_LCD_PROUI)
+   SETUP_RUN(ExtUI::onStartup());
  #endif
lonelyhero77 commented 1 month ago

I address this issue in this #26917

  • ProUI starting up has issues, reverted SETUP_RUN(...) in MarlinCore.cpp for fix

MarlinCore.cpp

#if HAS_DWIN_E3V2
  #include "lcd/e3v2/common/encoder.h"
  #if ENABLED(DWIN_CREALITY_LCD)
    #include "lcd/e3v2/creality/dwin.h"
  #elif ENABLED(DWIN_CREALITY_LCD_JYERSUI)
    #include "lcd/e3v2/jyersui/dwin.h"
+ #elif ENABLED(DWIN_LCD_PROUI)
+   #include "lcd/extui/ui_api.h"
  #endif
#endif

  @@ -1599,6 +1601,8 @@ void setup() {

  #if ENABLED(DWIN_CREALITY_LCD)
    SETUP_RUN(dwinInitScreen());
+ #elif ENABLED(DWIN_LCD_PROUI)
+   SETUP_RUN(ExtUI::onStartup());
  #endif

@classicrocker883 I've merged your PR to my up to dated fork. It was automerged but some errors ar occurred during build.

line 1235 @ /Marlin/src/lcd/e3v2/proui/dwin.cpp

switch (hmiValue.tempControl) {
          #if ENABLED(PIDTEMP)
            case PIDTEMP_START: drawHPlot(); break;
          #elif ENABLED(MPCTEMP)
            case MPCTEMP_START: drawHPlot(); break;
          #endif
          #if ENABLED(PIDTEMPBED)
            case PIDTEMPBED_START: drawBPlot(); break;
          #endif
          #if ENABLED(PIDTEMPCHAMBER)
            case PIDTEMPCHAMBER_START: drawCPlot(); break;
          #endif
        default: break;
        } break;

The scope MPCTEMP_START should be changed to MPC_STARTED. (this one is the only one which hasn't changed)

After I've changed the name of scope, The compiler shows this error: Marlin\src\lcd\e3v2\proui\proui_extui.cpp:220:45: error: cannot convert 'ExtUI::mpcresult_t' to 'tempcontrol_t'. Seems like the function dwinMPCTuning() is the problem but I've no idea of this error maybe there's something that I mistake.

classicrocker883 commented 1 month ago

youre right thanks

@ line 220, in that file proui_extui.cpp, change the following:

    void onMPCTuning(const mpcresult_t rst) {
      // Called for temperature MPC tuning result
      switch (rst) {
-       case MPC_STARTED:     dwinMPCTuning(MPC_STARTED);     break;
-       case MPC_TEMP_ERROR:  dwinMPCTuning(MPC_TEMP_ERROR);  break;
-       case MPC_INTERRUPTED: dwinMPCTuning(MPC_INTERRUPTED); break;
+       case MPC_STARTED:     dwinMPCTuning(tempcontrol_t(MPC_STARTED));     break;
+       case MPC_TEMP_ERROR:  dwinMPCTuning(tempcontrol_t(MPC_TEMP_ERROR));  break;
+       case MPC_INTERRUPTED: dwinMPCTuning(tempcontrol_t(MPC_INTERRUPTED)); break;
        case MPC_DONE:        dwinMPCTuning(AUTOTUNE_DONE);   break;
      }
    }

just like for PID tuning function, you will see case MPC_STARTED: has the same dwinMPCTuning(MPC_STARTED);

basically mpcresult_t and tempcontrol_t are both different, and they sometimes have the same exact Enum's. ones that are the same need to be differentiated like the change I posted. (also updated the PR)

nicwilson58 commented 3 weeks ago

when is it estimated the fix for this will appear in the nightly build?

thisiskeithb commented 3 weeks ago

when is it estimated the fix for this will appear in the nightly build?

There is no estimated time at the moment. I'd recommend using DWIN_MARLINUI_PORTRAIT or one of the other DWIN UIs if you want to run current bugfix-2.1.x code since DWIN_LCD_PROUI is still causing lockups/no boot scenarios.

classicrocker883 commented 2 weeks ago

@lonelyhero77 did that fix work for you, so everything works as it should?

lonelyhero77 commented 2 days ago

@lonelyhero77 did that fix work for you, so everything works as it should?

@classicrocker883 Sorry. I haven't been able to test in real for a while. I tested it now and it seems working OK. It now draws screen. but the firmware is unable to load dwin icons. Maybe it's related to the code that are about allocating dwin ico number.... I'm not sure yet.

classicrocker883 commented 1 day ago

you probably have a different .ico file installed than defined. check your DWIN_SET which you installed in the LCD, you should see 9.ICO or 7.ICO (could be something else)

in Marlin\src\lcd\e3v2\common\dwin_set.h look for #define ICON

change this to:
#define ICON 9 if you have 9.ICO in the DWIN_SET