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.18k stars 19.21k forks source link

[BUG] DGUS_LCD_UI_MKS with DEBUG_DGUSLCD won't compile #23513

Closed DejitaruJin closed 2 years ago

DejitaruJin commented 2 years ago

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

Yes, and the problem still exists.

Bug Description

I am currently trying to port the MKS DWIN screen firmware to a slightly different screen, and I hoped debugging would help me figure out why it won't do the thing. However, if I enable DEBUG_DGUSLCD in Marlin/src/lcd/extui/dgus/DGUSDisplay.h, it encounters errors:

/mnt/DNI/Downloads/Marlin/Marlin-2.0.9.3-test/Marlin/src/lcd/extui/dgus/mks/DGUSScreenHandler.cpp:759:39: error: 'class GCodeQueue' has no member named 'length'
/mnt/DNI/Downloads/Marlin/Marlin-2.0.9.3-test/Marlin/src/core/serial.h:297:75: error: conversion from 'const int16_t {aka const int}' to 'EnsureDouble' is ambiguous

And a cascade of others that are seemingly just side effects. I could probably fix this myself but I'm already three or four levels deep in "I need to fix A so I can fix B" so handing this one off would be pretty neat. None of the other DWIN options have such an issue.

Incidentally, debugging is entirely broken in the bugfix branch as of right now, so that's of little help. The offending lines still exist in the relevant file, though.

Bug Timeline

<= 2.0.9.3

Expected behavior

Compile with DGUS/DWIN debug output enabled

Actual behavior

Compile error; references nonexistent class member.

Steps to Reproduce

  1. Download Marlin 2.0.9.3 (current)
  2. Edit Configuration.h to uncomment #define DGUS_LCD_UI_MKS (no other edits needed to test)
  3. Edit Marlin/src/lcd/extui/dgus/DGUSDisplay.h to uncomment #define DEBUG_DGUSLCD
  4. Attempt to compile in the latest environment of your choice

Version of Marlin Firmware

2.0.9.3

Printer model

Longer LK4 Pro

Electronics

Stock

Add-ons

No response

Bed Leveling

No response

Your Slicer

No response

Host Software

No response

Additional information & file uploads

Configuration.zip

thinkyhead commented 2 years ago

You have not attached configurations that can be used to build with Marlin bugfix-2.0.x, so this cannot be explored further.

DejitaruJin commented 2 years ago

I had assumed it'd be easier to simply uncomment line 2618 rather than mess around downloading and copying files, especially since other files need editing anyways, but if you "cannot" investigate the issue without it, I've now provided the Configuration.h I just modified from today's bugfix branch. I've also verified that this same config file (now 0.4K larger?) still produces the same output on the 2.0.9.3 master, irrespective of whatever else has changed in the branch. These errors are identical whether using a config specifically for my machine, or freshly downloaded with only the one option uncommented.

Please bear in mind that even with this assistance, A) You still need to uncomment line 39 of Marlin/src/lcd/extui/dgus/DGUSDisplay.h, and B) The bugfix branch has a more serious underlying issue that seems to affect all DWIN debug output. It would likely be easier to resolve the new issue with, say, DGUS_LCD_UI_ORIGIN selected instead, then tackle the bug that had been plaguing MKS specifically. Testing further, options like PID_DEBUG and DEBUG_LEVELING_FEATURE do not cause a compile error.

DejitaruJin commented 2 years ago

The current DWIN debug bug, affecting all modules, has been found in commit 755c10d3030ed18762e05b1f86396237bca8dfbf . I shall investigate what's broken there, and then move on to the MKS-specific bug that was found initially.

DejitaruJin commented 2 years ago

In Marlin/src/core/serial.h, I am almost positive that #define _SELP_1(s) serial_print(F(s "\n")); is supposed to be #define _SELP_1(s) serial_println(F(s));. There's still plenty of errors to go, but the compiler's not mistaken when it says that's invalid syntax.

Edit: The remaining errors seem to be caused by the fact that DEBUG_ECHOLNPAIR_F, which is being given (string_literal, float_value, precision_int_literal), has been directly swapped with DEBUG_ECHOLNPGM, which is expecting all odd-numbered arguments to be string literals. I shall submit a PR shortly and then get to work on the MKS-specific bug.

github-actions[bot] commented 2 years ago

This issue has had no activity in the last 60 days. Please add a reply if you want to keep this issue active, otherwise it will be automatically closed within 10 days.

thisiskeithb commented 2 years ago

Fixed in https://github.com/MarlinFirmware/Marlin/pull/23601

github-actions[bot] commented 2 years ago

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.