Skip to content

Commit

Permalink
🩹 Fix TFT LVGL compile error (MarlinFirmware#25865)
Browse files Browse the repository at this point in the history
Fixes regression from MarlinFirmware#24302
  • Loading branch information
thinkyhead authored and Andy-Big committed Jul 15, 2023
1 parent fca182f commit ca8a402
Show file tree
Hide file tree
Showing 27 changed files with 144 additions and 119 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ jobs:
- FYSETC_S6
- LERDGEK
- LERDGEX
- mks_robin_pro2
- Opulo_Lumen_REV3
- rumba32
- STM32F401RC_creality
Expand Down
6 changes: 2 additions & 4 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -2626,10 +2626,8 @@ static_assert(COUNT(arm) == LOGICAL_AXES, "AXIS_RELATIVE_MODES must contain " _L

#if ENABLED(TFT_GENERIC) && NONE(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI)
#error "TFT_GENERIC requires either TFT_INTERFACE_FSMC or TFT_INTERFACE_SPI interface."
#endif

#if BOTH(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI)
#error "Please enable only one of TFT_INTERFACE_SPI or TFT_INTERFACE_SPI."
#elif BOTH(TFT_INTERFACE_FSMC, TFT_INTERFACE_SPI)
#error "Please enable only one of TFT_INTERFACE_FSMC or TFT_INTERFACE_SPI."
#endif

#if defined(LCD_SCREEN_ROTATE) && LCD_SCREEN_ROTATE != 0 && LCD_SCREEN_ROTATE != 90 && LCD_SCREEN_ROTATE != 180 && LCD_SCREEN_ROTATE != 270
Expand Down
5 changes: 4 additions & 1 deletion Marlin/src/lcd/extui/mks_ui/tft_lvgl_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,10 @@ void tft_lvgl_init() {
uint16_t usb_flash_loop = 1000;
#if ENABLED(MULTI_VOLUME) && !HAS_SD_HOST_DRIVE
SET_INPUT_PULLUP(SD_DETECT_PIN);
card.changeMedia(IS_SD_INSERTED() ? &card.media_driver_sdcard : &card.media_driver_usbFlash);
if (IS_SD_INSERTED())
card.changeMedia(&card.media_driver_sdcard);
else
card.changeMedia(&card.media_driver_usbFlash);
#endif
do {
card.media_driver_usbFlash.idle();
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/gd32f1/pins_TRIGORILLA_V006.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
//
// SPI
//
#define SPI_DEVICE -1
#define SPI_DEVICE -1 // Maple
#define SCK_PIN -1
#define MISO_PIN -1
#define MOSI_PIN -1
Expand Down
8 changes: 4 additions & 4 deletions Marlin/src/pins/linux/pins_RAMPS_LINUX.h
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,8 @@
#define TFT_CS_PIN 49
#define TFT_DC_PIN 43
#define TFT_SCK_PIN SD_SCK_PIN
#define TFT_MOSI_PIN SD_MOSI_PIN
#define TFT_MISO_PIN SD_MISO_PIN
#define TFT_MOSI_PIN SD_MOSI_PIN
#define LCD_USE_DMA_SPI

#define BTN_EN1 40
Expand All @@ -396,12 +396,12 @@

#define SPI_FLASH
#if ENABLED(SPI_FLASH)
#define SPI_DEVICE 1
#define SPI_DEVICE 1 // Maple
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#define SPI_FLASH_CS_PIN 31
#define SPI_FLASH_MOSI_PIN SD_MOSI_PIN
#define SPI_FLASH_MISO_PIN SD_MISO_PIN
#define SPI_FLASH_SCK_PIN SD_SCK_PIN
#define SPI_FLASH_MISO_PIN SD_MISO_PIN
#define SPI_FLASH_MOSI_PIN SD_MOSI_PIN
#endif

#define TFT_BUFFER_SIZE 0xFFFF
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_BTT_SKR_MINI_V1_1.h
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@
#endif

#if SD_CONNECTION_IS(LCD)
#define SPI_DEVICE 3
#define SPI_DEVICE 3 // Maple
#define SD_DETECT_PIN EXP2_07_PIN
#define SD_SCK_PIN EXP2_02_PIN
#define SD_MISO_PIN EXP2_01_PIN
Expand Down
16 changes: 8 additions & 8 deletions Marlin/src/pins/stm32f1/pins_CHITU3D_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,18 +113,18 @@
#define FIL_RUNOUT_PIN PA15 // MT_DET
#endif

// SPI Flash
//
// SPI Flash (SPI 2)
//
#define SPI_FLASH
#if ENABLED(SPI_FLASH)
#define SPI_FLASH_SIZE 0x200000 // 2MB
#define SPI_FLASH_CS_PIN PB12
#define SPI_FLASH_SCK_PIN PB13
#define SPI_FLASH_MISO_PIN PB14
#define SPI_FLASH_MOSI_PIN PB15
#endif

// SPI 2
#define SPI_FLASH_CS_PIN PB12
#define SPI_FLASH_MOSI_PIN PB15
#define SPI_FLASH_MISO_PIN PB14
#define SPI_FLASH_SCK_PIN PB13

//
// TFT with FSMC interface
//
Expand Down Expand Up @@ -160,7 +160,7 @@

// SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available
// so SPI2 is required.
#define SPI_DEVICE 2
#define SPI_DEVICE 2 // Maple
#define SD_SCK_PIN PB13
#define SD_MISO_PIN PB14
#define SD_MOSI_PIN PB15
Expand Down
16 changes: 10 additions & 6 deletions Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,26 @@

//
// SPI
// Note: FLSun Hispeed (clone MKS_Robin_miniV2) board is using SPI2 interface.
//
#define SPI_DEVICE 2 // Maple

//
// SD Card SPI
//
#define SD_SCK_PIN PB13 // SPI2
#define SD_MISO_PIN PB14 // SPI2
#define SD_MOSI_PIN PB15 // SPI2
#define SPI_DEVICE 2

//
// SPI Flash
//
#define SPI_FLASH
#if ENABLED(SPI_FLASH)
// SPI 2
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#define SPI_FLASH_CS_PIN PB12 // SPI2_NSS / Flash chip-select
#define SPI_FLASH_MOSI_PIN PB15
#define SPI_FLASH_MISO_PIN PB14
#define SPI_FLASH_SCK_PIN PB13
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#define SPI_FLASH_MISO_PIN PB14
#define SPI_FLASH_MOSI_PIN PB15
#endif

//
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_FLY_MINI.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@
//
#if HAS_WIRED_LCD

#define SPI_DEVICE 2
#define SPI_DEVICE 2 // Maple
#define SD_SS_PIN EXP2_04_PIN
#define SD_SCK_PIN EXP2_02_PIN
#define SD_MISO_PIN EXP2_01_PIN
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@
#endif

#if SD_CONNECTION_IS(LCD)
#define SPI_DEVICE 3
#define SPI_DEVICE 3 // Maple
#define SD_DETECT_PIN EXP2_04_PIN
#define SD_SCK_PIN EXP2_09_PIN
#define SD_MISO_PIN EXP2_10_PIN
Expand Down
92 changes: 46 additions & 46 deletions Marlin/src/pins/stm32f1/pins_LONGER3D_LK.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@

#define BOARD_NO_NATIVE_USB

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

Expand All @@ -60,35 +60,35 @@
//
// Steppers
//
#define X_ENABLE_PIN PB5 // pin 91
#define X_STEP_PIN PB4 // pin 90
#define X_DIR_PIN PB3 // pin 89
#define X_ENABLE_PIN PB5
#define X_STEP_PIN PB4
#define X_DIR_PIN PB3

#define Y_ENABLE_PIN PB8 // pin 95
#define Y_STEP_PIN PB7 // pin 93
#define Y_DIR_PIN PB6 // pin 92
#define Y_ENABLE_PIN PB8
#define Y_STEP_PIN PB7
#define Y_DIR_PIN PB6

#define Z_ENABLE_PIN PE1 // pin 98
#define Z_STEP_PIN PE0 // pin 97
#define Z_DIR_PIN PB9 // pin 96
#define Z_ENABLE_PIN PE1
#define Z_STEP_PIN PE0
#define Z_DIR_PIN PB9

#define E0_ENABLE_PIN PE4 // pin 3
#define E0_STEP_PIN PE3 // pin 2
#define E0_DIR_PIN PE2 // pin 1
#define E0_ENABLE_PIN PE4
#define E0_STEP_PIN PE3
#define E0_DIR_PIN PE2

//
// Temperature Sensors
//
#define TEMP_0_PIN PA0 // pin 23 (Nozzle 100K/3950 thermistor)
#define TEMP_BED_PIN PA1 // pin 24 (Hot Bed 100K/3950 thermistor)
#define TEMP_0_PIN PA0 // (Nozzle 100K/3950 thermistor)
#define TEMP_BED_PIN PA1 // (Hot Bed 100K/3950 thermistor)

//
// Heaters / Fans
//
#define HEATER_0_PIN PD3 // pin 84 (Nozzle Heat Mosfet)
#define HEATER_BED_PIN PA8 // pin 67 (Hot Bed Mosfet)
#define HEATER_0_PIN PD3 // (Nozzle Heat Mosfet)
#define HEATER_BED_PIN PA8 // (Hot Bed Mosfet)

#define FAN0_PIN PA15 // pin 77 (4cm Fan)
#define FAN0_PIN PA15 // (4cm Fan)

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

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

#define LED_PIN PC2 // pin 17
#define LED_PIN PC2

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

#define TFT_CS_PIN FSMC_CS_PIN
#define TFT_RS_PIN FSMC_RS_PIN

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

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

//
Expand All @@ -181,25 +181,25 @@
//
#if NO_EEPROM_SELECTED
//#define SPI_EEPROM
//#define SPI_FLASH // need MARLIN_DEV_MODE for M993/M994 EEPROM backup tests
//#define SPI_FLASH // Use MARLIN_DEV_MODE for M993/M994 EEPROM backup tests
#define FLASH_EEPROM_EMULATION
#endif

#if ENABLED(SPI_EEPROM)
// SPI1 EEPROM Winbond W25Q64 (8MB/64Mbits)
#define SPI_CHAN_EEPROM1 1
#define SPI_EEPROM1_CS_PIN PC5 // pin 34
#define EEPROM_SCK_PIN BOARD_SPI1_SCK_PIN // PA5 pin 30
#define EEPROM_MISO_PIN BOARD_SPI1_MISO_PIN // PA6 pin 31
#define EEPROM_MOSI_PIN BOARD_SPI1_MOSI_PIN // PA7 pin 32
#define SPI_EEPROM1_CS_PIN PC5
#define EEPROM_SCK_PIN BOARD_SPI1_SCK_PIN // PA5
#define EEPROM_MISO_PIN BOARD_SPI1_MISO_PIN // PA6
#define EEPROM_MOSI_PIN BOARD_SPI1_MOSI_PIN // PA7
#define EEPROM_PAGE_SIZE 0x1000U // 4K (from datasheet)
#define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64K for now...
#define MARLIN_EEPROM_SIZE 16UL * (EEPROM_PAGE_SIZE) // Limit to 64K for now...
#elif ENABLED(SPI_FLASH)
#define SPI_FLASH_SIZE 0x40000U // limit to 256K (M993 will reboot with 512)
#define SPI_FLASH_SIZE 0x40000U // Limit to 256K (M993 will reboot with 512)
#define SPI_FLASH_CS_PIN PC5
#define SPI_FLASH_MOSI_PIN PA7
#define SPI_FLASH_MISO_PIN PA6
#define SPI_FLASH_SCK_PIN PA5
#define SPI_FLASH_MISO_PIN PA6
#define SPI_FLASH_MOSI_PIN PA7
#elif ENABLED(FLASH_EEPROM_EMULATION)
// SoC Flash (framework-arduinoststm32-maple/STM32F1/libraries/EEPROM/EEPROM.h)
#define EEPROM_PAGE_SIZE (0x800U) // 2K
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_MINGDA_MPX_ARM_MINI.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
#define MARLIN_EEPROM_SIZE EEPROM_PAGE_SIZE // 2K
#endif

#define SPI_DEVICE 2
#define SPI_DEVICE 2 // Maple

//
// Limit Switches
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@

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

#define ONBOARD_SDIO
#define SDIO_CLOCK 4500000
Expand Down Expand Up @@ -274,7 +274,7 @@
#if ENABLED(SPI_FLASH)
#define SPI_FLASH_SIZE 0x800000 // 8MB
#define SPI_FLASH_CS_PIN PG9
#define SPI_FLASH_MOSI_PIN PB15
#define SPI_FLASH_MISO_PIN PB14
#define SPI_FLASH_SCK_PIN PB13
#define SPI_FLASH_MISO_PIN PB14
#define SPI_FLASH_MOSI_PIN PB15
#endif
8 changes: 4 additions & 4 deletions Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@
#endif

//
// Note: MKS Robin board is using SPI2 interface.
// SPI
//
#define SPI_DEVICE 2
#define SPI_DEVICE 2 // Maple

//
// Servos
Expand Down Expand Up @@ -382,9 +382,9 @@
#if ENABLED(SPI_FLASH)
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#define SPI_FLASH_CS_PIN PB12
#define SPI_FLASH_MOSI_PIN PB15
#define SPI_FLASH_MISO_PIN PB14
#define SPI_FLASH_SCK_PIN PB13
#define SPI_FLASH_MISO_PIN PB14
#define SPI_FLASH_MOSI_PIN PB15
#endif

#ifndef BEEPER_PIN
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@
// SD Card
//
#define SDCARD_CONNECTION ONBOARD
#define SPI_DEVICE 2
#define SPI_DEVICE 2 // Maple
#define ONBOARD_SPI_DEVICE 2
#define SDSS SD_SS_PIN
#define ONBOARD_SD_CS_PIN SD_SS_PIN
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/pins/stm32f1/pins_MKS_ROBIN_LITE.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
//
// SPI
//
#define SPI_DEVICE 2
#define SPI_DEVICE 2 // Maple
#define SD_SCK_PIN PB13
#define SD_MISO_PIN PB14
#define SD_MOSI_PIN PB15
Expand Down
Loading

0 comments on commit ca8a402

Please sign in to comment.