🩹 Fallback ID for MKS TS35 V2.0 (#22031)

This commit is contained in:
ellensp 2021-06-06 21:21:14 +12:00 committed by Scott Lahteine
parent c515bfb5fb
commit 76d4a395d1
6 changed files with 109 additions and 55 deletions

View File

@ -125,12 +125,20 @@ void TFT_SPI::DataTransferBegin(uint16_t DataSize) {
WRITE(TFT_CS_PIN, LOW);
}
#ifdef TFT_DEFAULT_DRIVER
#include "../../../lcd/tft_io/tft_ids.h"
#endif
uint32_t TFT_SPI::GetID() {
uint32_t 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);
#ifdef TFT_DEFAULT_DRIVER
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
id = TFT_DEFAULT_DRIVER;
#endif
}
return id;
}

View File

@ -90,12 +90,20 @@ void TFT_SPI::DataTransferBegin(uint16_t DataSize) {
TFT_CS_L;
}
#ifdef TFT_DEFAULT_DRIVER
#include "../../../lcd/tft_io/tft_ids.h"
#endif
uint32_t TFT_SPI::GetID() {
uint32_t 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);
#ifdef TFT_DEFAULT_DRIVER
if ((id & 0xFFFF) == 0 || (id & 0xFFFF) == 0xFFFF)
id = TFT_DEFAULT_DRIVER;
#endif
}
return id;
}

View File

@ -1166,29 +1166,38 @@
* - TFT_COLOR
* - GRAPHICAL_TFT_UPSCALE
*/
#if ENABLED(MKS_TS35_V2_0) // Most common: ST7796
#if ENABLED(MKS_TS35_V2_0) // ST7796
#define TFT_DEFAULT_DRIVER ST7796
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY)
#define TFT_RES_480x320
#define TFT_INTERFACE_SPI
#elif ENABLED(MKS_ROBIN_TFT24) // Most common: ST7789
#elif ENABLED(ANET_ET5_TFT35) // ST7796
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY)
#define TFT_RES_480x320
#define TFT_INTERFACE_FSMC
#elif ENABLED(ANET_ET4_TFT28) // ST7789
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y)
#define TFT_RES_320x240
#define TFT_INTERFACE_FSMC
#elif ENABLED(MKS_ROBIN_TFT28) // Most common: ST7789
#elif ENABLED(MKS_ROBIN_TFT24) // ST7789
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y)
#define TFT_RES_320x240
#define TFT_INTERFACE_FSMC
#elif ENABLED(MKS_ROBIN_TFT32) // Most common: ST7789
#elif ENABLED(MKS_ROBIN_TFT28) // ST7789
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y)
#define TFT_RES_320x240
#define TFT_INTERFACE_FSMC
#elif ENABLED(MKS_ROBIN_TFT35) // Most common: ILI9488
#elif ENABLED(MKS_ROBIN_TFT32) // ST7789
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y)
#define TFT_RES_320x240
#define TFT_INTERFACE_FSMC
#elif ENABLED(MKS_ROBIN_TFT35) // ILI9488
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
#define TFT_RES_480x320
#define TFT_INTERFACE_FSMC
#elif ENABLED(MKS_ROBIN_TFT43)
#define TFT_DEFAULT_ORIENTATION 0
#define TFT_DRIVER SSD1963
#define TFT_DEFAULT_ORIENTATION 0
#define TFT_RES_480x272
#define TFT_INTERFACE_FSMC
#elif ENABLED(MKS_ROBIN_TFT_V1_1R) // ILI9328 or R61505
@ -1196,22 +1205,14 @@
#define TFT_RES_320x240
#define TFT_INTERFACE_FSMC
#elif EITHER(TFT_TRONXY_X5SA, ANYCUBIC_TFT35) // ILI9488
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
#define TFT_DRIVER ILI9488
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
#define TFT_RES_480x320
#define TFT_INTERFACE_FSMC
#elif ENABLED(LONGER_LK_TFT28)
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_X | TFT_INVERT_Y)
#define TFT_RES_320x240
#define TFT_INTERFACE_FSMC
#elif ENABLED(ANET_ET4_TFT28) // ST7789
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY | TFT_INVERT_Y)
#define TFT_RES_320x240
#define TFT_INTERFACE_FSMC
#elif ENABLED(ANET_ET5_TFT35) // ST7796
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY)
#define TFT_RES_480x320
#define TFT_INTERFACE_FSMC
#elif ENABLED(BIQU_BX_TFT70) // RGB
#define TFT_DEFAULT_ORIENTATION (TFT_EXCHANGE_XY)
#define TFT_RES_1024x600

View File

@ -0,0 +1,35 @@
/**
* Marlin 3D Printer Firmware
* Copyright (c) 2021 MarlinFirmware [https://github.com/MarlinFirmware/Marlin]
*
* Based on Sprinter and grbl.
* Copyright (c) 2011 Camiel Gubbels / Erik van der Zalm
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#pragma once
#define LTDC_RGB 0xABAB
#define SSD1963 0x5761
#define ST7735 0x89F0
#define ST7789 0x8552
#define ST7796 0x7796
#define R61505 0x1505
#define ILI9328 0x9328
#define ILI9341 0x9341
#define ILI9488 0x9488
#define ILI9488_ID1 0x8066 // Some ILI9488 have 0x8066 in the 0x04
#define LERDGE_ST7796 0xFFFE
#define AUTO 0xFFFF

View File

@ -20,18 +20,37 @@
*
*/
#include "tft_io.h"
#include "../../inc/MarlinConfigPre.h"
#if HAS_SPI_TFT || HAS_FSMC_TFT || HAS_LTDC_TFT
#include "tft_io.h"
#include "tft_ids.h"
#if TFT_DRIVER == ST7735 || TFT_DRIVER == AUTO
#include "st7735.h"
#endif
#if TFT_DRIVER == ST7789 || TFT_DRIVER == AUTO
#include "st7789v.h"
#endif
#if TFT_DRIVER == ST7796 || TFT_DRIVER == AUTO
#include "st7796s.h"
#endif
#if TFT_DRIVER == R61505 || TFT_DRIVER == AUTO
#include "r65105.h"
#endif
#if TFT_DRIVER == ILI9328 || TFT_DRIVER == AUTO
#include "ili9328.h"
#endif
#if TFT_DRIVER == ILI9341 || TFT_DRIVER == AUTO
#include "ili9341.h"
#endif
#if TFT_DRIVER == ILI9488 || TFT_DRIVER == ILI9488_ID1 || TFT_DRIVER == AUTO
#include "ili9488.h"
#endif
#if TFT_DRIVER == SSD1963 || TFT_DRIVER == AUTO
#include "ssd1963.h"
#endif
#define DEBUG_OUT ENABLED(DEBUG_GRAPHICAL_TFT)
#include "../../core/debug_out.h"
@ -236,4 +255,4 @@ void TFT_IO::write_esc_sequence(const uint16_t *Sequence) {
io.DataTransferEnd();
}
#endif // HAS_SPI_TFT || HAS_FSMC_TFT
#endif // HAS_SPI_TFT || HAS_FSMC_TFT || HAS_LTDC_TFT

View File

@ -23,8 +23,6 @@
#include "../../inc/MarlinConfig.h"
#if HAS_SPI_TFT || HAS_FSMC_TFT || HAS_LTDC_TFT
#if HAS_SPI_TFT
#include HAL_PATH(../../HAL, tft/tft_spi.h)
#elif HAS_FSMC_TFT
@ -35,9 +33,9 @@
#error "TFT IO only supports SPI, FSMC or LTDC interface"
#endif
#define TFT_EXCHANGE_XY (1UL << 1)
#define TFT_INVERT_X (1UL << 2)
#define TFT_INVERT_Y (1UL << 3)
#define TFT_EXCHANGE_XY _BV32(1)
#define TFT_INVERT_X _BV32(2)
#define TFT_INVERT_Y _BV32(3)
#define TFT_NO_ROTATION (0x00)
#define TFT_ROTATE_90 (TFT_EXCHANGE_XY | TFT_INVERT_X)
@ -65,8 +63,8 @@
// TFT_ORIENTATION is the "sum" of TFT_DEFAULT_ORIENTATION plus user TFT_ROTATION
#define TFT_ORIENTATION ((TFT_DEFAULT_ORIENTATION) ^ (TFT_ROTATION))
#define TFT_COLOR_RGB (1UL << 3)
#define TFT_COLOR_BGR (1UL << 4)
#define TFT_COLOR_RGB _BV32(3)
#define TFT_COLOR_BGR _BV32(4)
// Each TFT Driver is responsible for its default color mode.
// #ifndef TFT_COLOR
@ -93,19 +91,6 @@
#define TOUCH_ORIENTATION TOUCH_LANDSCAPE
#endif
#define LTDC_RGB 0xABAB
#define SSD1963 0x5761
#define ST7735 0x89F0
#define ST7789 0x8552
#define ST7796 0x7796
#define R61505 0x1505
#define ILI9328 0x9328
#define ILI9341 0x9341
#define ILI9488 0x9488
#define ILI9488_ID1 0x8066 //Some ILI9488 have 0x8066 in the 0x04
#define LERDGE_ST7796 0xFFFE
#define AUTO 0xFFFF
#ifndef TFT_DRIVER
#define TFT_DRIVER AUTO
#endif
@ -143,5 +128,3 @@ public:
protected:
static uint32_t lcd_id;
};
#endif // HAS_SPI_TFT || HAS_FSMC_TFT