From d66bc5cec2ac4844809bb50995e05a0d074240df Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 8 Oct 2020 16:59:54 -0500 Subject: [PATCH] Permit touch calibration override --- Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h | 16 +++- Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h | 38 ++++---- Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h | 40 +++++---- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h | 58 ++++++------- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h | 20 +++-- Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h | 87 ++++++++----------- .../src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h | 50 +++++------ 7 files changed, 151 insertions(+), 158 deletions(-) diff --git a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h index 6f9f4bcf6..08ab5c1f4 100644 --- a/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h +++ b/Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h @@ -303,10 +303,18 @@ // Emulated DOGM have xpt calibration values independent of display resolution #if ENABLED(SPI_GRAPHICAL_TFT) - #define XPT2046_X_CALIBRATION -11245 - #define XPT2046_Y_CALIBRATION 8629 - #define XPT2046_X_OFFSET 685 - #define XPT2046_Y_OFFSET -285 + #ifndef XPT2046_X_CALIBRATION + #define XPT2046_X_CALIBRATION -11245 + #endif + #ifdef XPT2046_Y_CALIBRATION + #define XPT2046_Y_CALIBRATION 8629 + #endif + #ifdef XPT2046_X_OFFSET + #define XPT2046_X_OFFSET 685 + #endif + #ifdef XPT2046_Y_OFFSET + #define XPT2046_Y_OFFSET -285 + #endif #endif #elif IS_TFTGLCD_PANEL diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h index 10c615e52..5d81d1eca 100644 --- a/Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D_V5.h @@ -105,8 +105,10 @@ #define FIL_RUNOUT_PIN PA15 // SPI Flash -#define SPI_FLASH_SIZE 0x200000 // 2MB #define HAS_SPI_FLASH 1 +#if HAS_SPI_FLASH + #define SPI_FLASH_SIZE 0x200000 // 2MB +#endif // SPI 2 #define W25QXX_CS_PIN PB12 @@ -146,38 +148,36 @@ #endif #if HAS_TFT_LVGL_UI - // LVGL - #define HAS_SPI_FLASH_FONT 1 #define HAS_GCODE_PREVIEW 1 #define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 0 #define HAS_LANG_SELECT_SCREEN 1 #define HAS_BAK_VIEW_IN_FLASH 0 #define HAS_LOGO_IN_FLASH 0 - - #define XPT2046_X_CALIBRATION -17181 - #define XPT2046_Y_CALIBRATION 11434 - #define XPT2046_X_OFFSET 501 - #define XPT2046_Y_OFFSET -9 - #elif ENABLED(TFT_480x320) - // Color UI - #define TFT_DRIVER ILI9488 #define TFT_BUFFER_SIZE 14400 - - #define XPT2046_X_CALIBRATION -17181 - #define XPT2046_Y_CALIBRATION 11434 - #define XPT2046_X_OFFSET 501 - #define XPT2046_Y_OFFSET -9 - #elif ENABLED(FSMC_GRAPHICAL_TFT) - // Emulated DOGM - #define GRAPHICAL_TFT_UPSCALE 3 +#endif + +#if EITHER(HAS_TFT_LVGL_UI, TFT_480x320) + #ifndef XPT2046_X_CALIBRATION + #define XPT2046_X_CALIBRATION -17181 + #endif + #ifndef XPT2046_Y_CALIBRATION + #define XPT2046_Y_CALIBRATION 11434 + #endif + #ifndef XPT2046_X_OFFSET + #define XPT2046_X_OFFSET 501 + #endif + #ifndef XPT2046_Y_OFFSET + #define XPT2046_Y_OFFSET -9 + #endif +#elif ENABLED(FSMC_GRAPHICAL_TFT) #ifndef XPT2046_X_CALIBRATION #define XPT2046_X_CALIBRATION -12316 #endif diff --git a/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h b/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h index f8f3225f3..e6c9b33a5 100644 --- a/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h +++ b/Marlin/src/pins/stm32f1/pins_CHITU3D_V6.h @@ -120,8 +120,10 @@ #endif // SPI Flash -#define SPI_FLASH_SIZE 0x200000 // 2MB #define HAS_SPI_FLASH 1 +#if HAS_SPI_FLASH + #define SPI_FLASH_SIZE 0x200000 // 2MB +#endif // SPI 2 #define W25QXX_CS_PIN PB12 @@ -158,36 +160,37 @@ #endif -// LVGL Configs #if HAS_TFT_LVGL_UI - + // LVGL #define HAS_SPI_FLASH_FONT 1 #define HAS_GCODE_PREVIEW 1 #define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 0 #define HAS_LANG_SELECT_SCREEN 1 #define HAS_BAK_VIEW_IN_FLASH 0 #define HAS_LOGO_IN_FLASH 0 - - #define XPT2046_X_CALIBRATION -17181 - #define XPT2046_Y_CALIBRATION 11434 - #define XPT2046_X_OFFSET 501 - #define XPT2046_Y_OFFSET -9 - -// Color UI Configs #elif ENABLED(TFT_480x320) - + // Color UI #define TFT_DRIVER ILI9488 #define TFT_BUFFER_SIZE 14400 - - #define XPT2046_X_CALIBRATION -17181 - #define XPT2046_Y_CALIBRATION 11434 - #define XPT2046_X_OFFSET 501 - #define XPT2046_Y_OFFSET -9 - -// Emulated DOGM #elif ENABLED(FSMC_GRAPHICAL_TFT) + // Emulated DOGM #define GRAPHICAL_TFT_UPSCALE 3 +#endif +#if EITHER(HAS_TFT_LVGL_UI, TFT_480x320) + #ifndef XPT2046_X_CALIBRATION + #define XPT2046_X_CALIBRATION -17181 + #endif + #ifndef XPT2046_Y_CALIBRATION + #define XPT2046_Y_CALIBRATION 11434 + #endif + #ifndef XPT2046_X_OFFSET + #define XPT2046_X_OFFSET 501 + #endif + #ifndef XPT2046_Y_OFFSET + #define XPT2046_Y_OFFSET -9 + #endif +#elif ENABLED(FSMC_GRAPHICAL_TFT) #ifndef XPT2046_X_CALIBRATION #define XPT2046_X_CALIBRATION -12316 #endif @@ -200,7 +203,6 @@ #ifndef XPT2046_Y_OFFSET #define XPT2046_Y_OFFSET -20 #endif - #endif // SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h index a530c89d2..d9ba4e3c4 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_E3P.h @@ -269,32 +269,8 @@ #endif -#if ENABLED(TFT_LVGL_UI_SPI) - - // LVGL - - #define XPT2046_X_CALIBRATION -17253 - #define XPT2046_Y_CALIBRATION 11579 - #define XPT2046_X_OFFSET 514 - #define XPT2046_Y_OFFSET -24 - -#elif ENABLED(SPI_GRAPHICAL_TFT) - +#if ENABLED(SPI_GRAPHICAL_TFT) // Emulated DOGM SPI - - #ifndef XPT2046_X_CALIBRATION - #define XPT2046_X_CALIBRATION -11386 - #endif - #ifndef XPT2046_Y_CALIBRATION - #define XPT2046_Y_CALIBRATION 8684 - #endif - #ifndef XPT2046_X_OFFSET - #define XPT2046_X_OFFSET 339 - #endif - #ifndef XPT2046_Y_OFFSET - #define XPT2046_Y_OFFSET -18 - #endif - #ifndef GRAPHICAL_TFT_UPSCALE #define GRAPHICAL_TFT_UPSCALE 3 #endif @@ -310,14 +286,36 @@ #define LCD_PINS_RS PC6 #elif ENABLED(TFT_480x320_SPI) + #define TFT_DRIVER ST7796 + #define TFT_BUFFER_SIZE 14400 +#endif + +#if EITHER(HAS_TFT_LVGL_UI, TFT_480x320_SPI) + #ifndef XPT2046_X_CALIBRATION #define XPT2046_X_CALIBRATION -17253 + #endif + #ifndef XPT2046_Y_CALIBRATION #define XPT2046_Y_CALIBRATION 11579 + #endif + #ifndef XPT2046_X_OFFSET #define XPT2046_X_OFFSET 514 + #endif + #ifndef XPT2046_Y_OFFSET #define XPT2046_Y_OFFSET -24 - - #define TFT_DRIVER ST7796 - #define TFT_BUFFER_SIZE 14400 - + #endif +#elif ENABLED(SPI_GRAPHICAL_TFT) + #ifndef XPT2046_X_CALIBRATION + #define XPT2046_X_CALIBRATION -11386 + #endif + #ifndef XPT2046_Y_CALIBRATION + #define XPT2046_Y_CALIBRATION 8684 + #endif + #ifndef XPT2046_X_OFFSET + #define XPT2046_X_OFFSET 339 + #endif + #ifndef XPT2046_Y_OFFSET + #define XPT2046_Y_OFFSET -18 + #endif #endif #if HAS_WIRED_LCD && !HAS_SPI_TFT @@ -364,8 +362,8 @@ #endif // HAS_WIRED_LCD && !HAS_SPI_TFT #define HAS_SPI_FLASH 1 -#define SPI_FLASH_SIZE 0x1000000 // 16MB #if HAS_SPI_FLASH + #define SPI_FLASH_SIZE 0x1000000 // 16MB #define W25QXX_CS_PIN PB12 #define W25QXX_MOSI_PIN PB15 #define W25QXX_MISO_PIN PB14 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h index b159ae3f4..2b099b3e9 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_MINI.h @@ -139,10 +139,20 @@ * If the screen stays white, disable 'LCD_RESET_PIN' * to let the bootloader init the screen. */ - #define XPT2046_X_CALIBRATION 12033 - #define XPT2046_Y_CALIBRATION -9047 - #define XPT2046_X_OFFSET -30 - #define XPT2046_Y_OFFSET 254 +#if ENABLED(TOUCH_SCREEN) + #ifndef XPT2046_X_CALIBRATION + #define XPT2046_X_CALIBRATION 12033 + #endif + #ifndef XPT2046_Y_CALIBRATION + #define XPT2046_Y_CALIBRATION -9047 + #endif + #ifndef XPT2046_X_OFFSET + #define XPT2046_X_OFFSET -30 + #endif + #ifndef XPT2046_Y_OFFSET + #define XPT2046_Y_OFFSET 254 + #endif +#endif #if ENABLED(FSMC_GRAPHICAL_TFT) @@ -191,8 +201,8 @@ #endif #define HAS_SPI_FLASH 1 -#define SPI_FLASH_SIZE 0x1000000 // 16MB #if HAS_SPI_FLASH + #define SPI_FLASH_SIZE 0x1000000 // 16MB #define W25QXX_CS_PIN PB12 // Flash chip-select #define W25QXX_MOSI_PIN PB15 #define W25QXX_MISO_PIN PB14 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h index e705b7b57..35909ed43 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO.h @@ -195,25 +195,8 @@ #define TOUCH_BUTTONS_HW_SPI_DEVICE 2 #endif -// LVGL Configs -#if ENABLED(TFT_LVGL_UI_FSMC) - - #ifndef XPT2046_X_CALIBRATION - #define XPT2046_X_CALIBRATION 17880 - #endif - #ifndef XPT2046_Y_CALIBRATION - #define XPT2046_Y_CALIBRATION -12234 - #endif - #ifndef XPT2046_X_OFFSET - #define XPT2046_X_OFFSET -45 - #endif - #ifndef XPT2046_Y_OFFSET - #define XPT2046_Y_OFFSET 349 - #endif - -// Emulated DOGM Configs -#elif ENABLED(FSMC_GRAPHICAL_TFT) - +#if ENABLED(FSMC_GRAPHICAL_TFT) + // Emulated DOGM #define DOGLCD_MOSI -1 // prevent redefine Conditionals_post.h #define DOGLCD_SCK -1 @@ -233,19 +216,6 @@ #define TFT_PIXEL_OFFSET_Y 32 #endif - #ifndef XPT2046_X_CALIBRATION - #define XPT2046_X_CALIBRATION 12149 - #endif - #ifndef XPT2046_Y_CALIBRATION - #define XPT2046_Y_CALIBRATION -8746 - #endif - #ifndef XPT2046_X_OFFSET - #define XPT2046_X_OFFSET -35 - #endif - #ifndef XPT2046_Y_OFFSET - #define XPT2046_Y_OFFSET 256 - #endif - #elif ENABLED(TFT_320x240) // TFT32/28 #define TFT_RESET_PIN PC6 #define TFT_BACKLIGHT_PIN PD13 @@ -256,19 +226,6 @@ #define FSMC_DMA_DEV DMA2 #define FSMC_DMA_CHANNEL DMA_CH5 - #ifndef XPT2046_X_CALIBRATION - #define XPT2046_X_CALIBRATION -12246 - #endif - #ifndef XPT2046_Y_CALIBRATION - #define XPT2046_Y_CALIBRATION 9453 - #endif - #ifndef XPT2046_X_OFFSET - #define XPT2046_X_OFFSET 360 - #endif - #ifndef XPT2046_Y_OFFSET - #define XPT2046_Y_OFFSET -22 - #endif - #define TOUCH_CS_PIN PA7 // SPI2_NSS #define TOUCH_SCK_PIN PB13 // SPI2_SCK #define TOUCH_MISO_PIN PB14 // SPI2_MISO @@ -285,6 +242,12 @@ #define ILI9341_COLOR_RGB #elif ENABLED(TFT_480x320) + #define TFT_DRIVER ILI9488 + #define TFT_BUFFER_SIZE 14400 + #define ILI9488_ORIENTATION ILI9488_MADCTL_MX | ILI9488_MADCTL_MV +#endif + +#if EITHER(TFT_LVGL_UI_FSMC, TFT_480x320) #ifndef XPT2046_X_CALIBRATION #define XPT2046_X_CALIBRATION 17880 #endif @@ -295,17 +258,39 @@ #define XPT2046_X_OFFSET -45 #endif #ifndef XPT2046_Y_OFFSET - #define XPT2046_Y_OFFSET 349 + #define XPT2046_Y_OFFSET 349 + #endif +#elif ENABLED(FSMC_GRAPHICAL_TFT) + #ifndef XPT2046_X_CALIBRATION + #define XPT2046_X_CALIBRATION 12149 + #endif + #ifndef XPT2046_Y_CALIBRATION + #define XPT2046_Y_CALIBRATION -8746 + #endif + #ifndef XPT2046_X_OFFSET + #define XPT2046_X_OFFSET -35 + #endif + #ifndef XPT2046_Y_OFFSET + #define XPT2046_Y_OFFSET 256 + #endif +#elif ENABLED(TFT_320x240) // TFT32/28 + #ifndef XPT2046_X_CALIBRATION + #define XPT2046_X_CALIBRATION -12246 + #endif + #ifndef XPT2046_Y_CALIBRATION + #define XPT2046_Y_CALIBRATION 9453 + #endif + #ifndef XPT2046_X_OFFSET + #define XPT2046_X_OFFSET 360 + #endif + #ifndef XPT2046_Y_OFFSET + #define XPT2046_Y_OFFSET -22 #endif - - #define TFT_DRIVER ILI9488 - #define TFT_BUFFER_SIZE 14400 - #define ILI9488_ORIENTATION ILI9488_MADCTL_MX | ILI9488_MADCTL_MV #endif #define HAS_SPI_FLASH 1 -#define SPI_FLASH_SIZE 0x1000000 // 16MB #if HAS_SPI_FLASH + #define SPI_FLASH_SIZE 0x1000000 // 16MB #define W25QXX_CS_PIN PB12 #define W25QXX_MOSI_PIN PB15 #define W25QXX_MISO_PIN PB14 diff --git a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h index 4e782649d..b40c66496 100644 --- a/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h +++ b/Marlin/src/pins/stm32f1/pins_MKS_ROBIN_NANO_V2.h @@ -281,32 +281,8 @@ #endif -#if ENABLED(TFT_LVGL_UI_SPI) - - // LVGL - - #define XPT2046_X_CALIBRATION -17253 - #define XPT2046_Y_CALIBRATION 11579 - #define XPT2046_X_OFFSET 514 - #define XPT2046_Y_OFFSET -24 - -#elif ENABLED(SPI_GRAPHICAL_TFT) - +#if ENABLED(SPI_GRAPHICAL_TFT) // Emulated DOGM SPI - - #ifndef XPT2046_X_CALIBRATION - #define XPT2046_X_CALIBRATION -11386 - #endif - #ifndef XPT2046_Y_CALIBRATION - #define XPT2046_Y_CALIBRATION 8684 - #endif - #ifndef XPT2046_X_OFFSET - #define XPT2046_X_OFFSET 339 - #endif - #ifndef XPT2046_Y_OFFSET - #define XPT2046_Y_OFFSET -18 - #endif - #ifndef GRAPHICAL_TFT_UPSCALE #define GRAPHICAL_TFT_UPSCALE 3 #endif @@ -322,6 +298,11 @@ #define LCD_PINS_RS PC6 #elif ENABLED(TFT_480x320_SPI) + #define TFT_DRIVER ST7796 + #define TFT_BUFFER_SIZE 14400 +#endif + +#if EITHER(TFT_LVGL_UI_SPI, TFT_480x320_SPI) #ifndef XPT2046_X_CALIBRATION #define XPT2046_X_CALIBRATION -17253 #endif @@ -334,10 +315,19 @@ #ifndef XPT2046_Y_OFFSET #define XPT2046_Y_OFFSET -24 #endif - - #define TFT_DRIVER ST7796 - #define TFT_BUFFER_SIZE 14400 - +#elif ENABLED(SPI_GRAPHICAL_TFT) + #ifndef XPT2046_X_CALIBRATION + #define XPT2046_X_CALIBRATION -11386 + #endif + #ifndef XPT2046_Y_CALIBRATION + #define XPT2046_Y_CALIBRATION 8684 + #endif + #ifndef XPT2046_X_OFFSET + #define XPT2046_X_OFFSET 339 + #endif + #ifndef XPT2046_Y_OFFSET + #define XPT2046_Y_OFFSET -18 + #endif #endif #if HAS_WIRED_LCD && !HAS_SPI_TFT @@ -393,8 +383,8 @@ #endif // HAS_WIRED_LCD && !HAS_SPI_TFT #define HAS_SPI_FLASH 1 -#define SPI_FLASH_SIZE 0x1000000 // 16MB #if HAS_SPI_FLASH + #define SPI_FLASH_SIZE 0x1000000 // 16MB #define W25QXX_CS_PIN PB12 #define W25QXX_MOSI_PIN PB15 #define W25QXX_MISO_PIN PB14