Skip to content

[BUG] DWIN_CREALITY_LCD breaks MultiSerial #22299

@blazewicz

Description

@blazewicz

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

Yes, and the problem still exists.

Bug Description

Compilation with multiple serial ports while having DWIN_CREALITY_LCD enabled results in a cascade of errors similar to this one:

Marlin/src/HAL/STM32F1/../../inc/../HAL/./STM32F1/../../core/serial_hook.h:225:68: error: request for member 'write' in '((MultiSerial<BaseSerial<MarlinSerial>, int, 0>*)this)->MultiSerial<BaseSerial<MarlinSerial>, int, 0>::serial1', which is of non-class type 'int'

It happens because SERIAL_CATCHALL is set here to an integer:

#define SERIAL_CATCHALL 0

And here it is expected to be a compatible Serial class instance:

#define _SERIAL_LEAF_2 SERIAL_CATCHALL

I guess a simple fix like one below would help (it does compile).

--- a/Marlin/src/core/serial.h
+++ b/Marlin/src/core/serial.h
@@ -90,7 +90,7 @@ extern uint8_t marlin_debug_flags;
   #define SERIAL_ASSERT(P)    if(multiSerial.portMask!=(P)){ debugger(); }
   // If we have a catchall, use that directly
   #ifdef SERIAL_CATCHALL
-    #define _SERIAL_LEAF_2 SERIAL_CATCHALL
+    #define _SERIAL_LEAF_2 MSERIAL(SERIAL_CATCHALL)
   #elif HAS_ETHERNET
     typedef ConditionalSerial<decltype(MYSERIAL2)> SerialLeafT2;  // We need to create an instance here
     extern SerialLeafT2 msSerial2

Yet I'm not sure of the function on SERIAL_CATCHALL and how it should be defined properly.

@thinkyhead it seems you added it in #17719, I can't find any other reference nor documentation.

I think it got broken in #21306, but I'm not sure if it worked before.

Bug Timeline

No response

Expected behavior

No response

Actual behavior

No response

Steps to Reproduce

No response

Version of Marlin Firmware

bugfix-2.0.x

Printer model

No response

Electronics

No response

Add-ons

No response

Your Slicer

No response

Host Software

No response

Additional information & file uploads

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions