Permit touch calibration override

This commit is contained in:
Scott Lahteine 2020-10-08 16:59:54 -05:00
parent f72c559824
commit 854af7a4bf
7 changed files with 151 additions and 158 deletions

View file

@ -303,11 +303,19 @@
// Emulated DOGM have xpt calibration values independent of display resolution // Emulated DOGM have xpt calibration values independent of display resolution
#if ENABLED(SPI_GRAPHICAL_TFT) #if ENABLED(SPI_GRAPHICAL_TFT)
#ifndef XPT2046_X_CALIBRATION
#define XPT2046_X_CALIBRATION -11245 #define XPT2046_X_CALIBRATION -11245
#endif
#ifdef XPT2046_Y_CALIBRATION
#define XPT2046_Y_CALIBRATION 8629 #define XPT2046_Y_CALIBRATION 8629
#endif
#ifdef XPT2046_X_OFFSET
#define XPT2046_X_OFFSET 685 #define XPT2046_X_OFFSET 685
#endif
#ifdef XPT2046_Y_OFFSET
#define XPT2046_Y_OFFSET -285 #define XPT2046_Y_OFFSET -285
#endif #endif
#endif
#elif IS_TFTGLCD_PANEL #elif IS_TFTGLCD_PANEL

View file

@ -105,8 +105,10 @@
#define FIL_RUNOUT_PIN PA15 #define FIL_RUNOUT_PIN PA15
// SPI Flash // SPI Flash
#define SPI_FLASH_SIZE 0x200000 // 2MB
#define HAS_SPI_FLASH 1 #define HAS_SPI_FLASH 1
#if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x200000 // 2MB
#endif
// SPI 2 // SPI 2
#define W25QXX_CS_PIN PB12 #define W25QXX_CS_PIN PB12
@ -146,38 +148,36 @@
#endif #endif
#if HAS_TFT_LVGL_UI #if HAS_TFT_LVGL_UI
// LVGL // LVGL
#define HAS_SPI_FLASH_FONT 1 #define HAS_SPI_FLASH_FONT 1
#define HAS_GCODE_PREVIEW 1 #define HAS_GCODE_PREVIEW 1
#define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 0 #define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 0
#define HAS_LANG_SELECT_SCREEN 1 #define HAS_LANG_SELECT_SCREEN 1
#define HAS_BAK_VIEW_IN_FLASH 0 #define HAS_BAK_VIEW_IN_FLASH 0
#define HAS_LOGO_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) #elif ENABLED(TFT_480x320)
// Color UI // Color UI
#define TFT_DRIVER ILI9488 #define TFT_DRIVER ILI9488
#define TFT_BUFFER_SIZE 14400 #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) #elif ENABLED(FSMC_GRAPHICAL_TFT)
// Emulated DOGM // Emulated DOGM
#define GRAPHICAL_TFT_UPSCALE 3 #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 #ifndef XPT2046_X_CALIBRATION
#define XPT2046_X_CALIBRATION -12316 #define XPT2046_X_CALIBRATION -12316
#endif #endif

View file

@ -120,8 +120,10 @@
#endif #endif
// SPI Flash // SPI Flash
#define SPI_FLASH_SIZE 0x200000 // 2MB
#define HAS_SPI_FLASH 1 #define HAS_SPI_FLASH 1
#if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x200000 // 2MB
#endif
// SPI 2 // SPI 2
#define W25QXX_CS_PIN PB12 #define W25QXX_CS_PIN PB12
@ -158,36 +160,37 @@
#endif #endif
// LVGL Configs
#if HAS_TFT_LVGL_UI #if HAS_TFT_LVGL_UI
// LVGL
#define HAS_SPI_FLASH_FONT 1 #define HAS_SPI_FLASH_FONT 1
#define HAS_GCODE_PREVIEW 1 #define HAS_GCODE_PREVIEW 1
#define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 0 #define HAS_GCODE_DEFAULT_VIEW_IN_FLASH 0
#define HAS_LANG_SELECT_SCREEN 1 #define HAS_LANG_SELECT_SCREEN 1
#define HAS_BAK_VIEW_IN_FLASH 0 #define HAS_BAK_VIEW_IN_FLASH 0
#define HAS_LOGO_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) #elif ENABLED(TFT_480x320)
// Color UI
#define TFT_DRIVER ILI9488 #define TFT_DRIVER ILI9488
#define TFT_BUFFER_SIZE 14400 #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) #elif ENABLED(FSMC_GRAPHICAL_TFT)
// Emulated DOGM
#define GRAPHICAL_TFT_UPSCALE 3 #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 #ifndef XPT2046_X_CALIBRATION
#define XPT2046_X_CALIBRATION -12316 #define XPT2046_X_CALIBRATION -12316
#endif #endif
@ -200,7 +203,6 @@
#ifndef XPT2046_Y_OFFSET #ifndef XPT2046_Y_OFFSET
#define XPT2046_Y_OFFSET -20 #define XPT2046_Y_OFFSET -20
#endif #endif
#endif #endif
// SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available // SPI1(PA7)=LCD & SPI3(PB5)=STUFF, are not available

View file

@ -269,32 +269,8 @@
#endif #endif
#if ENABLED(TFT_LVGL_UI_SPI) #if ENABLED(SPI_GRAPHICAL_TFT)
// 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)
// Emulated DOGM SPI // 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 #ifndef GRAPHICAL_TFT_UPSCALE
#define GRAPHICAL_TFT_UPSCALE 3 #define GRAPHICAL_TFT_UPSCALE 3
#endif #endif
@ -310,14 +286,36 @@
#define LCD_PINS_RS PC6 #define LCD_PINS_RS PC6
#elif ENABLED(TFT_480x320_SPI) #elif ENABLED(TFT_480x320_SPI)
#define XPT2046_X_CALIBRATION -17253
#define XPT2046_Y_CALIBRATION 11579
#define XPT2046_X_OFFSET 514
#define XPT2046_Y_OFFSET -24
#define TFT_DRIVER ST7796 #define TFT_DRIVER ST7796
#define TFT_BUFFER_SIZE 14400 #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
#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 #endif
#if HAS_WIRED_LCD && !HAS_SPI_TFT #if HAS_WIRED_LCD && !HAS_SPI_TFT
@ -364,8 +362,8 @@
#endif // HAS_WIRED_LCD && !HAS_SPI_TFT #endif // HAS_WIRED_LCD && !HAS_SPI_TFT
#define HAS_SPI_FLASH 1 #define HAS_SPI_FLASH 1
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#if HAS_SPI_FLASH #if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#define W25QXX_CS_PIN PB12 #define W25QXX_CS_PIN PB12
#define W25QXX_MOSI_PIN PB15 #define W25QXX_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14 #define W25QXX_MISO_PIN PB14

View file

@ -139,10 +139,20 @@
* If the screen stays white, disable 'LCD_RESET_PIN' * If the screen stays white, disable 'LCD_RESET_PIN'
* to let the bootloader init the screen. * to let the bootloader init the screen.
*/ */
#if ENABLED(TOUCH_SCREEN)
#ifndef XPT2046_X_CALIBRATION
#define XPT2046_X_CALIBRATION 12033 #define XPT2046_X_CALIBRATION 12033
#endif
#ifndef XPT2046_Y_CALIBRATION
#define XPT2046_Y_CALIBRATION -9047 #define XPT2046_Y_CALIBRATION -9047
#endif
#ifndef XPT2046_X_OFFSET
#define XPT2046_X_OFFSET -30 #define XPT2046_X_OFFSET -30
#endif
#ifndef XPT2046_Y_OFFSET
#define XPT2046_Y_OFFSET 254 #define XPT2046_Y_OFFSET 254
#endif
#endif
#if ENABLED(FSMC_GRAPHICAL_TFT) #if ENABLED(FSMC_GRAPHICAL_TFT)
@ -191,8 +201,8 @@
#endif #endif
#define HAS_SPI_FLASH 1 #define HAS_SPI_FLASH 1
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#if HAS_SPI_FLASH #if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#define W25QXX_CS_PIN PB12 // Flash chip-select #define W25QXX_CS_PIN PB12 // Flash chip-select
#define W25QXX_MOSI_PIN PB15 #define W25QXX_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14 #define W25QXX_MISO_PIN PB14

View file

@ -195,25 +195,8 @@
#define TOUCH_BUTTONS_HW_SPI_DEVICE 2 #define TOUCH_BUTTONS_HW_SPI_DEVICE 2
#endif #endif
// LVGL Configs #if ENABLED(FSMC_GRAPHICAL_TFT)
#if ENABLED(TFT_LVGL_UI_FSMC) // Emulated DOGM
#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)
#define DOGLCD_MOSI -1 // prevent redefine Conditionals_post.h #define DOGLCD_MOSI -1 // prevent redefine Conditionals_post.h
#define DOGLCD_SCK -1 #define DOGLCD_SCK -1
@ -233,19 +216,6 @@
#define TFT_PIXEL_OFFSET_Y 32 #define TFT_PIXEL_OFFSET_Y 32
#endif #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 #elif ENABLED(TFT_320x240) // TFT32/28
#define TFT_RESET_PIN PC6 #define TFT_RESET_PIN PC6
#define TFT_BACKLIGHT_PIN PD13 #define TFT_BACKLIGHT_PIN PD13
@ -256,19 +226,6 @@
#define FSMC_DMA_DEV DMA2 #define FSMC_DMA_DEV DMA2
#define FSMC_DMA_CHANNEL DMA_CH5 #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_CS_PIN PA7 // SPI2_NSS
#define TOUCH_SCK_PIN PB13 // SPI2_SCK #define TOUCH_SCK_PIN PB13 // SPI2_SCK
#define TOUCH_MISO_PIN PB14 // SPI2_MISO #define TOUCH_MISO_PIN PB14 // SPI2_MISO
@ -285,6 +242,12 @@
#define ILI9341_COLOR_RGB #define ILI9341_COLOR_RGB
#elif ENABLED(TFT_480x320) #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 #ifndef XPT2046_X_CALIBRATION
#define XPT2046_X_CALIBRATION 17880 #define XPT2046_X_CALIBRATION 17880
#endif #endif
@ -297,15 +260,37 @@
#ifndef XPT2046_Y_OFFSET #ifndef XPT2046_Y_OFFSET
#define XPT2046_Y_OFFSET 349 #define XPT2046_Y_OFFSET 349
#endif #endif
#elif ENABLED(FSMC_GRAPHICAL_TFT)
#define TFT_DRIVER ILI9488 #ifndef XPT2046_X_CALIBRATION
#define TFT_BUFFER_SIZE 14400 #define XPT2046_X_CALIBRATION 12149
#define ILI9488_ORIENTATION ILI9488_MADCTL_MX | ILI9488_MADCTL_MV #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
#endif #endif
#define HAS_SPI_FLASH 1 #define HAS_SPI_FLASH 1
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#if HAS_SPI_FLASH #if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#define W25QXX_CS_PIN PB12 #define W25QXX_CS_PIN PB12
#define W25QXX_MOSI_PIN PB15 #define W25QXX_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14 #define W25QXX_MISO_PIN PB14

View file

@ -281,32 +281,8 @@
#endif #endif
#if ENABLED(TFT_LVGL_UI_SPI) #if ENABLED(SPI_GRAPHICAL_TFT)
// 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)
// Emulated DOGM SPI // 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 #ifndef GRAPHICAL_TFT_UPSCALE
#define GRAPHICAL_TFT_UPSCALE 3 #define GRAPHICAL_TFT_UPSCALE 3
#endif #endif
@ -322,6 +298,11 @@
#define LCD_PINS_RS PC6 #define LCD_PINS_RS PC6
#elif ENABLED(TFT_480x320_SPI) #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 #ifndef XPT2046_X_CALIBRATION
#define XPT2046_X_CALIBRATION -17253 #define XPT2046_X_CALIBRATION -17253
#endif #endif
@ -334,10 +315,19 @@
#ifndef XPT2046_Y_OFFSET #ifndef XPT2046_Y_OFFSET
#define XPT2046_Y_OFFSET -24 #define XPT2046_Y_OFFSET -24
#endif #endif
#elif ENABLED(SPI_GRAPHICAL_TFT)
#define TFT_DRIVER ST7796 #ifndef XPT2046_X_CALIBRATION
#define TFT_BUFFER_SIZE 14400 #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 #endif
#if HAS_WIRED_LCD && !HAS_SPI_TFT #if HAS_WIRED_LCD && !HAS_SPI_TFT
@ -393,8 +383,8 @@
#endif // HAS_WIRED_LCD && !HAS_SPI_TFT #endif // HAS_WIRED_LCD && !HAS_SPI_TFT
#define HAS_SPI_FLASH 1 #define HAS_SPI_FLASH 1
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#if HAS_SPI_FLASH #if HAS_SPI_FLASH
#define SPI_FLASH_SIZE 0x1000000 // 16MB
#define W25QXX_CS_PIN PB12 #define W25QXX_CS_PIN PB12
#define W25QXX_MOSI_PIN PB15 #define W25QXX_MOSI_PIN PB15
#define W25QXX_MISO_PIN PB14 #define W25QXX_MISO_PIN PB14