Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] In 2.1.2, Ender-2: 'LCD_PINS_RS' was not declared in this scope #25204

Closed
1 task done
probonopd opened this issue Jan 7, 2023 · 14 comments
Closed
1 task done

Comments

@probonopd
Copy link

probonopd commented Jan 7, 2023

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

Could not build bugfix-2.1.x due to another issue. But could build 2.1.1 without issues.

Bug Description

Cannot compile Marlin 2.1.2 for Ender-2: 'LCD_PINS_RS' was not declared in this scope.

Marlin 2.1.1 works.

Bug Timeline

2.1.2

Expected behavior

Compiles.

Actual behavior

Compilation fails.

Compiling .pio/build/melzi_optimized/src/src/lcd/dogm/status_screen_DOGM.cpp.o
In file included from Marlin/src/lcd/dogm/../../inc/../pins/pins.h:319:0,
                 from Marlin/src/lcd/dogm/../../inc/MarlinConfig.h:34,
                 from Marlin/src/lcd/dogm/HAL_LCD_class_defines.h:24,
                 from Marlin/src/lcd/dogm/marlinui_DOGM.h:31,
                 from Marlin/src/lcd/dogm/marlinui_DOGM.cpp:42:
Marlin/src/lcd/dogm/marlinui_DOGM.cpp: In static member function 'static void MarlinUI::init_lcd()':
Marlin/src/lcd/dogm/../../inc/../pins/sanguino/pins_MELZI_CREALITY.h:82:38: error: 'LCD_PINS_RS' was not declared in this scope
   #define DOGLCD_CS                  LCD_PINS_RS
                                      ^
Marlin/src/lcd/dogm/marlinui_DOGM.h:231:23: note: in expansion of macro 'DOGLCD_CS'
     #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                      // HW-SPI
                       ^~~~~~~~~
Marlin/src/lcd/dogm/marlinui_DOGM.cpp:267:14: note: in expansion of macro 'U8G_PARAM'
     u8g.init(U8G_PARAM);
              ^~~~~~~~~
Marlin/src/lcd/dogm/../../inc/../pins/sanguino/pins_MELZI_CREALITY.h:82:38: note: suggested alternative: 'LCD_PINS_D4'
   #define DOGLCD_CS                  LCD_PINS_RS
                                      ^
Marlin/src/lcd/dogm/marlinui_DOGM.h:231:23: note: in expansion of macro 'DOGLCD_CS'
     #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                      // HW-SPI
                       ^~~~~~~~~
Marlin/src/lcd/dogm/marlinui_DOGM.cpp:267:14: note: in expansion of macro 'U8G_PARAM'
     u8g.init(U8G_PARAM);
              ^~~~~~~~~
*** [.pio/build/melzi_optimized/src/src/lcd/dogm/marlinui_DOGM.cpp.o] Error 1
========================= [FAILED] Took 39.47 seconds =========================

Environment      Status    Duration
---------------  --------  ------------
melzi_optimized  FAILED    00:00:39.470
==================== 1 failed, 0 succeeded in 00:00:39.470 ====================
Error: Process completed with exit code 1.

Steps to Reproduce

No response

Version of Marlin Firmware

2.1.2

Printer model

Creality Ender-2

Electronics

Stock

Add-ons

None

Bed Leveling

None

Your Slicer

None

Host Software

None

Don't forget to include

  • A ZIP file containing your Configuration.h and Configuration_adv.h.

Additional information & file uploads

My configuration can be seen at https://github.com/probonopd/marlin-builds/blob/main/customization/configuration/Creality/Ender-2

@ellensp
Copy link
Contributor

ellensp commented Jan 7, 2023

real Steps to Reproduce:

Set #define MOTHERBOARD BOARD_MELZI_CREALITY
and #define ENDER2_STOCKDISPLAY

You dont need all this other stuff complicating the issue

@Bob-the-Kuhn
Copy link
Contributor

What LCD are you using?

There was a change made so that those pins are defined only when the CR10_STOCKDISPLAY is enabled. This change was made in PR #25012.

If I set the LCD to ENDER2_STOCKDISPLAY then I get the errors you listed. ENDER2_STOCKDISPLAY is what is enabled in the Marlin example configuration for ENDER2.

As a short term work around you could make the following change to the pins_MELZI_CREALITY.h file:

  1. delete line 48 #if ENABLED(CR10_STOCKDISPLAY)
  2. add line 48 #if EITHER(CR10_STOCKDISPLAY, ENDER2_STOCKDISPLAY)

My configuration can be seen at https://github.com/probonopd/marlin-builds/blob/main/customization/configuration/Creality/Ender-2

I'm confused. That file has nothing to do with the standard Marlin. Where are you getting your source files and config files?

@probonopd
Copy link
Author

probonopd commented Jan 7, 2023

What LCD are you using?

I am using the stock display that came with the Ender-2.

I'm confused. That file has nothing to do with the standard Marlin. Where are you getting your source files and config files?

I am using the official Ender-2 configuration from https://github.com/MarlinFirmware/Configurations/tree/release-2.1.2/config/examples/Creality/Ender-2 and then apply my own (delta) changes on top of it using the commands in the file I had posted.

@ellensp
Copy link
Contributor

ellensp commented Jan 7, 2023

@Bob-the-Kuhn he scripted github to build it for him, using stock ender2 example conf, and then running his modify script to make configuration changes
The default ender 2 config also triggers it.

probonopd added a commit to probonopd/marlin-builds that referenced this issue Jan 7, 2023
@probonopd
Copy link
Author

probonopd commented Jan 7, 2023

After doing

# Workaround for https://github.com/MarlinFirmware/Marlin/issues/25204
sed -i -e 's|ENABLED(CR10_STOCKDISPLAY)|EITHER(CR10_STOCKDISPLAY, ENDER2_STOCKDISPLAY)|g' Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h

now I get:

Compiling .pio/build/melzi_optimized/src/src/lcd/dogm/status_screen_DOGM.cpp.o
In file included from Marlin/src/lcd/dogm/marlinui_DOGM.cpp:42:0:
Marlin/src/lcd/dogm/marlinui_DOGM.cpp: In static member function 'static void MarlinUI::init_lcd()':
Marlin/src/lcd/dogm/marlinui_DOGM.h:231:34: error: 'DOGLCD_A0' was not declared in this scope
     #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                      // HW-SPI
                                  ^
Marlin/src/lcd/dogm/marlinui_DOGM.cpp:267:14: note: in expansion of macro 'U8G_PARAM'
     u8g.init(U8G_PARAM);
              ^~~~~~~~~
Marlin/src/lcd/dogm/marlinui_DOGM.h:231:34: note: suggested alternative: 'DOGLCD_CS'
     #define U8G_PARAM DOGLCD_CS, DOGLCD_A0                      // HW-SPI
                                  ^
Marlin/src/lcd/dogm/marlinui_DOGM.cpp:267:14: note: in expansion of macro 'U8G_PARAM'
     u8g.init(U8G_PARAM);
              ^~~~~~~~~
*** [.pio/build/melzi_optimized/src/src/lcd/dogm/marlinui_DOGM.cpp.o] Error 1

@Bob-the-Kuhn
Copy link
Contributor

I screwed up. Now that I saved the ENDER2_STOCKDISPLAY config I get the same errors.

@Bob-the-Kuhn
Copy link
Contributor

I just got around to compiling 2.1.1 with the default ENDER2 configs. It compiled correctly.

There are two ways to get bugfix-2.1.x to compile:

  1. Comment out line 52 in pins_MELZI_CREALITY.h // #define LCD_PINS_DEFINED
  2. Restore the 2.1.1 version of line 142 in pins_SANGUINOLOLU_11.h:
  • 2.1.1: #if HAS_WIRED_LCD
  • bugfix-2.1.x: #if HAS_WIRED_LCD && DISABLED(LCD_PINS_DEFINED)

@Bob-the-Kuhn
Copy link
Contributor

I just compiled it with #define LCD_PINS_DEFINED commented out and set the LCD to CR10_STOCKDISPLAY. Now I get warnings that LCD_PINS_RS is being defined in two places.:

  • pins_MELZI_CREALITY.h line 50
  • pins_SANGUINOLOLU_11.h line167

Compiling with 2.1.1 and CR10_STOCKDISPLAY enabled. No warnings. Time to look further at the changes.

@Bob-the-Kuhn
Copy link
Contributor

Looks like the final fix is to keep LCD_PINS_DEFINED but add a couple more defines. No more warnings or errors and M43 shows that the pin/function assignments are the same as with 2.1.1.

  #define DOGLCD_CS                           LCD_PINS_RS
  #define DOGLCD_A0                           LCD_PINS_D4

Please try this file and see if your system works.

pins_MELZI_CREALITY.zip

probonopd added a commit to probonopd/marlin-builds that referenced this issue Jan 11, 2023
@probonopd
Copy link
Author

Thank you very much @Bob-the-Kuhn. Compilation succeeded, will test the firmware on the machine asap.

invisiblek added a commit to invisiblek/Marlin that referenced this issue Jan 15, 2023
invisiblek added a commit to invisiblek/Marlin that referenced this issue Jan 19, 2023
@ellensp
Copy link
Contributor

ellensp commented Jan 19, 2023

@probonopd how goes that testing?

@probonopd
Copy link
Author

Thanks for the ping @ellensp, my test was successful 👍

I think this can be merged.

@Bob-the-Kuhn
Copy link
Contributor

PR #25258 fixes this bug so this issue is being closed.

@github-actions
Copy link

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.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants