1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-30 15:26:18 +00:00

🐛 Fix MKS TS35 with BTT SKR 1.3/1.4 (#26176)

This commit is contained in:
ellensp 2023-12-12 14:30:28 +13:00 committed by GitHub
parent b94a335493
commit f3fd9e28f5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 133 additions and 32 deletions

View File

@ -55,11 +55,19 @@ void TFT_SPI::dataTransferBegin(uint16_t dataSize) {
WRITE(TFT_CS_PIN, LOW); WRITE(TFT_CS_PIN, LOW);
} }
#ifdef TFT_DEFAULT_DRIVER
#include "../../../lcd/tft_io/tft_ids.h"
#endif
uint32_t TFT_SPI::getID() { uint32_t TFT_SPI::getID() {
uint32_t id; uint32_t id;
id = readID(LCD_READ_ID); id = readID(LCD_READ_ID);
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF) if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
id = readID(LCD_READ_ID4); id = readID(LCD_READ_ID4);
#ifdef TFT_DEFAULT_DRIVER
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
id = TFT_DEFAULT_DRIVER;
#endif
return id; return id;
} }

View File

@ -347,6 +347,10 @@
#define TFT_CS_PIN EXP2_04_PIN #define TFT_CS_PIN EXP2_04_PIN
#define TFT_DC_PIN EXP2_07_PIN #define TFT_DC_PIN EXP2_07_PIN
#define TFT_SCK_PIN EXP2_02_PIN
#define TFT_MISO_PIN EXP2_01_PIN
#define TFT_MOSI_PIN EXP2_06_PIN
#define TOUCH_CS_PIN EXP1_04_PIN #define TOUCH_CS_PIN EXP1_04_PIN
#define TOUCH_SCK_PIN EXP1_05_PIN #define TOUCH_SCK_PIN EXP1_05_PIN
#define TOUCH_MISO_PIN EXP1_06_PIN #define TOUCH_MISO_PIN EXP1_06_PIN
@ -355,6 +359,10 @@
#elif ENABLED(MKS_TS35_V2_0) #elif ENABLED(MKS_TS35_V2_0)
#ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
#error "CAUTION! MKS_TS35_V2_0 requires wiring modifications. The SKR 1.3 EXP ports are rotated 180° from what the MKS_TS35_V2_0 expects. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this error.)"
#endif
/** ------ ------ /** ------ ------
* BEEPER | 1 2 | BTN_ENC SPI1_MISO | 1 2 | SPI1_SCK * BEEPER | 1 2 | BTN_ENC SPI1_MISO | 1 2 | SPI1_SCK
* TFT_BKL / LCD_EN | 3 4 | TFT_RESET / LCD_RS BTN_EN1 | 3 4 | SPI1_CS * TFT_BKL / LCD_EN | 3 4 | TFT_RESET / LCD_RS BTN_EN1 | 3 4 | SPI1_CS
@ -368,36 +376,36 @@
#define TFT_DC_PIN EXP1_08_PIN #define TFT_DC_PIN EXP1_08_PIN
#define TFT_RESET_PIN EXP1_04_PIN #define TFT_RESET_PIN EXP1_04_PIN
#define TFT_BACKLIGHT_PIN EXP1_03_PIN #define TFT_BACKLIGHT_PIN EXP1_03_PIN
#define TOUCH_BUTTONS_HW_SPI
#define TOUCH_BUTTONS_HW_SPI_DEVICE 1
//#define TFT_RST_PIN EXP2_07_PIN //#define TFT_RST_PIN EXP2_07_PIN
#define TFT_SCK_PIN EXP2_02_PIN #define TFT_SCK_PIN EXP2_02_PIN
#define TFT_MISO_PIN EXP2_01_PIN #define TFT_MISO_PIN EXP2_01_PIN
#define TFT_MOSI_PIN EXP2_06_PIN #define TFT_MOSI_PIN EXP2_06_PIN
#define LCD_READ_ID 0xD3
#define LCD_USE_DMA_SPI #define LCD_USE_DMA_SPI
#define TFT_BUFFER_WORDS 2400 #define TFT_BUFFER_WORDS 2400
#define TOUCH_CS_PIN EXP1_05_PIN
#define TOUCH_INT_PIN EXP1_06_PIN
#define TOUCH_BUTTONS_HW_SPI
#define TOUCH_BUTTONS_HW_SPI_DEVICE 1
#endif #endif
#if ENABLED(TFT_CLASSIC_UI) #if ENABLED(TFT_CLASSIC_UI)
#ifndef TOUCH_CALIBRATION_X #ifndef TOUCH_CALIBRATION_X
#define TOUCH_CALIBRATION_X -11386 #define TOUCH_CALIBRATION_X -16794
#endif #endif
#ifndef TOUCH_CALIBRATION_Y #ifndef TOUCH_CALIBRATION_Y
#define TOUCH_CALIBRATION_Y 8684 #define TOUCH_CALIBRATION_Y 11000
#endif #endif
#ifndef TOUCH_OFFSET_X #ifndef TOUCH_OFFSET_X
#define TOUCH_OFFSET_X 689 #define TOUCH_OFFSET_X 1024
#endif #endif
#ifndef TOUCH_OFFSET_Y #ifndef TOUCH_OFFSET_Y
#define TOUCH_OFFSET_Y -273 #define TOUCH_OFFSET_Y -352
#endif #endif
#elif ENABLED(TFT_COLOR_UI) #elif ENABLED(TFT_COLOR_UI)
#ifndef TOUCH_CALIBRATION_X #ifndef TOUCH_CALIBRATION_X
@ -515,14 +523,6 @@
#endif // HAS_WIRED_LCD #endif // HAS_WIRED_LCD
#if NEED_TOUCH_PINS
#define TOUCH_CS_PIN EXP1_05_PIN
#define TOUCH_SCK_PIN EXP2_02_PIN
#define TOUCH_MOSI_PIN EXP2_06_PIN
#define TOUCH_MISO_PIN EXP2_01_PIN
#define TOUCH_INT_PIN EXP1_06_PIN
#endif
/** /**
* Special pins * Special pins
* P1_30 (37) (NOT 5V tolerant) * P1_30 (37) (NOT 5V tolerant)

View File

@ -395,26 +395,119 @@
#define LCD_BACKLIGHT_PIN -1 #define LCD_BACKLIGHT_PIN -1
#elif HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI #elif HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI
#define TFT_CS_PIN EXP1_07_PIN
#define TFT_DC_PIN EXP1_08_PIN #define SDCARD_CONNECTION ONBOARD
#define BEEPER_PIN EXP1_01_PIN
#define BTN_ENC EXP1_02_PIN
#define BTN_EN1 EXP2_03_PIN
#define BTN_EN2 EXP2_05_PIN
#define TFT_A0_PIN TFT_DC_PIN #define TFT_A0_PIN TFT_DC_PIN
#define TFT_MISO_PIN EXP2_01_PIN
#define TFT_BACKLIGHT_PIN EXP1_03_PIN
#define TFT_RESET_PIN EXP1_04_PIN
#define LCD_USE_DMA_SPI #ifndef TFT_WIDTH
#define TFT_WIDTH 480
#endif
#ifndef TFT_HEIGHT
#define TFT_HEIGHT 320
#endif
#define TOUCH_INT_PIN EXP1_06_PIN #if ENABLED(BTT_TFT35_SPI_V1_0)
#define TOUCH_CS_PIN EXP1_05_PIN
#define TOUCH_BUTTONS_HW_SPI
#define TOUCH_BUTTONS_HW_SPI_DEVICE 1
// SPI 1 /**
#define SD_SCK_PIN EXP2_02_PIN * ------ ------
#define SD_MISO_PIN EXP2_01_PIN * BEEPER | 1 2 | LCD-BTN MISO | 1 2 | CLK
#define SD_MOSI_PIN EXP2_06_PIN * T_MOSI | 3 4 | T_CS LCD-ENCA | 3 4 | TFTCS
* T_CLK | 5 6 T_MISO LCD-ENCB | 5 6 MOSI
* PENIRQ | 7 8 | F_CS RS | 7 8 | RESET
* GND | 9 10 | VCC GND | 9 10 | NC
* ------ ------
* EXP1 EXP2
*
* 480x320, 3.5", SPI Display with Rotary Encoder.
* Stock Display for the BIQU B1 SE Series.
* Schematic: https://github.com/bigtreetech/TFT35-SPI/blob/master/v1/Hardware/BTT%20TFT35-SPI%20V1-SCH.pdf
*/
#define TFT_CS_PIN EXP2_04_PIN
#define TFT_DC_PIN EXP2_07_PIN
#define TFT_BUFFER_WORDS 2400 #define TFT_SCK_PIN EXP2_02_PIN
#define TFT_MISO_PIN EXP2_01_PIN
#define TFT_MOSI_PIN EXP2_06_PIN
#define TOUCH_CS_PIN EXP1_04_PIN
#define TOUCH_SCK_PIN EXP1_05_PIN
#define TOUCH_MISO_PIN EXP1_06_PIN
#define TOUCH_MOSI_PIN EXP1_03_PIN
#define TOUCH_INT_PIN EXP1_07_PIN
#elif ENABLED(MKS_TS35_V2_0)
#ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
#error "CAUTION! MKS_TS35_V2_0 requires wiring modifications. The SKR 1.4 EXP ports are rotated 180° from what the MKS_TS35_V2_0 expects. (Define NO_CONTROLLER_CUSTOM_WIRING_WARNING to suppress this error.)"
#endif
/** ------ ------
* BEEPER | 1 2 | BTN_ENC SPI1_MISO | 1 2 | SPI1_SCK
* TFT_BKL / LCD_EN | 3 4 | TFT_RESET / LCD_RS BTN_EN1 | 3 4 | SPI1_CS
* TOUCH_CS / LCD_D4 | 5 6 TOUCH_INT / LCD_D5 BTN_EN2 | 5 6 SPI1_MOSI
* SPI1_CS / LCD_D6 | 7 8 | SPI1_RS / LCD_D7 SPI1_RS | 7 8 | RESET
* GND | 9 10 | VCC GND | 9 10 | VCC
* ------ ------
* EXP1 EXP2
*/
#define TFT_CS_PIN EXP1_07_PIN
#define TFT_DC_PIN EXP1_08_PIN
#define TFT_RESET_PIN EXP1_04_PIN
#define TFT_BACKLIGHT_PIN EXP1_03_PIN
//#define TFT_RST_PIN EXP2_07_PIN
#define TFT_SCK_PIN EXP2_02_PIN
#define TFT_MISO_PIN EXP2_01_PIN
#define TFT_MOSI_PIN EXP2_06_PIN
#define LCD_USE_DMA_SPI
#define TFT_BUFFER_WORDS 2400
#define TOUCH_CS_PIN EXP1_05_PIN
#define TOUCH_INT_PIN EXP1_06_PIN
#define TOUCH_BUTTONS_HW_SPI
#define TOUCH_BUTTONS_HW_SPI_DEVICE 1
#endif
#if ENABLED(TFT_CLASSIC_UI)
#ifndef TOUCH_CALIBRATION_X
#define TOUCH_CALIBRATION_X -16794
#endif
#ifndef TOUCH_CALIBRATION_Y
#define TOUCH_CALIBRATION_Y 11000
#endif
#ifndef TOUCH_OFFSET_X
#define TOUCH_OFFSET_X 1024
#endif
#ifndef TOUCH_OFFSET_Y
#define TOUCH_OFFSET_Y -352
#endif
#elif ENABLED(TFT_COLOR_UI)
#ifndef TOUCH_CALIBRATION_X
#define TOUCH_CALIBRATION_X -16741
#endif
#ifndef TOUCH_CALIBRATION_Y
#define TOUCH_CALIBRATION_Y 11258
#endif
#ifndef TOUCH_OFFSET_X
#define TOUCH_OFFSET_X 1024
#endif
#ifndef TOUCH_OFFSET_Y
#define TOUCH_OFFSET_Y -367
#endif
#define TFT_BUFFER_WORDS 2400
#endif
#elif IS_TFTGLCD_PANEL #elif IS_TFTGLCD_PANEL