Skip to content

Commit 5b5f34b

Browse files
ellenspAndy-Big
authored andcommitted
🐛 Fix Ender-2 Stock LCD on MELZI_CREALITY (MarlinFirmware#25759)
1 parent 4b66383 commit 5b5f34b

File tree

1 file changed

+41
-34
lines changed

1 file changed

+41
-34
lines changed

Marlin/src/pins/sanguino/pins_MELZI_CREALITY.h

+41-34
Original file line numberDiff line numberDiff line change
@@ -45,54 +45,72 @@
4545
#define BOARD_ST7920_DELAY_3 125
4646
#endif
4747

48+
/**
49+
* EXP1 EXP1 as ENDER2 STOCKDISPLAY EXP1 as CR10 STOCKDISPLAY
50+
* ------ ------ ------
51+
* D27 | 1 2 | D16 SCK | 1 2 | BTN_E BEEPER_PIN | 1 2 | BTN_ENC
52+
* D11 | 3 4 | RESET BTN_EN1 | 3 4 | RESET BTN_EN1 | 3 4 | RESET
53+
* D10 5 6 | D30 BTN_EN2 5 6 | LCD_A0 BTN_EN2 5 6 | LCD_D4 (ST9720 CLK)
54+
* D28 | 7 8 | D17 LCD_CS | 7 8 | MOSI (ST9720 CS) LCD_RS | 7 8 | LCD_EN (ST9720 DAT)
55+
* GND | 9 10 | 5V GND | 9 10 | 5V GND | 9 10 | 5V
56+
* ------ ------ ------
57+
*/
58+
#define EXP1_01_PIN 27
59+
#define EXP1_02_PIN 16
60+
#define EXP1_03_PIN 11
61+
#define EXP1_04_PIN -1 // RESET
62+
#define EXP1_05_PIN 10
63+
#define EXP1_06_PIN 30
64+
#define EXP1_07_PIN 28
65+
#define EXP1_08_PIN 17
66+
4867
//
4968
// LCD / Controller
5069
//
5170
#if ANY(MKS_MINI_12864, CR10_STOCKDISPLAY, ENDER2_STOCKDISPLAY)
52-
#if EITHER(CR10_STOCKDISPLAY, ENDER2_STOCKDISPLAY)
53-
#define LCD_PINS_RS 28 // ST9720 CS
54-
#define LCD_PINS_EN 17 // ST9720 DAT
55-
#define LCD_PINS_D4 30 // ST9720 CLK
56-
#endif
57-
#if EITHER(MKS_MINI_12864, ENDER2_STOCKDISPLAY)
58-
#define DOGLCD_CS 28
59-
#define DOGLCD_A0 30
71+
#if ENABLED(MKS_MINI_12864)
72+
#ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
73+
#error "CAUTION! MKS_MINI_12864 on MELZI_CREALITY requires wiring modifications. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this warning.)"
74+
#endif
75+
#define DOGLCD_CS EXP1_07_PIN
76+
#define DOGLCD_A0 EXP1_06_PIN
77+
#elif ENABLED(CR10_STOCKDISPLAY)
78+
#define LCD_PINS_RS EXP1_07_PIN // ST9720 CS
79+
#define LCD_PINS_EN EXP1_08_PIN // ST9720 DAT
80+
#define LCD_PINS_D4 EXP1_06_PIN // ST9720 CLK
81+
#define BEEPER_PIN EXP1_01_PIN
82+
#elif ENABLED(ENDER2_STOCKDISPLAY)
83+
#define DOGLCD_CS EXP1_07_PIN
84+
#define DOGLCD_A0 EXP1_06_PIN
85+
#define DOGLCD_SCK EXP1_01_PIN
86+
#define DOGLCD_MOSI EXP1_08_PIN
87+
#define FORCE_SOFT_SPI
6088
#endif
61-
89+
#define BTN_ENC EXP1_02_PIN
90+
#define BTN_EN1 EXP1_03_PIN
91+
#define BTN_EN2 EXP1_05_PIN
6292
#define LCD_SDSS 31 // Controller's SD card
63-
64-
#define BTN_ENC 16
65-
#define BTN_EN1 11
66-
#define BTN_EN2 10
67-
#define BEEPER_PIN 27
68-
6993
#define LCD_PINS_DEFINED
70-
7194
#endif
7295

7396
#include "pins_MELZI.h" // ... SANGUINOLOLU_12 ... SANGUINOLOLU_11
7497

7598
#if ENABLED(BLTOUCH)
7699
#ifndef SERVO0_PIN
77-
#define SERVO0_PIN 27
100+
#define SERVO0_PIN EXP1_01_PIN
78101
#endif
79102
#if SERVO0_PIN == BEEPER_PIN
80103
#undef BEEPER_PIN
81104
#endif
82105
#elif HAS_FILAMENT_SENSOR
83106
#ifndef FIL_RUNOUT_PIN
84-
#define FIL_RUNOUT_PIN 27
107+
#define FIL_RUNOUT_PIN EXP1_01_PIN
85108
#endif
86109
#if FIL_RUNOUT_PIN == BEEPER_PIN
87110
#undef BEEPER_PIN
88111
#endif
89112
#endif
90113

91-
#if ENABLED(MINIPANEL)
92-
#undef DOGLCD_CS
93-
#define DOGLCD_CS LCD_PINS_RS
94-
#endif
95-
96114
/**
97115
PIN: 0 Port: B0 E0_DIR_PIN protected
98116
PIN: 1 Port: B1 E0_STEP_PIN protected
@@ -139,14 +157,3 @@
139157
PIN: 30 Port: A1 LCD_PINS_D4 Output = 1
140158
PIN: 31 Port: A0 SDSS Output = 1
141159
*/
142-
143-
/**
144-
* EXP1 Connector EXP1 as CR10 STOCKDISPLAY
145-
* ------ ------
146-
* PA4 | 1 2 | PC0 BEEPER_PIN | 1 2 | BTN_ENC
147-
* PD3 | 3 4 | RESET BTN_EN1 | 3 4 | RESET
148-
* PD2 5 6 | PA1 BTN_EN2 5 6 | LCD_D4 (ST9720 CLK)
149-
* PA3 | 7 8 | PC1 (ST9720 CS) LCD_RS | 7 8 | LCD_EN (ST9720 DAT)
150-
* GND | 9 10 | 5V GND | 9 10 | 5V
151-
* ------ ------
152-
*/

0 commit comments

Comments
 (0)