diff --git a/Marlin/Configuration.h b/Marlin/Configuration.h index e90e90b146..9e1ee17939 100644 --- a/Marlin/Configuration.h +++ b/Marlin/Configuration.h @@ -2636,32 +2636,32 @@ */ // -// 480x320, 3.5", SPI Display From MKS -// Normally used in MKS Robin Nano V2 +// 480x320, 3.5", SPI Display with Rotary Encoder from MKS +// Usually paired with MKS Robin Nano V2 & V3 // //#define MKS_TS35_V2_0 // // 320x240, 2.4", FSMC Display From MKS -// Normally used in MKS Robin Nano V1.2 +// Usually paired with MKS Robin Nano V1.2 // //#define MKS_ROBIN_TFT24 // // 320x240, 2.8", FSMC Display From MKS -// Normally used in MKS Robin Nano V1.2 +// Usually paired with MKS Robin Nano V1.2 // //#define MKS_ROBIN_TFT28 // // 320x240, 3.2", FSMC Display From MKS -// Normally used in MKS Robin Nano V1.2 +// Usually paired with MKS Robin Nano V1.2 // //#define MKS_ROBIN_TFT32 // // 480x320, 3.5", FSMC Display From MKS -// Normally used in MKS Robin Nano V1.2 +// Usually paired with MKS Robin Nano V1.2 // //#define MKS_ROBIN_TFT35 @@ -2672,7 +2672,7 @@ // // 320x240, 3.2", FSMC Display From MKS -// Normally used in MKS Robin +// Usually paired with MKS Robin // //#define MKS_ROBIN_TFT_V1_1R @@ -2702,10 +2702,15 @@ //#define ANET_ET5_TFT35 // -// 1024x600, 7", RGB Stock Display from BIQU-BX +// 1024x600, 7", RGB Stock Display with Rotary Encoder from BIQU-BX // //#define BIQU_BX_TFT70 +// +// 480x320, 3.5", SPI Stock Display with Rotary Encoder from BIQU B1 SE Series +// +//#define BTT_TFT35_SPI_V1_0 + // // Generic TFT with detailed options // diff --git a/Marlin/src/core/macros.h b/Marlin/src/core/macros.h index 22c3767e1d..d8a15b910d 100644 --- a/Marlin/src/core/macros.h +++ b/Marlin/src/core/macros.h @@ -160,7 +160,7 @@ #endif -// Macros to chain up to 14 conditions +// Macros to chain up to 40 conditions #define _DO_1(W,C,A) (_##W##_1(A)) #define _DO_2(W,C,A,B) (_##W##_1(A) C _##W##_1(B)) #define _DO_3(W,C,A,V...) (_##W##_1(A) C _DO_2(W,C,V)) @@ -176,6 +176,31 @@ #define _DO_13(W,C,A,V...) (_##W##_1(A) C _DO_12(W,C,V)) #define _DO_14(W,C,A,V...) (_##W##_1(A) C _DO_13(W,C,V)) #define _DO_15(W,C,A,V...) (_##W##_1(A) C _DO_14(W,C,V)) +#define _DO_16(W,C,A,V...) (_##W##_1(A) C _DO_15(W,C,V)) +#define _DO_17(W,C,A,V...) (_##W##_1(A) C _DO_16(W,C,V)) +#define _DO_18(W,C,A,V...) (_##W##_1(A) C _DO_17(W,C,V)) +#define _DO_19(W,C,A,V...) (_##W##_1(A) C _DO_18(W,C,V)) +#define _DO_20(W,C,A,V...) (_##W##_1(A) C _DO_19(W,C,V)) +#define _DO_21(W,C,A,V...) (_##W##_1(A) C _DO_20(W,C,V)) +#define _DO_22(W,C,A,V...) (_##W##_1(A) C _DO_21(W,C,V)) +#define _DO_23(W,C,A,V...) (_##W##_1(A) C _DO_22(W,C,V)) +#define _DO_24(W,C,A,V...) (_##W##_1(A) C _DO_23(W,C,V)) +#define _DO_25(W,C,A,V...) (_##W##_1(A) C _DO_24(W,C,V)) +#define _DO_26(W,C,A,V...) (_##W##_1(A) C _DO_25(W,C,V)) +#define _DO_27(W,C,A,V...) (_##W##_1(A) C _DO_26(W,C,V)) +#define _DO_28(W,C,A,V...) (_##W##_1(A) C _DO_27(W,C,V)) +#define _DO_29(W,C,A,V...) (_##W##_1(A) C _DO_28(W,C,V)) +#define _DO_30(W,C,A,V...) (_##W##_1(A) C _DO_29(W,C,V)) +#define _DO_31(W,C,A,V...) (_##W##_1(A) C _DO_30(W,C,V)) +#define _DO_32(W,C,A,V...) (_##W##_1(A) C _DO_31(W,C,V)) +#define _DO_33(W,C,A,V...) (_##W##_1(A) C _DO_32(W,C,V)) +#define _DO_34(W,C,A,V...) (_##W##_1(A) C _DO_33(W,C,V)) +#define _DO_35(W,C,A,V...) (_##W##_1(A) C _DO_34(W,C,V)) +#define _DO_36(W,C,A,V...) (_##W##_1(A) C _DO_35(W,C,V)) +#define _DO_37(W,C,A,V...) (_##W##_1(A) C _DO_36(W,C,V)) +#define _DO_38(W,C,A,V...) (_##W##_1(A) C _DO_37(W,C,V)) +#define _DO_39(W,C,A,V...) (_##W##_1(A) C _DO_38(W,C,V)) +#define _DO_40(W,C,A,V...) (_##W##_1(A) C _DO_39(W,C,V)) #define __DO_N(W,C,N,V...) _DO_##N(W,C,V) #define _DO_N(W,C,N,V...) __DO_N(W,C,N,V) #define DO(W,C,V...) (_DO_N(W,C,NUM_ARGS(V),V)) @@ -251,6 +276,11 @@ memcpy(&a[0],&b[0],_MIN(sizeof(a),sizeof(b))); \ }while(0) +#define CODE_16( A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,...) A; B; C; D; E; F; G; H; I; J; K; L; M; N; O; P +#define CODE_15( A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,...) A; B; C; D; E; F; G; H; I; J; K; L; M; N; O +#define CODE_14( A,B,C,D,E,F,G,H,I,J,K,L,M,N,...) A; B; C; D; E; F; G; H; I; J; K; L; M; N +#define CODE_13( A,B,C,D,E,F,G,H,I,J,K,L,M,...) A; B; C; D; E; F; G; H; I; J; K; L; M +#define CODE_12( A,B,C,D,E,F,G,H,I,J,K,L,...) A; B; C; D; E; F; G; H; I; J; K; L #define CODE_11( A,B,C,D,E,F,G,H,I,J,K,...) A; B; C; D; E; F; G; H; I; J; K #define CODE_10( A,B,C,D,E,F,G,H,I,J,...) A; B; C; D; E; F; G; H; I; J #define CODE_9( A,B,C,D,E,F,G,H,I,...) A; B; C; D; E; F; G; H; I diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index b23e962a27..deeaecfb37 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1241,20 +1241,20 @@ * - TFT_COLOR * - GRAPHICAL_TFT_UPSCALE */ -#if ENABLED(MKS_TS35_V2_0) // ST7796 +#if EITHER(MKS_TS35_V2_0, BTT_TFT35_SPI_V1_0) // ST7796 #define TFT_DEFAULT_DRIVER ST7796 #define TFT_DEFAULT_ORIENTATION TFT_EXCHANGE_XY #define TFT_RES_480x320 #define TFT_INTERFACE_SPI -#elif EITHER(LERDGE_TFT35, ANET_ET5_TFT35) // ST7796 +#elif EITHER(LERDGE_TFT35, ANET_ET5_TFT35) // ST7796 #define TFT_DEFAULT_ORIENTATION TFT_EXCHANGE_XY #define TFT_RES_480x320 #define TFT_INTERFACE_FSMC -#elif ANY(ANET_ET4_TFT28, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32) // ST7789 +#elif ANY(ANET_ET4_TFT28, MKS_ROBIN_TFT24, MKS_ROBIN_TFT28, MKS_ROBIN_TFT32) // ST7789 #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y) #define TFT_RES_320x240 #define TFT_INTERFACE_FSMC -#elif ANY(MKS_ROBIN_TFT35, TFT_TRONXY_X5SA, ANYCUBIC_TFT35) // ILI9488 +#elif ANY(MKS_ROBIN_TFT35, TFT_TRONXY_X5SA, ANYCUBIC_TFT35) // ILI9488 #define TFT_DRIVER ILI9488 #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y) #define TFT_RES_480x320 @@ -1264,11 +1264,11 @@ #define TFT_DEFAULT_ORIENTATION 0 #define TFT_RES_480x272 #define TFT_INTERFACE_FSMC -#elif ANY(MKS_ROBIN_TFT_V1_1R, LONGER_LK_TFT28) // ILI9328 or R61505 +#elif ANY(MKS_ROBIN_TFT_V1_1R, LONGER_LK_TFT28) // ILI9328 or R61505 #define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y) #define TFT_RES_320x240 #define TFT_INTERFACE_FSMC -#elif ENABLED(BIQU_BX_TFT70) // RGB +#elif ENABLED(BIQU_BX_TFT70) // RGB #define TFT_DEFAULT_ORIENTATION TFT_EXCHANGE_XY #define TFT_RES_1024x600 #define TFT_INTERFACE_LTDC diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index d7d61fd6c1..edad7b5a95 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -2619,7 +2619,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS + COUNT_ENABLED(FYSETC_MINI_12864_X_X, FYSETC_MINI_12864_1_2, FYSETC_MINI_12864_2_0, FYSETC_MINI_12864_2_1, 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) \ + + 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) \ + COUNT_ENABLED(ZONESTAR_12864LCD, ZONESTAR_12864OLED, ZONESTAR_12864OLED_SSD1306) \ @@ -2669,7 +2669,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #undef IS_U8GLIB_SSD1306 #undef IS_EXTUI -#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) +#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) #error "TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI is required for your TFT. Please enable one." #elif MANY(TFT_COLOR_UI, TFT_CLASSIC_UI, TFT_LVGL_UI) @@ -2711,6 +2711,10 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS #error "Please select only one of CHIRON_TFT_STANDARD or CHIRON_TFT_NEW." #endif +#if EITHER(MKS_TS35_V2_0, BTT_TFT35_SPI_V1_0) && SD_CONNECTION_IS(LCD) + #error "SDCARD_CONNECTION cannot be set to LCD for the enabled TFT. No available SD card reader." +#endif + /** * Ender 3 V2 controller has some limitations */ diff --git a/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp b/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp index df7b4000a9..4a794f5000 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_tft_upscale_from_128x64.cpp @@ -78,13 +78,13 @@ TFT_IO tftio; #include "../marlinui.h" #endif -#if HAS_TOUCH_BUTTONS - #include "../touch/touch_buttons.h" - #if HAS_TOUCH_SLEEP - #define HAS_TOUCH_BUTTONS_SLEEP 1 - #endif +#if HAS_TOUCH_BUTTONS && HAS_TOUCH_SLEEP + #define HAS_TOUCH_BUTTONS_SLEEP 1 #endif +#include "../touch/touch_buttons.h" +#include "../scaled_tft.h" + #define X_HI (UPSCALE(TFT_PIXEL_OFFSET_X, WIDTH) - 1) #define Y_HI (UPSCALE(TFT_PIXEL_OFFSET_Y, HEIGHT) - 1) @@ -325,6 +325,7 @@ static bool preinit = true; static uint8_t page; #if HAS_TOUCH_BUTTONS + static bool redrawTouchButtons = true; static void drawTouchButtons(u8g_t *u8g, u8g_dev_t *dev) { if (!redrawTouchButtons) return; @@ -343,6 +344,7 @@ static uint8_t page; setWindow(u8g, dev, BUTTONC_X_LO, BUTTON_Y_LO, BUTTONC_X_HI, BUTTON_Y_HI); drawImage(buttonC, u8g, dev, BUTTON_DRAW_WIDTH, BUTTON_DRAW_HEIGHT, TFT_BTOKMENU_COLOR); } + #endif // HAS_TOUCH_BUTTONS static void u8g_upscale_clear_lcd(u8g_t *u8g, u8g_dev_t *dev, uint16_t *buffer) { @@ -395,7 +397,7 @@ uint8_t u8g_dev_tft_320x240_upscale_from_128x64_fn(u8g_t *u8g, u8g_dev_t *dev, u if (!sleepCleared) { sleepCleared = true; u8g_upscale_clear_lcd(u8g, dev, buffer); - IF_ENABLED(HAS_TOUCH_BUTTONS, redrawTouchButtons = true); + TERN_(HAS_TOUCH_BUTTONS, redrawTouchButtons = true); } break; } diff --git a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h index 4e11c73226..b8e687147b 100644 --- a/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h +++ b/Marlin/src/lcd/extui/ftdi_eve_touch_ui/ftdi_eve_lib/compat.h @@ -255,6 +255,34 @@ #define _DO_10(W,C,A,V...) (_##W##_1(A) C _DO_9(W,C,V)) #define _DO_11(W,C,A,V...) (_##W##_1(A) C _DO_10(W,C,V)) #define _DO_12(W,C,A,V...) (_##W##_1(A) C _DO_11(W,C,V)) + #define _DO_13(W,C,A,V...) (_##W##_1(A) C _DO_12(W,C,V)) + #define _DO_14(W,C,A,V...) (_##W##_1(A) C _DO_13(W,C,V)) + #define _DO_15(W,C,A,V...) (_##W##_1(A) C _DO_14(W,C,V)) + #define _DO_16(W,C,A,V...) (_##W##_1(A) C _DO_15(W,C,V)) + #define _DO_17(W,C,A,V...) (_##W##_1(A) C _DO_16(W,C,V)) + #define _DO_18(W,C,A,V...) (_##W##_1(A) C _DO_17(W,C,V)) + #define _DO_19(W,C,A,V...) (_##W##_1(A) C _DO_18(W,C,V)) + #define _DO_20(W,C,A,V...) (_##W##_1(A) C _DO_19(W,C,V)) + #define _DO_21(W,C,A,V...) (_##W##_1(A) C _DO_20(W,C,V)) + #define _DO_22(W,C,A,V...) (_##W##_1(A) C _DO_21(W,C,V)) + #define _DO_23(W,C,A,V...) (_##W##_1(A) C _DO_22(W,C,V)) + #define _DO_24(W,C,A,V...) (_##W##_1(A) C _DO_23(W,C,V)) + #define _DO_25(W,C,A,V...) (_##W##_1(A) C _DO_24(W,C,V)) + #define _DO_26(W,C,A,V...) (_##W##_1(A) C _DO_25(W,C,V)) + #define _DO_27(W,C,A,V...) (_##W##_1(A) C _DO_26(W,C,V)) + #define _DO_28(W,C,A,V...) (_##W##_1(A) C _DO_27(W,C,V)) + #define _DO_29(W,C,A,V...) (_##W##_1(A) C _DO_28(W,C,V)) + #define _DO_30(W,C,A,V...) (_##W##_1(A) C _DO_29(W,C,V)) + #define _DO_31(W,C,A,V...) (_##W##_1(A) C _DO_30(W,C,V)) + #define _DO_32(W,C,A,V...) (_##W##_1(A) C _DO_31(W,C,V)) + #define _DO_33(W,C,A,V...) (_##W##_1(A) C _DO_32(W,C,V)) + #define _DO_34(W,C,A,V...) (_##W##_1(A) C _DO_33(W,C,V)) + #define _DO_35(W,C,A,V...) (_##W##_1(A) C _DO_34(W,C,V)) + #define _DO_36(W,C,A,V...) (_##W##_1(A) C _DO_35(W,C,V)) + #define _DO_37(W,C,A,V...) (_##W##_1(A) C _DO_36(W,C,V)) + #define _DO_38(W,C,A,V...) (_##W##_1(A) C _DO_37(W,C,V)) + #define _DO_39(W,C,A,V...) (_##W##_1(A) C _DO_38(W,C,V)) + #define _DO_40(W,C,A,V...) (_##W##_1(A) C _DO_39(W,C,V)) #define __DO_N(W,C,N,V...) _DO_##N(W,C,V) #define _DO_N(W,C,N,V...) __DO_N(W,C,N,V) #define DO(W,C,V...) _DO_N(W,C,NUM_ARGS(V),V) diff --git a/Marlin/src/lcd/extui/mks_ui/SPIFlashStorage.cpp b/Marlin/src/lcd/extui/mks_ui/SPIFlashStorage.cpp index 2fb28415a1..6f2351bba6 100644 --- a/Marlin/src/lcd/extui/mks_ui/SPIFlashStorage.cpp +++ b/Marlin/src/lcd/extui/mks_ui/SPIFlashStorage.cpp @@ -27,6 +27,10 @@ #include "../../../inc/MarlinConfig.h" #include "SPIFlashStorage.h" +#if !HAS_SPI_FLASH + #error "HAS_SPI_FLASH is required with TFT_LVGL_UI." +#endif + extern W25QXXFlash W25QXX; uint8_t SPIFlashStorage::m_pageData[SPI_FLASH_PageSize]; diff --git a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h index 6717455692..3b7a4e4402 100644 --- a/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h +++ b/Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h @@ -69,14 +69,13 @@ // SPI Flash #define HAS_SPI_FLASH 1 -#define SPI_FLASH_SIZE 0x1000000 // 16MB - #if HAS_SPI_FLASH // SPI 2 #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 #endif // diff --git a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h index a05f4fb5b9..f5698be4f6 100644 --- a/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h +++ b/Marlin/src/pins/stm32f4/pins_BTT_SKR_V2_0_common.h @@ -495,6 +495,27 @@ #endif #endif +#if HAS_SPI_TFT + // + // e.g., BTT_TFT35_SPI_V1_0 (480x320, 3.5", SPI Stock Display with Rotary Encoder in BIQU B1 SE) + // + #define TFT_CS_PIN EXP2_07_PIN + #define TFT_A0_PIN EXP2_04_PIN + #define TFT_SCK_PIN EXP2_09_PIN + #define TFT_MISO_PIN EXP2_10_PIN + #define TFT_MOSI_PIN EXP2_05_PIN + + #define TOUCH_INT_PIN EXP1_04_PIN + #define TOUCH_MISO_PIN EXP1_05_PIN + #define TOUCH_MOSI_PIN EXP1_08_PIN + #define TOUCH_SCK_PIN EXP1_06_PIN + #define TOUCH_CS_PIN EXP1_07_PIN + + #define BTN_EN1 EXP2_08_PIN + #define BTN_EN2 EXP2_06_PIN + #define BTN_ENC EXP1_09_PIN +#endif + // // NeoPixel LED //