From 49a04e35b279057f4fb79a204d28375028c8c627 Mon Sep 17 00:00:00 2001 From: Victor Oliveira Date: Tue, 29 Dec 2020 02:26:35 -0300 Subject: [PATCH] Support 4.3" (480x272) Color UI display (#20334) --- Marlin/src/inc/Conditionals_LCD.h | 9 +++++++++ Marlin/src/lcd/tft/tft.h | 3 +++ Marlin/src/lcd/tft/ui_480x320.h | 13 +++++++++++-- Marlin/src/lcd/tft_io/ssd1963.h | 6 +++--- Marlin/src/pins/stm32f4/pins_ANET_ET4.h | 5 ----- 5 files changed, 26 insertions(+), 10 deletions(-) diff --git a/Marlin/src/inc/Conditionals_LCD.h b/Marlin/src/inc/Conditionals_LCD.h index 99a5036723fd4..842c6cc4ea9fb 100644 --- a/Marlin/src/inc/Conditionals_LCD.h +++ b/Marlin/src/inc/Conditionals_LCD.h @@ -1009,6 +1009,12 @@ #elif ENABLED(TFT_INTERFACE_FSMC) #define TFT_480x320 #endif +#elif ENABLED(TFT_COLOR_UI) && TFT_HEIGHT == 272 + #if ENABLED(TFT_INTERFACE_SPI) + #define TFT_480x272_SPI + #elif ENABLED(TFT_INTERFACE_FSMC) + #define TFT_480x272 + #endif #endif // Fewer lines with touch buttons on-screen @@ -1018,6 +1024,9 @@ #elif EITHER(TFT_480x320, TFT_480x320_SPI) #define HAS_UI_480x320 1 #define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7) +#elif EITHER(TFT_480x272, TFT_480x272_SPI) + #define HAS_UI_480x272 1 + #define LCD_HEIGHT TERN(TOUCH_SCREEN, 6, 7) #endif // This emulated DOGM has 'touch/xpt2046', not 'tft/xpt2046' diff --git a/Marlin/src/lcd/tft/tft.h b/Marlin/src/lcd/tft/tft.h index d3ef62ec5b2e7..99d335d135f68 100644 --- a/Marlin/src/lcd/tft/tft.h +++ b/Marlin/src/lcd/tft/tft.h @@ -43,6 +43,9 @@ #elif HAS_UI_480x320 #define TFT_WIDTH 480 #define TFT_HEIGHT 320 +#elif HAS_UI_480x272 + #define TFT_WIDTH 480 + #define TFT_HEIGHT 272 #else #error "Unsupported display resolution!" #endif diff --git a/Marlin/src/lcd/tft/ui_480x320.h b/Marlin/src/lcd/tft/ui_480x320.h index 078f35ac68343..e3a688f112b15 100644 --- a/Marlin/src/lcd/tft/ui_480x320.h +++ b/Marlin/src/lcd/tft/ui_480x320.h @@ -38,8 +38,17 @@ void draw_fan_status(uint16_t x, uint16_t y, const bool blink); void menu_line(const uint8_t row, uint16_t color = COLOR_BACKGROUND); void menu_item(const uint8_t row, bool sel = false); -#define MENU_FONT_NAME Helvetica18 -#define SYMBOLS_FONT_NAME Helvetica18_symbols +#if HAS_UI_480x320 + #define MENU_FONT_NAME Helvetica18 + #define SYMBOLS_FONT_NAME Helvetica18_symbols + #define MENU_ITEM_HEIGHT 43 + #define FONT_LINE_HEIGHT 34 +#elif HAS_UI_480x272 + #define MENU_FONT_NAME Helvetica14 + #define SYMBOLS_FONT_NAME Helvetica14_symbols + #define MENU_ITEM_HEIGHT 36 + #define FONT_LINE_HEIGHT 24 +#endif #define ABSOLUTE_ZERO -273.15 diff --git a/Marlin/src/lcd/tft_io/ssd1963.h b/Marlin/src/lcd/tft_io/ssd1963.h index 4953a96233e83..947918a6962ac 100644 --- a/Marlin/src/lcd/tft_io/ssd1963.h +++ b/Marlin/src/lcd/tft_io/ssd1963.h @@ -39,10 +39,10 @@ IF_0((TFT_ORIENTATION) & TFT_INVERT_X, SSD1963_MADCTL_FH) | \ IF_0((TFT_ORIENTATION) & TFT_INVERT_Y, SSD1963_MADCTL_FV) -#if !defined(TFT_COLOR) || TFT_COLOR == TFT_COLOR_BGR - #define SSD1963_COLOR SSD1963_MADCTL_BGR -#elif TFT_COLOR == TFT_COLOR_RGB +#if !defined(TFT_COLOR) || TFT_COLOR == TFT_COLOR_RGB #define SSD1963_COLOR SSD1963_MADCTL_RGB +#elif TFT_COLOR == TFT_COLOR_BGR + #define SSD1963_COLOR SSD1963_MADCTL_BGR #endif #define SSD1963_MADCTL_DATA (SSD1963_ORIENTATION) | (SSD1963_COLOR) diff --git a/Marlin/src/pins/stm32f4/pins_ANET_ET4.h b/Marlin/src/pins/stm32f4/pins_ANET_ET4.h index 7f429d4497e03..0721aab844074 100644 --- a/Marlin/src/pins/stm32f4/pins_ANET_ET4.h +++ b/Marlin/src/pins/stm32f4/pins_ANET_ET4.h @@ -155,11 +155,6 @@ #define TOUCH_INT_PIN PB1 #endif -// Touchscreen calibration does not work correctly with ANET_ET5_TFT35 or ANET_ET4_TFT28 -#if ENABLED(TOUCH_SCREEN_CALIBRATION) - #undef TOUCH_SCREEN_CALIBRATION -#endif - #if ENABLED(ANET_ET5_TFT35) #ifndef TOUCH_CALIBRATION_X #define TOUCH_CALIBRATION_X 17125