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

[BUG] Misleading pin names for config of `YHCB2004` display #25196

Closed bazarovdev closed 1 year ago

bazarovdev commented 1 year ago

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

Yes, and the problem still exists.

Bug Description

https://github.com/MarlinFirmware/Marlin/blob/2d162e0639f74b3a4e66e8c80081622e3215fe9d/Marlin/src/lcd/HD44780/marlinui_HD44780.h defines:

#elif ENABLED(YHCB2004)

  #include <LiquidCrystal_AIP31068_SPI.h>
  #define LCD_CLASS LiquidCrystal_AIP31068_SPI

#else

and then it is called:

#elif ENABLED(YHCB2004)

  LCD_CLASS lcd(YHCB2004_CLK, 20, 4, YHCB2004_MOSI, YHCB2004_MISO); // CLK, cols, rows, MOSI, MISO

but actual prototype of LiquidCrystal_AIP31068_SPI is:

LiquidCrystal_AIP31068_SPI(uint8_t ss_pin, uint8_t lcd_cols, uint8_t lcd_rows, uint8_t sclk_pin = SCK, uint8_t mosi_pin = MOSI, uint8_t miso_pin = MISO);

so it means actual pin functions are:

YHCB2004_CLK => ss_pin
YHCB2004_MOSI => sclk_pin
YHCB2004_MISO => mosi_pin

Bug Timeline

old

Expected behavior

the pins should be renamed to match actual functions

Actual behavior

pin named YHCB2004_CLK serves as CS (chip select or ss_pin) and on the other end true clock pin sclk_pin named as YHCB2004_MOSI in config.

Steps to Reproduce

No response

Version of Marlin Firmware

2.1.2

Printer model

No response

Electronics

No response

Add-ons

No response

Bed Leveling

None

Your Slicer

None

Host Software

None

Don't forget to include

Additional information & file uploads

https://github.com/MarlinFirmware/Marlin/blob/2d162e0639f74b3a4e66e8c80081622e3215fe9d/Marlin/src/pins/mega/pins_GT2560_V3.h

#if ENABLED(YHCB2004)
  #ifndef YHCB2004_CLK
    #define YHCB2004_CLK                       5
    #define DIO52                   YHCB2004_CLK
  #endif
  #ifndef YHCB2004_MOSI
    #define YHCB2004_MOSI                     21
    #define DIO50                  YHCB2004_MOSI
  #endif
  #ifndef YHCB2004_MISO
    #define YHCB2004_MISO                     36
    #define DIO51                  YHCB2004_MISO
  #endif

And all the route from config to display for Geeetech A10M with board v4.1b:

define in Marlin | Arduino # | AVR port | schematics NET| H2 pin | Reality

--|--|--|--|--|-- YHCB2004_CLK | 5 | E3 | LCM_D6 | 4 | CS YHCB2004_MOSI | 21 | D0 | LCM_D5 | 5 | CLK YHCB2004_MISO | 36 | C1 | LCM_D7 | 3 | MOSI BTN_EN1 | 16 | H1 | LCM_D4 | 7 | BTN_EN1 BTN_EN2 | 17 | H0 | LCM_EN | 8 | BTN_EN2 BTN_ENC | 19 | D2 | EC_PRESS | 9 | BTN_ENC ||||RESET|11 ||||BEEP|12 ||||V5|1 ||||GND|2,6,10

github-actions[bot] commented 1 year 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.

github-actions[bot] commented 1 year 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.