Skip to content

Commit f3fd9e2

Browse files
authored
🐛 Fix MKS TS35 with BTT SKR 1.3/1.4 (MarlinFirmware#26176)
1 parent b94a335 commit f3fd9e2

File tree

3 files changed

+133
-32
lines changed

3 files changed

+133
-32
lines changed

Marlin/src/HAL/LPC1768/tft/tft_spi.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,19 @@ void TFT_SPI::dataTransferBegin(uint16_t dataSize) {
5555
WRITE(TFT_CS_PIN, LOW);
5656
}
5757

58+
#ifdef TFT_DEFAULT_DRIVER
59+
#include "../../../lcd/tft_io/tft_ids.h"
60+
#endif
61+
5862
uint32_t TFT_SPI::getID() {
5963
uint32_t id;
6064
id = readID(LCD_READ_ID);
6165
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
6266
id = readID(LCD_READ_ID4);
67+
#ifdef TFT_DEFAULT_DRIVER
68+
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
69+
id = TFT_DEFAULT_DRIVER;
70+
#endif
6371
return id;
6472
}
6573

Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_3.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,10 @@
347347
#define TFT_CS_PIN EXP2_04_PIN
348348
#define TFT_DC_PIN EXP2_07_PIN
349349

350+
#define TFT_SCK_PIN EXP2_02_PIN
351+
#define TFT_MISO_PIN EXP2_01_PIN
352+
#define TFT_MOSI_PIN EXP2_06_PIN
353+
350354
#define TOUCH_CS_PIN EXP1_04_PIN
351355
#define TOUCH_SCK_PIN EXP1_05_PIN
352356
#define TOUCH_MISO_PIN EXP1_06_PIN
@@ -355,6 +359,10 @@
355359

356360
#elif ENABLED(MKS_TS35_V2_0)
357361

362+
#ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
363+
#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.)"
364+
#endif
365+
358366
/** ------ ------
359367
* BEEPER | 1 2 | BTN_ENC SPI1_MISO | 1 2 | SPI1_SCK
360368
* TFT_BKL / LCD_EN | 3 4 | TFT_RESET / LCD_RS BTN_EN1 | 3 4 | SPI1_CS
@@ -368,36 +376,36 @@
368376
#define TFT_DC_PIN EXP1_08_PIN
369377

370378
#define TFT_RESET_PIN EXP1_04_PIN
371-
372379
#define TFT_BACKLIGHT_PIN EXP1_03_PIN
373380

374-
#define TOUCH_BUTTONS_HW_SPI
375-
#define TOUCH_BUTTONS_HW_SPI_DEVICE 1
376-
377381
//#define TFT_RST_PIN EXP2_07_PIN
378382
#define TFT_SCK_PIN EXP2_02_PIN
379383
#define TFT_MISO_PIN EXP2_01_PIN
380384
#define TFT_MOSI_PIN EXP2_06_PIN
381385

382-
#define LCD_READ_ID 0xD3
383386
#define LCD_USE_DMA_SPI
384387

385388
#define TFT_BUFFER_WORDS 2400
386389

390+
#define TOUCH_CS_PIN EXP1_05_PIN
391+
#define TOUCH_INT_PIN EXP1_06_PIN
392+
#define TOUCH_BUTTONS_HW_SPI
393+
#define TOUCH_BUTTONS_HW_SPI_DEVICE 1
394+
387395
#endif
388396

389397
#if ENABLED(TFT_CLASSIC_UI)
390398
#ifndef TOUCH_CALIBRATION_X
391-
#define TOUCH_CALIBRATION_X -11386
399+
#define TOUCH_CALIBRATION_X -16794
392400
#endif
393401
#ifndef TOUCH_CALIBRATION_Y
394-
#define TOUCH_CALIBRATION_Y 8684
402+
#define TOUCH_CALIBRATION_Y 11000
395403
#endif
396404
#ifndef TOUCH_OFFSET_X
397-
#define TOUCH_OFFSET_X 689
405+
#define TOUCH_OFFSET_X 1024
398406
#endif
399407
#ifndef TOUCH_OFFSET_Y
400-
#define TOUCH_OFFSET_Y -273
408+
#define TOUCH_OFFSET_Y -352
401409
#endif
402410
#elif ENABLED(TFT_COLOR_UI)
403411
#ifndef TOUCH_CALIBRATION_X
@@ -515,14 +523,6 @@
515523

516524
#endif // HAS_WIRED_LCD
517525

518-
#if NEED_TOUCH_PINS
519-
#define TOUCH_CS_PIN EXP1_05_PIN
520-
#define TOUCH_SCK_PIN EXP2_02_PIN
521-
#define TOUCH_MOSI_PIN EXP2_06_PIN
522-
#define TOUCH_MISO_PIN EXP2_01_PIN
523-
#define TOUCH_INT_PIN EXP1_06_PIN
524-
#endif
525-
526526
/**
527527
* Special pins
528528
* P1_30 (37) (NOT 5V tolerant)

Marlin/src/pins/lpc1768/pins_BTT_SKR_V1_4.h

Lines changed: 108 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -395,26 +395,119 @@
395395
#define LCD_BACKLIGHT_PIN -1
396396

397397
#elif HAS_SPI_TFT // Config for Classic UI (emulated DOGM) and Color UI
398-
#define TFT_CS_PIN EXP1_07_PIN
399-
#define TFT_DC_PIN EXP1_08_PIN
398+
399+
#define SDCARD_CONNECTION ONBOARD
400+
401+
#define BEEPER_PIN EXP1_01_PIN
402+
403+
#define BTN_ENC EXP1_02_PIN
404+
#define BTN_EN1 EXP2_03_PIN
405+
#define BTN_EN2 EXP2_05_PIN
406+
400407
#define TFT_A0_PIN TFT_DC_PIN
401-
#define TFT_MISO_PIN EXP2_01_PIN
402-
#define TFT_BACKLIGHT_PIN EXP1_03_PIN
403-
#define TFT_RESET_PIN EXP1_04_PIN
404408

405-
#define LCD_USE_DMA_SPI
409+
#ifndef TFT_WIDTH
410+
#define TFT_WIDTH 480
411+
#endif
412+
#ifndef TFT_HEIGHT
413+
#define TFT_HEIGHT 320
414+
#endif
415+
416+
#if ENABLED(BTT_TFT35_SPI_V1_0)
417+
418+
/**
419+
* ------ ------
420+
* BEEPER | 1 2 | LCD-BTN MISO | 1 2 | CLK
421+
* T_MOSI | 3 4 | T_CS LCD-ENCA | 3 4 | TFTCS
422+
* T_CLK | 5 6 T_MISO LCD-ENCB | 5 6 MOSI
423+
* PENIRQ | 7 8 | F_CS RS | 7 8 | RESET
424+
* GND | 9 10 | VCC GND | 9 10 | NC
425+
* ------ ------
426+
* EXP1 EXP2
427+
*
428+
* 480x320, 3.5", SPI Display with Rotary Encoder.
429+
* Stock Display for the BIQU B1 SE Series.
430+
* Schematic: https://github.com/bigtreetech/TFT35-SPI/blob/master/v1/Hardware/BTT%20TFT35-SPI%20V1-SCH.pdf
431+
*/
432+
#define TFT_CS_PIN EXP2_04_PIN
433+
#define TFT_DC_PIN EXP2_07_PIN
434+
435+
#define TFT_SCK_PIN EXP2_02_PIN
436+
#define TFT_MISO_PIN EXP2_01_PIN
437+
#define TFT_MOSI_PIN EXP2_06_PIN
438+
439+
#define TOUCH_CS_PIN EXP1_04_PIN
440+
#define TOUCH_SCK_PIN EXP1_05_PIN
441+
#define TOUCH_MISO_PIN EXP1_06_PIN
442+
#define TOUCH_MOSI_PIN EXP1_03_PIN
443+
#define TOUCH_INT_PIN EXP1_07_PIN
444+
445+
#elif ENABLED(MKS_TS35_V2_0)
446+
447+
#ifndef NO_CONTROLLER_CUSTOM_WIRING_WARNING
448+
#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.)"
449+
#endif
450+
451+
/** ------ ------
452+
* BEEPER | 1 2 | BTN_ENC SPI1_MISO | 1 2 | SPI1_SCK
453+
* TFT_BKL / LCD_EN | 3 4 | TFT_RESET / LCD_RS BTN_EN1 | 3 4 | SPI1_CS
454+
* TOUCH_CS / LCD_D4 | 5 6 TOUCH_INT / LCD_D5 BTN_EN2 | 5 6 SPI1_MOSI
455+
* SPI1_CS / LCD_D6 | 7 8 | SPI1_RS / LCD_D7 SPI1_RS | 7 8 | RESET
456+
* GND | 9 10 | VCC GND | 9 10 | VCC
457+
* ------ ------
458+
* EXP1 EXP2
459+
*/
460+
#define TFT_CS_PIN EXP1_07_PIN
461+
#define TFT_DC_PIN EXP1_08_PIN
462+
463+
#define TFT_RESET_PIN EXP1_04_PIN
464+
#define TFT_BACKLIGHT_PIN EXP1_03_PIN
465+
466+
//#define TFT_RST_PIN EXP2_07_PIN
467+
#define TFT_SCK_PIN EXP2_02_PIN
468+
#define TFT_MISO_PIN EXP2_01_PIN
469+
#define TFT_MOSI_PIN EXP2_06_PIN
406470

407-
#define TOUCH_INT_PIN EXP1_06_PIN
408-
#define TOUCH_CS_PIN EXP1_05_PIN
409-
#define TOUCH_BUTTONS_HW_SPI
410-
#define TOUCH_BUTTONS_HW_SPI_DEVICE 1
471+
#define LCD_USE_DMA_SPI
411472

412-
// SPI 1
413-
#define SD_SCK_PIN EXP2_02_PIN
414-
#define SD_MISO_PIN EXP2_01_PIN
415-
#define SD_MOSI_PIN EXP2_06_PIN
473+
#define TFT_BUFFER_WORDS 2400
416474

417-
#define TFT_BUFFER_WORDS 2400
475+
#define TOUCH_CS_PIN EXP1_05_PIN
476+
#define TOUCH_INT_PIN EXP1_06_PIN
477+
#define TOUCH_BUTTONS_HW_SPI
478+
#define TOUCH_BUTTONS_HW_SPI_DEVICE 1
479+
480+
#endif
481+
482+
#if ENABLED(TFT_CLASSIC_UI)
483+
#ifndef TOUCH_CALIBRATION_X
484+
#define TOUCH_CALIBRATION_X -16794
485+
#endif
486+
#ifndef TOUCH_CALIBRATION_Y
487+
#define TOUCH_CALIBRATION_Y 11000
488+
#endif
489+
#ifndef TOUCH_OFFSET_X
490+
#define TOUCH_OFFSET_X 1024
491+
#endif
492+
#ifndef TOUCH_OFFSET_Y
493+
#define TOUCH_OFFSET_Y -352
494+
#endif
495+
496+
#elif ENABLED(TFT_COLOR_UI)
497+
#ifndef TOUCH_CALIBRATION_X
498+
#define TOUCH_CALIBRATION_X -16741
499+
#endif
500+
#ifndef TOUCH_CALIBRATION_Y
501+
#define TOUCH_CALIBRATION_Y 11258
502+
#endif
503+
#ifndef TOUCH_OFFSET_X
504+
#define TOUCH_OFFSET_X 1024
505+
#endif
506+
#ifndef TOUCH_OFFSET_Y
507+
#define TOUCH_OFFSET_Y -367
508+
#endif
509+
#define TFT_BUFFER_WORDS 2400
510+
#endif
418511

419512
#elif IS_TFTGLCD_PANEL
420513

0 commit comments

Comments
 (0)