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

♻️ Separate LCD pins from board pins #25650

Open
wants to merge 12 commits into
base: bugfix-2.1.x
Choose a base branch
from
3 changes: 3 additions & 0 deletions .github/workflows/ci-validate-pins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ on:
#- 2.1.x
paths:
- 'Marlin/src/pins/*/**'
paths-ignore:
- 'Marlin/src/pins/lcd/**'

push:
branches:
- bugfix-2.1.x
Expand Down
76 changes: 75 additions & 1 deletion Marlin/src/inc/Conditionals-2-LCD.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@

#define IS_ULTIPANEL 1
#define U8GLIB_SSD1309
#define LCD_RESET_PIN LCD_PINS_D6 // This controller need a reset pin
#define STD_ENCODER_PULSES_PER_STEP 4
#define STD_ENCODER_STEPS_PER_MENU_ITEM 1
#ifndef PCA9632
Expand Down Expand Up @@ -881,3 +880,78 @@
#if LED_POWEROFF_TIMEOUT > 0
#define HAS_LED_POWEROFF_TIMEOUT 1
#endif

#define LCD_ENABLED_COUNT 0 \
+ ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) \
+ ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) \
+ (ENABLED(U8GLIB_SSD1306) && DISABLED(IS_U8GLIB_SSD1306)) \
+ (ENABLED(MINIPANEL) && NONE(MKS_MINI_12864, ENDER2_STOCKDISPLAY)) \
+ (ENABLED(MKS_MINI_12864) && NONE(MKS_LCD12864A, MKS_LCD12864B)) \
+ (ENABLED(FYSETC_MINI_12864_2_1) && NONE(MKS_MINI_12864_V3, BTT_MINI_12864, BEEZ_MINI_12864)) \
+ COUNT_ENABLED(MKS_MINI_12864_V3, BTT_MINI_12864, BEEZ_MINI_12864) \
+ (ENABLED(EXTENSIBLE_UI) && DISABLED(IS_EXTUI)) \
+ (DISABLED(IS_LEGACY_TFT) && ENABLED(TFT_GENERIC)) \
+ (ENABLED(IS_LEGACY_TFT) && COUNT_ENABLED(TFT_320x240, TFT_320x240_SPI, TFT_480x320, TFT_480x320_SPI)) \
+ COUNT_ENABLED(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_TFT35, ANYCUBIC_LCD_VYPER) \
+ DGUS_UI_IS(ORIGIN) + DGUS_UI_IS(FYSETC) + DGUS_UI_IS(HIPRECY) + DGUS_UI_IS(MKS) + DGUS_UI_IS(RELOADED) + DGUS_UI_IS(IA_CREALITY) \
+ COUNT_ENABLED(ENDER2_STOCKDISPLAY, CR10_STOCKDISPLAY) \
+ COUNT_ENABLED(DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE, SOVOL_SV06_RTS) \
+ COUNT_ENABLED(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_GENERIC_12864_1_1) \
+ COUNT_ENABLED(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) \
+ COUNT_ENABLED(MKS_12864OLED, MKS_12864OLED_SSD1306) \
+ COUNT_ENABLED(MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, \
MKS_ROBIN_TFT_V1_1R, ANET_ET4_TFT28, ANET_ET5_TFT35, BIQU_BX_TFT70, BTT_TFT35_SPI_V1_0) \
+ COUNT_ENABLED(TFTGLCD_PANEL_SPI, TFTGLCD_PANEL_I2C) \
+ COUNT_ENABLED(VIKI2, miniVIKI) \
+ ENABLED(WYH_L12864) \
+ COUNT_ENABLED(ZONESTAR_12864LCD, ZONESTAR_12864OLED, ZONESTAR_12864OLED_SSD1306) \
+ COUNT_ENABLED(ANET_FULL_GRAPHICS_LCD, CTC_A10S_A13) \
+ ENABLED(AZSMZ_12864) \
+ ENABLED(BQ_LCD_SMART_CONTROLLER) \
+ ENABLED(CARTESIO_UI) \
+ ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) \
+ ENABLED(FF_INTERFACEBOARD) \
+ ENABLED(FYSETC_242_OLED_12864) \
+ ENABLED(G3D_PANEL) \
+ ENABLED(LCD_FOR_MELZI) \
+ ENABLED(LCD_I2C_PANELOLU2) \
+ ENABLED(LCD_I2C_VIKI) \
+ ENABLED(LCM1602) \
+ ENABLED(LONGER_LK_TFT28) \
+ ENABLED(MAKEBOARD_MINI_2_LINE_DISPLAY_1602) \
+ ENABLED(MAKRPANEL) \
+ ENABLED(MALYAN_LCD) \
+ ENABLED(NEXTION_TFT) \
+ ENABLED(MKS_LCD12864A) \
+ ENABLED(MKS_LCD12864B) \
+ ENABLED(OLED_PANEL_TINYBOY2) \
+ ENABLED(OVERLORD_OLED) \
+ ENABLED(PANEL_ONE) \
+ ENABLED(RA_CONTROL_PANEL) \
+ ENABLED(RADDS_DISPLAY) \
+ ENABLED(REPRAPWORLD_GRAPHICAL_LCD) \
+ ENABLED(RIGIDBOT_PANEL) \
+ ENABLED(SAV_3DGLCD) \
+ ENABLED(SAV_3DLCD) \
+ ENABLED(SILVER_GATE_GLCD_CONTROLLER) \
+ ENABLED(TFT_TRONXY_X5SA) \
+ ENABLED(TOUCH_UI_FTDI_EVE) \
+ ENABLED(U8GLIB_SH1106_EINSTART) \
+ ENABLED(ULTI_CONTROLLER) \
+ ENABLED(ULTIMAKERCONTROLLER) \
+ ENABLED(ULTIPANEL) \
+ ENABLED(ULTRA_LCD) \
+ ENABLED(YHCB2004) \
+ ENABLED(ZONESTAR_LCD) \
+ ENABLED(K3D_FULL_GRAPHIC_SMART_CONTROLLER) \
+ ENABLED(K3D_242_OLED_CONTROLLER)

#if LCD_ENABLED_COUNT > 0
#define HAS_LCD_SELECTED 1
#if LCD_ENABLED_COUNT > 1
#error "Please select only one LCD controller option."
#endif
#endif
#undef LCD_ENABLED_COUNT
#undef IS_U8GLIB_SSD1306
#undef IS_EXTUI
76 changes: 3 additions & 73 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -2721,79 +2721,6 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
#endif
#endif

/**
* Make sure only one display is enabled
*/
#if 1 < 0 \
+ ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER) \
+ ENABLED(REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER) \
+ (ENABLED(U8GLIB_SSD1306) && DISABLED(IS_U8GLIB_SSD1306)) \
+ (ENABLED(MINIPANEL) && NONE(MKS_MINI_12864, ENDER2_STOCKDISPLAY)) \
+ (ENABLED(MKS_MINI_12864) && NONE(MKS_LCD12864A, MKS_LCD12864B)) \
+ (ENABLED(FYSETC_MINI_12864_2_1) && NONE(MKS_MINI_12864_V3, BTT_MINI_12864, BEEZ_MINI_12864)) \
+ COUNT_ENABLED(MKS_MINI_12864_V3, BTT_MINI_12864, BEEZ_MINI_12864) \
+ (ENABLED(EXTENSIBLE_UI) && DISABLED(IS_EXTUI)) \
+ (DISABLED(IS_LEGACY_TFT) && ENABLED(TFT_GENERIC)) \
+ (ENABLED(IS_LEGACY_TFT) && COUNT_ENABLED(TFT_320x240, TFT_320x240_SPI, TFT_480x320, TFT_480x320_SPI)) \
+ COUNT_ENABLED(ANYCUBIC_LCD_I3MEGA, ANYCUBIC_LCD_CHIRON, ANYCUBIC_TFT35, ANYCUBIC_LCD_VYPER) \
+ DGUS_UI_IS(ORIGIN) + DGUS_UI_IS(FYSETC) + DGUS_UI_IS(HIPRECY) + DGUS_UI_IS(MKS) + DGUS_UI_IS(RELOADED) + DGUS_UI_IS(IA_CREALITY) \
+ COUNT_ENABLED(ENDER2_STOCKDISPLAY, CR10_STOCKDISPLAY) \
+ COUNT_ENABLED(DWIN_CREALITY_LCD, DWIN_LCD_PROUI, DWIN_CREALITY_LCD_JYERSUI, DWIN_MARLINUI_PORTRAIT, DWIN_MARLINUI_LANDSCAPE, SOVOL_SV06_RTS) \
+ COUNT_ENABLED(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_GENERIC_12864_1_1) \
+ COUNT_ENABLED(LCD_SAINSMART_I2C_1602, LCD_SAINSMART_I2C_2004) \
+ COUNT_ENABLED(MKS_12864OLED, MKS_12864OLED_SSD1306) \
+ COUNT_ENABLED(MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, \
MKS_ROBIN_TFT_V1_1R, ANET_ET4_TFT28, ANET_ET5_TFT35, BIQU_BX_TFT70, BTT_TFT35_SPI_V1_0) \
+ COUNT_ENABLED(TFTGLCD_PANEL_SPI, TFTGLCD_PANEL_I2C) \
+ COUNT_ENABLED(VIKI2, miniVIKI) \
+ ENABLED(WYH_L12864) \
+ COUNT_ENABLED(ZONESTAR_12864LCD, ZONESTAR_12864OLED, ZONESTAR_12864OLED_SSD1306) \
+ COUNT_ENABLED(ANET_FULL_GRAPHICS_LCD, CTC_A10S_A13) \
+ ENABLED(AZSMZ_12864) \
+ ENABLED(BQ_LCD_SMART_CONTROLLER) \
+ ENABLED(CARTESIO_UI) \
+ ENABLED(ELB_FULL_GRAPHIC_CONTROLLER) \
+ ENABLED(FF_INTERFACEBOARD) \
+ ENABLED(FYSETC_242_OLED_12864) \
+ ENABLED(G3D_PANEL) \
+ ENABLED(LCD_FOR_MELZI) \
+ ENABLED(LCD_I2C_PANELOLU2) \
+ ENABLED(LCD_I2C_VIKI) \
+ ENABLED(LCM1602) \
+ ENABLED(LONGER_LK_TFT28) \
+ ENABLED(MAKEBOARD_MINI_2_LINE_DISPLAY_1602) \
+ ENABLED(MAKRPANEL) \
+ ENABLED(MALYAN_LCD) \
+ ENABLED(NEXTION_TFT) \
+ ENABLED(MKS_LCD12864A) \
+ ENABLED(MKS_LCD12864B) \
+ ENABLED(OLED_PANEL_TINYBOY2) \
+ ENABLED(OVERLORD_OLED) \
+ ENABLED(PANEL_ONE) \
+ ENABLED(RA_CONTROL_PANEL) \
+ ENABLED(RADDS_DISPLAY) \
+ ENABLED(REPRAPWORLD_GRAPHICAL_LCD) \
+ ENABLED(RIGIDBOT_PANEL) \
+ ENABLED(SAV_3DGLCD) \
+ ENABLED(SAV_3DLCD) \
+ ENABLED(SILVER_GATE_GLCD_CONTROLLER) \
+ ENABLED(TFT_TRONXY_X5SA) \
+ ENABLED(TOUCH_UI_FTDI_EVE) \
+ ENABLED(U8GLIB_SH1106_EINSTART) \
+ ENABLED(ULTI_CONTROLLER) \
+ ENABLED(ULTIMAKERCONTROLLER) \
+ ENABLED(ULTIPANEL) \
+ ENABLED(ULTRA_LCD) \
+ ENABLED(YHCB2004) \
+ ENABLED(ZONESTAR_LCD) \
+ ENABLED(K3D_FULL_GRAPHIC_SMART_CONTROLLER) \
+ ENABLED(K3D_242_OLED_CONTROLLER)
#error "Please select only one LCD controller option."
#endif

#undef IS_U8GLIB_SSD1306
#undef IS_EXTUI

/**
* Make sure LCD language settings are distinct
*/
Expand All @@ -2816,6 +2743,9 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
static_assert(strcmp(STRINGIFY(LCD_LANGUAGE_5), STRINGIFY(LCD_LANGUAGE_4)), "Error: LCD_LANGUAGE_5 (" STRINGIFY(LCD_LANGUAGE) ") cannot be the same as LCD_LANGUAGE_4.");
#endif

/**
* Check TFT Requirements
*/
#if ANY(TFT_GENERIC, MKS_TS35_V2_0, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32, MKS_ROBIN_TFT35, MKS_ROBIN_TFT43, MKS_ROBIN_TFT_V1_1R, \
TFT_TRONXY_X5SA, ANYCUBIC_TFT35, ANYCUBIC_TFT35, LONGER_LK_TFT28, ANET_ET4_TFT28, ANET_ET5_TFT35, BIQU_BX_TFT70, BTT_TFT35_SPI_V1_0)
#if NONE(TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI)
Expand Down
14 changes: 14 additions & 0 deletions Marlin/src/inc/Warnings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -932,3 +932,17 @@
#if ALL(PELTIER_BED, PIDTEMPBED)
#warning "PELTIER_BED with PIDTEMPBED requires extra circuitry. Use with caution."
#endif

/**
* Board and LCD have differently-keyed plugs
*/
#if HAS_LCD_SELECTED && ENABLED(EXP_REVERSE_KEYED) != ENABLED(LCD_REVERSE_KEYED)
#warning "CAUTION! The MOTHERBOARD and LCD have oppositely-keyed EXP plugs."
#endif

/**
* LCD Controller using old pin definition method
*/
#ifdef LCD_MIGRATION_WARNING
#warning "The selected LCD is not yet migrated to the new system."
#endif
59 changes: 28 additions & 31 deletions Marlin/src/pins/esp32/pins_MKS_TINYBEE.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@
#define EXP2_07_PIN 34
#define EXP2_08_PIN -1 // RESET

#define EXP_REVERSE_KEYED

//
// MicroSD card
//
Expand All @@ -164,41 +166,36 @@
#define SD_DETECT_PIN EXP2_07_PIN // IO34 default is SD_DET signal (Jump to SDDET)
#define USES_SHARED_SPI // SPI is shared by SD card with TMC SPI drivers

#if HAS_WIRED_LCD
#if ENABLED(MKS_MINI_12864)

// MKS MINI12864 / LCD12864B. For MKS LCD12864A remove the RPK2 resistor!

// Migrated to pins/lcd
#define LCD_RESET_PIN -1

#elif ENABLED(FYSETC_MINI_12864_2_1)

// Migrated to pins/lcd

#if SD_CONNECTION_IS(ONBOARD)
#define FORCE_SOFT_SPI
#endif
#if ALL(MKS_MINI_12864_V3, HAS_MEDIA)
#define PAUSE_LCD_FOR_BUSY_SD
#endif

#elif HAS_WIRED_LCD

#define BEEPER_PIN EXP1_01_PIN
#define LCD_PINS_EN EXP1_03_PIN
#define LCD_PINS_RS EXP1_04_PIN
#define BTN_ENC EXP1_02_PIN
#define BTN_EN1 EXP2_03_PIN
#define BTN_EN2 EXP2_05_PIN
#define LCD_BACKLIGHT_PIN -1

#if ENABLED(MKS_MINI_12864)
// MKS MINI12864 and MKS LCD12864B; If using MKS LCD12864A (Need to remove RPK2 resistor)
#define DOGLCD_CS EXP1_06_PIN
#define DOGLCD_A0 EXP1_07_PIN
#define LCD_RESET_PIN -1
#elif ENABLED(FYSETC_MINI_12864_2_1)
// MKS_MINI_12864_V3, BTT_MINI_12864, FYSETC_MINI_12864_2_1, BEEZ_MINI_12864
#define DOGLCD_CS EXP1_03_PIN
#define DOGLCD_A0 EXP1_04_PIN
#define LCD_RESET_PIN EXP1_05_PIN
#define NEOPIXEL_PIN EXP1_06_PIN
#if SD_CONNECTION_IS(ONBOARD)
#define FORCE_SOFT_SPI
#endif
#if ALL(MKS_MINI_12864_V3, HAS_MEDIA)
#define PAUSE_LCD_FOR_BUSY_SD
#endif
#else
#define LCD_PINS_D4 EXP1_05_PIN
#if ENABLED(REPRAP_DISCOUNT_SMART_CONTROLLER)
#define LCD_PINS_D5 EXP1_06_PIN
#define LCD_PINS_D6 EXP1_07_PIN
#define LCD_PINS_D7 EXP1_08_PIN
#endif
#define BOARD_ST7920_DELAY_1 96
#define BOARD_ST7920_DELAY_2 48
#define BOARD_ST7920_DELAY_3 600
#endif

#define LCD_PINS_D4 EXP1_05_PIN
#define BOARD_ST7920_DELAY_1 96
#define BOARD_ST7920_DELAY_2 48
#define BOARD_ST7920_DELAY_3 600

#endif // HAS_WIRED_LCD
37 changes: 12 additions & 25 deletions Marlin/src/pins/esp32/pins_MRR_ESPE.h
Original file line number Diff line number Diff line change
Expand Up @@ -127,33 +127,20 @@

#if HAS_WIRED_LCD

#define LCD_PINS_RS 13
#define LCD_PINS_EN 17
#define LCD_PINS_D4 16

#if ENABLED(CR10_STOCKDISPLAY)

#define BEEPER_PIN 151

#elif IS_RRD_FG_SC

#define BEEPER_PIN 151

//#define LCD_PINS_D5 150
//#define LCD_PINS_D6 152
//#define LCD_PINS_D7 153

#else

#error "Only CR10_STOCKDISPLAY and REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER are currently supported. Comment out this line to continue."

#define EXP1_01_PIN 151 // BEEPER
#define EXP1_02_PIN 14 // ENC
#define EXP1_03_PIN 0 // EN1
#define EXP1_04_PIN -1
#define EXP1_05_PIN 12 // EN2
#define EXP1_06_PIN 16 // D4
#define EXP1_07_PIN 13 // RS
#define EXP1_08_PIN 17 // EN

#if !IS_RRD_FG_SC
#error "Only REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER and compatible are currently supported. Comment out this line to continue."
#endif

#define BTN_EN1 0
#define BTN_EN2 12
#define BTN_ENC 14

#endif // HAS_MARLINUI_U8GLIB
#endif // HAS_WIRED_LCD

// Hardware serial pins
// Add the following to Configuration.h or Configuration_adv.h to assign
Expand Down
Loading