Skip to content

Commit b6ad680

Browse files
thinkyheadTracy Spiva
authored and
Tracy Spiva
committed
🩹 Fix TFT LVGL compile error (MarlinFirmware#25865)
Fixes regression from MarlinFirmware#24302
1 parent 9f65b74 commit b6ad680

27 files changed

+144
-119
lines changed

.github/workflows/test-builds.yml

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ jobs:
105105
- FYSETC_S6
106106
- LERDGEK
107107
- LERDGEX
108+
- mks_robin_pro2
108109
- Opulo_Lumen_REV3
109110
- rumba32
110111
- STM32F401RC_creality

Marlin/src/inc/SanityCheck.h

+2-4
Original file line numberDiff line numberDiff line change
@@ -2629,10 +2629,8 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L
26292629

26302630
#if ENABLED(TFT_GENERIC) && NONE(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI)
26312631
#error "TFT_GENERIC requires either TFT_INTERFACE_FSMC or TFT_INTERFACE_SPI interface."
2632-
#endif
2633-
2634-
#if BOTH(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI)
2635-
#error "Please enable only one of TFT_INTERFACE_SPI or TFT_INTERFACE_SPI."
2632+
#elif BOTH(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI)
2633+
#error "Please enable only one of TFT_INTERFACE_FSMC or TFT_INTERFACE_SPI."
26362634
#endif
26372635

26382636
#if defined(LCD_SCREEN_ROTATE) && LCD_SCREEN_ROTATE != 0 && LCD_SCREEN_ROTATE != 90 && LCD_SCREEN_ROTATE != 180 && LCD_SCREEN_ROTATE != 270

Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp

+4-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,10 @@ void tft_lvgl_init() {
138138
uint16_t usb_flash_loop = 1000;
139139
#if ENABLED(MULTI_VOLUME) && !HAS_SD_HOST_DRIVE
140140
SET_INPUT_PULLUP(SD_DETECT_PIN);
141-
card.changeMedia(IS_SD_INSERTED() ? &card.media_driver_sdcard : &card.media_driver_usbFlash);
141+
if (IS_SD_INSERTED())
142+
card.changeMedia(&card.media_driver_sdcard);
143+
else
144+
card.changeMedia(&card.media_driver_usbFlash);
142145
#endif
143146
do {
144147
card.media_driver_usbFlash.idle();

Marlin/src/pins/gd32f1/pins_TRIGORILLA_V006.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
//
123123
// SPI
124124
//
125-
#define SPI_DEVICE -1
125+
#define SPI_DEVICE -1 // Maple
126126
#define SCK_PIN -1
127127
#define MISO_PIN -1
128128
#define MOSI_PIN -1

Marlin/src/pins/linux/pins_RAMPS_LINUX.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -381,8 +381,8 @@
381381
#define TFT_CS_PIN 49
382382
#define TFT_DC_PIN 43
383383
#define TFT_SCK_PIN SD_SCK_PIN
384-
#define TFT_MOSI_PIN SD_MOSI_PIN
385384
#define TFT_MISO_PIN SD_MISO_PIN
385+
#define TFT_MOSI_PIN SD_MOSI_PIN
386386
#define LCD_USE_DMA_SPI
387387

388388
#define BTN_EN1 40
@@ -396,12 +396,12 @@
396396

397397
#define SPI_FLASH
398398
#if ENABLED(SPI_FLASH)
399-
#define SPI_DEVICE 1
399+
#define SPI_DEVICE 1 // Maple
400400
#define SPI_FLASH_SIZE 0x1000000 // 16MB
401401
#define SPI_FLASH_CS_PIN 31
402-
#define SPI_FLASH_MOSI_PIN SD_MOSI_PIN
403-
#define SPI_FLASH_MISO_PIN SD_MISO_PIN
404402
#define SPI_FLASH_SCK_PIN SD_SCK_PIN
403+
#define SPI_FLASH_MISO_PIN SD_MISO_PIN
404+
#define SPI_FLASH_MOSI_PIN SD_MOSI_PIN
405405
#endif
406406

407407
#define TFT_BUFFER_SIZE 0xFFFF

Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@
273273
#endif
274274

275275
#if SD_CONNECTION_IS(LCD)
276-
#define SPI_DEVICE 3
276+
#define SPI_DEVICE 3 // Maple
277277
#define SD_DETECT_PIN EXP2_07_PIN
278278
#define SD_SCK_PIN EXP2_02_PIN
279279
#define SD_MISO_PIN EXP2_01_PIN

Marlin/src/pins/stm32f1/pins_CHITU3D_common.h

+8-8
Original file line numberDiff line numberDiff line change
@@ -113,18 +113,18 @@
113113
#define FIL_RUNOUT_PIN PA15 // MT_DET
114114
#endif
115115

116-
// SPI Flash
116+
//
117+
// SPI Flash (SPI 2)
118+
//
117119
#define SPI_FLASH
118120
#if ENABLED(SPI_FLASH)
119121
#define SPI_FLASH_SIZE 0x200000 // 2MB
122+
#define SPI_FLASH_CS_PIN PB12
123+
#define SPI_FLASH_SCK_PIN PB13
124+
#define SPI_FLASH_MISO_PIN PB14
125+
#define SPI_FLASH_MOSI_PIN PB15
120126
#endif
121127

122-
// SPI 2
123-
#define SPI_FLASH_CS_PIN PB12
124-
#define SPI_FLASH_MOSI_PIN PB15
125-
#define SPI_FLASH_MISO_PIN PB14
126-
#define SPI_FLASH_SCK_PIN PB13
127-
128128
//
129129
// TFT with FSMC interface
130130
//
@@ -160,7 +160,7 @@
160160

161161
// SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available
162162
// so SPI2 is required.
163-
#define SPI_DEVICE 2
163+
#define SPI_DEVICE 2 // Maple
164164
#define SD_SCK_PIN PB13
165165
#define SD_MISO_PIN PB14
166166
#define SD_MOSI_PIN PB15

Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h

+10-6
Original file line numberDiff line numberDiff line change
@@ -60,22 +60,26 @@
6060

6161
//
6262
// SPI
63-
// Note: FLSun Hispeed (clone MKS_Robin_miniV2) board is using SPI2 interface.
63+
//
64+
#define SPI_DEVICE 2 // Maple
65+
66+
//
67+
// SD Card SPI
6468
//
6569
#define SD_SCK_PIN PB13 // SPI2
6670
#define SD_MISO_PIN PB14 // SPI2
6771
#define SD_MOSI_PIN PB15 // SPI2
68-
#define SPI_DEVICE 2
6972

73+
//
7074
// SPI Flash
75+
//
7176
#define SPI_FLASH
7277
#if ENABLED(SPI_FLASH)
73-
// SPI 2
78+
#define SPI_FLASH_SIZE 0x1000000 // 16MB
7479
#define SPI_FLASH_CS_PIN PB12 // SPI2_NSS / Flash chip-select
75-
#define SPI_FLASH_MOSI_PIN PB15
76-
#define SPI_FLASH_MISO_PIN PB14
7780
#define SPI_FLASH_SCK_PIN PB13
78-
#define SPI_FLASH_SIZE 0x1000000 // 16MB
81+
#define SPI_FLASH_MISO_PIN PB14
82+
#define SPI_FLASH_MOSI_PIN PB15
7983
#endif
8084

8185
//

Marlin/src/pins/stm32f1/pins_FLY_MINI.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@
152152
//
153153
#if HAS_WIRED_LCD
154154

155-
#define SPI_DEVICE 2
155+
#define SPI_DEVICE 2 // Maple
156156
#define SD_SS_PIN EXP2_04_PIN
157157
#define SD_SCK_PIN EXP2_02_PIN
158158
#define SD_MISO_PIN EXP2_01_PIN

Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@
280280
#endif
281281

282282
#if SD_CONNECTION_IS(LCD)
283-
#define SPI_DEVICE 3
283+
#define SPI_DEVICE 3 // Maple
284284
#define SD_DETECT_PIN EXP2_04_PIN
285285
#define SD_SCK_PIN EXP2_09_PIN
286286
#define SD_MISO_PIN EXP2_10_PIN

Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h

+46-46
Original file line numberDiff line numberDiff line change
@@ -35,18 +35,18 @@
3535

3636
#define BOARD_NO_NATIVE_USB
3737

38-
//#define DISABLE_DEBUG // We still want to debug with STLINK...
39-
#define DISABLE_JTAG // We free the jtag pins (PA15) but keep STLINK
40-
// Release PB4 (STEP_X_PIN) from JTAG NRST role.
38+
//#define DISABLE_DEBUG // Allow debug with STLINK...
39+
#define DISABLE_JTAG // We free the JTAG pins (PA15) but keep STLINK
40+
// Release PB4 (STEP_X_PIN) from JTAG NRST role.
4141
//
4242
// Limit Switches
4343
//
44-
#define X_MIN_PIN PC1 // pin 16
45-
#define X_MAX_PIN PC0 // pin 15 (Filament sensor on Alfawise setup)
46-
#define Y_MIN_PIN PC15 // pin 9
47-
#define Y_MAX_PIN PC14 // pin 8 (Unused in stock Alfawise setup)
48-
#define Z_MIN_PIN PE6 // pin 5 Standard Endstop or Z_Probe endstop function
49-
#define Z_MAX_PIN PE5 // pin 4 (Unused in stock Alfawise setup)
44+
#define X_MIN_PIN PC1
45+
#define X_MAX_PIN PC0 // (Filament sensor on Alfawise setup)
46+
#define Y_MIN_PIN PC15
47+
#define Y_MAX_PIN PC14 // (Unused in stock Alfawise setup)
48+
#define Z_MIN_PIN PE6 // Standard Endstop or Z_Probe endstop function
49+
#define Z_MAX_PIN PE5 // (Unused in stock Alfawise setup)
5050
// May be used for BLTouch Servo function on older variants (<= V08)
5151
#define ONBOARD_ENDSTOPPULLUPS
5252

@@ -60,35 +60,35 @@
6060
//
6161
// Steppers
6262
//
63-
#define X_ENABLE_PIN PB5 // pin 91
64-
#define X_STEP_PIN PB4 // pin 90
65-
#define X_DIR_PIN PB3 // pin 89
63+
#define X_ENABLE_PIN PB5
64+
#define X_STEP_PIN PB4
65+
#define X_DIR_PIN PB3
6666

67-
#define Y_ENABLE_PIN PB8 // pin 95
68-
#define Y_STEP_PIN PB7 // pin 93
69-
#define Y_DIR_PIN PB6 // pin 92
67+
#define Y_ENABLE_PIN PB8
68+
#define Y_STEP_PIN PB7
69+
#define Y_DIR_PIN PB6
7070

71-
#define Z_ENABLE_PIN PE1 // pin 98
72-
#define Z_STEP_PIN PE0 // pin 97
73-
#define Z_DIR_PIN PB9 // pin 96
71+
#define Z_ENABLE_PIN PE1
72+
#define Z_STEP_PIN PE0
73+
#define Z_DIR_PIN PB9
7474

75-
#define E0_ENABLE_PIN PE4 // pin 3
76-
#define E0_STEP_PIN PE3 // pin 2
77-
#define E0_DIR_PIN PE2 // pin 1
75+
#define E0_ENABLE_PIN PE4
76+
#define E0_STEP_PIN PE3
77+
#define E0_DIR_PIN PE2
7878

7979
//
8080
// Temperature Sensors
8181
//
82-
#define TEMP_0_PIN PA0 // pin 23 (Nozzle 100K/3950 thermistor)
83-
#define TEMP_BED_PIN PA1 // pin 24 (Hot Bed 100K/3950 thermistor)
82+
#define TEMP_0_PIN PA0 // (Nozzle 100K/3950 thermistor)
83+
#define TEMP_BED_PIN PA1 // (Hot Bed 100K/3950 thermistor)
8484

8585
//
8686
// Heaters / Fans
8787
//
88-
#define HEATER_0_PIN PD3 // pin 84 (Nozzle Heat Mosfet)
89-
#define HEATER_BED_PIN PA8 // pin 67 (Hot Bed Mosfet)
88+
#define HEATER_0_PIN PD3 // (Nozzle Heat Mosfet)
89+
#define HEATER_BED_PIN PA8 // (Hot Bed Mosfet)
9090

91-
#define FAN0_PIN PA15 // pin 77 (4cm Fan)
91+
#define FAN0_PIN PA15 // (4cm Fan)
9292

9393
#if TERN(MAPLE_STM32F1, ENABLED(FAN_SOFT_PWM), ENABLED(FAST_PWM_FAN)) && FAN_MIN_PWM < 5 // Required to avoid issues with heating or STLink
9494
#error "FAN_MIN_PWM must be 5 or higher." // Fan will not start in 1-30 range
@@ -104,10 +104,10 @@
104104
#endif
105105
#endif
106106

107-
//#define BEEPER_PIN PD13 // pin 60 (Servo PWM output 5V/GND on Board V0G+) made for BL-Touch sensor
107+
//#define BEEPER_PIN PD13 // (Servo PWM output 5V/GND on Board V0G+) made for BL-Touch sensor
108108
// Can drive a PC Buzzer, if connected between PWM and 5V pins
109109

110-
#define LED_PIN PC2 // pin 17
110+
#define LED_PIN PC2
111111

112112
// Longer3D board mosfets are passing by default
113113
// Avoid nozzle heat and fan start before serial init
@@ -136,14 +136,14 @@
136136
//
137137
#if HAS_FSMC_TFT
138138
#define LCD_USE_DMA_FSMC // Use DMA transfers to send data to the TFT
139-
#define FSMC_CS_PIN PD7 // pin 88 = FSMC_NE1
140-
#define FSMC_RS_PIN PD11 // pin 58 A16 Register. Only one address needed
139+
#define FSMC_CS_PIN PD7 // FSMC_NE1
140+
#define FSMC_RS_PIN PD11 // A16 Register. Only one address needed
141141

142142
#define TFT_CS_PIN FSMC_CS_PIN
143143
#define TFT_RS_PIN FSMC_RS_PIN
144144

145-
#define TFT_RESET_PIN PC4 // pin 33
146-
#define TFT_BACKLIGHT_PIN PD12 // pin 59
145+
#define TFT_RESET_PIN PC4
146+
#define TFT_BACKLIGHT_PIN PD12
147147
#define TFT_BACKLIGHT_PWM 150 // Brightness with alt. TIM4 chan 1 (1-255)
148148

149149
#define DOGLCD_MOSI -1 // Prevent auto-define by Conditionals_post.h
@@ -168,11 +168,11 @@
168168
* declared below.
169169
*/
170170
#if NEED_TOUCH_PINS
171-
#define TOUCH_CS_PIN PB12 // pin 51 SPI2_NSS
172-
#define TOUCH_SCK_PIN PB13 // pin 52
173-
#define TOUCH_MOSI_PIN PB14 // pin 53 (Inverted MOSI/MISO = No HW SPI2)
174-
#define TOUCH_MISO_PIN PB15 // pin 54
175-
#define TOUCH_INT_PIN PC6 // pin 63 (PenIRQ coming from ADS7843)
171+
#define TOUCH_CS_PIN PB12 // SPI2_NSS
172+
#define TOUCH_SCK_PIN PB13
173+
#define TOUCH_MISO_PIN PB15 // (Swapped MOSI/MISO = No HW SPI2)
174+
#define TOUCH_MOSI_PIN PB14
175+
#define TOUCH_INT_PIN PC6 // (PenIRQ coming from ADS7843)
176176
#endif
177177

178178
//
@@ -181,25 +181,25 @@
181181
//
182182
#if NO_EEPROM_SELECTED
183183
//#define SPI_EEPROM
184-
//#define SPI_FLASH // need MARLIN_DEV_MODE for M993/M994 EEPROM backup tests
184+
//#define SPI_FLASH // Use MARLIN_DEV_MODE for M993/M994 EEPROM backup tests
185185
#define FLASH_EEPROM_EMULATION
186186
#endif
187187

188188
#if ENABLED(SPI_EEPROM)
189189
// SPI1 EEPROM Winbond W25Q64 (8MB/64Mbits)
190190
#define SPI_CHAN_EEPROM1 1
191-
#define SPI_EEPROM1_CS_PIN PC5 // pin 34
192-
#define EEPROM_SCK_PIN BOARD_SPI1_SCK_PIN // PA5 pin 30
193-
#define EEPROM_MISO_PIN BOARD_SPI1_MISO_PIN // PA6 pin 31
194-
#define EEPROM_MOSI_PIN BOARD_SPI1_MOSI_PIN // PA7 pin 32
191+
#define SPI_EEPROM1_CS_PIN PC5
192+
#define EEPROM_SCK_PIN BOARD_SPI1_SCK_PIN // PA5
193+
#define EEPROM_MISO_PIN BOARD_SPI1_MISO_PIN // PA6
194+
#define EEPROM_MOSI_PIN BOARD_SPI1_MOSI_PIN // PA7
195195
#define EEPROM_PAGE_SIZE 0x1000U // 4K (from datasheet)
196-
#define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64K for now...
196+
#define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64K for now...
197197
#elif ENABLED(SPI_FLASH)
198-
#define SPI_FLASH_SIZE 0x40000U // limit to 256K (M993 will reboot with 512)
198+
#define SPI_FLASH_SIZE 0x40000U // Limit to 256K (M993 will reboot with 512)
199199
#define SPI_FLASH_CS_PIN PC5
200-
#define SPI_FLASH_MOSI_PIN PA7
201-
#define SPI_FLASH_MISO_PIN PA6
202200
#define SPI_FLASH_SCK_PIN PA5
201+
#define SPI_FLASH_MISO_PIN PA6
202+
#define SPI_FLASH_MOSI_PIN PA7
203203
#elif ENABLED(FLASH_EEPROM_EMULATION)
204204
// SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h)
205205
#define EEPROM_PAGE_SIZE (0x800U) // 2K

Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
#define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K
5959
#endif
6060

61-
#define SPI_DEVICE 2
61+
#define SPI_DEVICE 2 // Maple
6262

6363
//
6464
// Limit Switches

Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h

+3-3
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195

196196
// SPI2 is shared by LCD touch driver and flash
197197
// SPI1(PA7) & SPI3(PB5) not available
198-
#define SPI_DEVICE 2
198+
#define SPI_DEVICE 2 // Maple
199199

200200
#define ONBOARD_SDIO
201201
#define SDIO_CLOCK 4500000
@@ -274,7 +274,7 @@
274274
#if ENABLED(SPI_FLASH)
275275
#define SPI_FLASH_SIZE 0x800000 // 8MB
276276
#define SPI_FLASH_CS_PIN PG9
277-
#define SPI_FLASH_MOSI_PIN PB15
278-
#define SPI_FLASH_MISO_PIN PB14
279277
#define SPI_FLASH_SCK_PIN PB13
278+
#define SPI_FLASH_MISO_PIN PB14
279+
#define SPI_FLASH_MOSI_PIN PB15
280280
#endif

Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
#endif
5959

6060
//
61-
// Note: MKS Robin board is using SPI2 interface.
61+
// SPI
6262
//
63-
#define SPI_DEVICE 2
63+
#define SPI_DEVICE 2 // Maple
6464

6565
//
6666
// Servos
@@ -382,9 +382,9 @@
382382
#if ENABLED(SPI_FLASH)
383383
#define SPI_FLASH_SIZE 0x1000000 // 16MB
384384
#define SPI_FLASH_CS_PIN PB12
385-
#define SPI_FLASH_MOSI_PIN PB15
386-
#define SPI_FLASH_MISO_PIN PB14
387385
#define SPI_FLASH_SCK_PIN PB13
386+
#define SPI_FLASH_MISO_PIN PB14
387+
#define SPI_FLASH_MOSI_PIN PB15
388388
#endif
389389

390390
#ifndef BEEPER_PIN

Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@
253253
// SD Card
254254
//
255255
#define SDCARD_CONNECTION ONBOARD
256-
#define SPI_DEVICE 2
256+
#define SPI_DEVICE 2 // Maple
257257
#define ONBOARD_SPI_DEVICE 2
258258
#define SDSS SD_SS_PIN
259259
#define ONBOARD_SD_CS_PIN SD_SS_PIN

Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@
156156
//
157157
// SPI
158158
//
159-
#define SPI_DEVICE 2
159+
#define SPI_DEVICE 2 // Maple
160160
#define SD_SCK_PIN PB13
161161
#define SD_MISO_PIN PB14
162162
#define SD_MOSI_PIN PB15

0 commit comments

Comments
 (0)