From 787d5220365f3911c3f2a8cf2e9a89a156c24a8a Mon Sep 17 00:00:00 2001 From: Robby Candra Date: Wed, 18 Sep 2019 14:58:58 +0700 Subject: [PATCH] LCD Size Defines (#15297) --- .../u8g_dev_tft_320x240_upscale_from_128x64.cpp | 13 +++++++------ Marlin/src/lcd/dogm/ultralcd_DOGM.h | 9 +++++++++ 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp b/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp index 76c13711aa..8c1dfa3ffe 100644 --- a/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp +++ b/Marlin/src/lcd/dogm/u8g_dev_tft_320x240_upscale_from_128x64.cpp @@ -60,6 +60,7 @@ #if HAS_GRAPHICAL_LCD && PIN_EXISTS(FSMC_CS) #include "HAL_LCD_com_defines.h" +#include "ultralcd_DOGM.h" #include @@ -70,12 +71,12 @@ extern void LCD_IO_WriteMultiple(uint16_t color, uint32_t count); #endif -#define WIDTH 128 -#define HEIGHT 64 +#define WIDTH LCD_PIXEL_WIDTH +#define HEIGHT LCD_PIXEL_HEIGHT #define PAGE_HEIGHT 8 -#define X_LO 32 -#define Y_LO 32 +#define X_LO LCD_PIXEL_OFFSET_X +#define Y_LO LCD_PIXEL_OFFSET_Y #define X_HI (X_LO + 2 * WIDTH - 1) #define Y_HI (Y_LO + 2 * HEIGHT - 1) @@ -142,8 +143,8 @@ static const uint8_t page_first_sequence[] = { }; static const uint8_t clear_screen_sequence[] = { - U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), 0x00, 0x00, 0x01, 0x3F, - U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), 0x00, 0x00, 0x00, 0xEF, + U8G_ESC_ADR(0), LCD_COLUMN, U8G_ESC_ADR(1), 0x00, 0x00, U8G_ESC_DATA(LCD_FULL_PIXEL_WIDTH), + U8G_ESC_ADR(0), LCD_ROW, U8G_ESC_ADR(1), 0x00, 0x00, U8G_ESC_DATA(LCD_FULL_PIXEL_HEIGHT), U8G_ESC_ADR(0), LCD_WRITE_RAM, U8G_ESC_ADR(1), U8G_ESC_END }; diff --git a/Marlin/src/lcd/dogm/ultralcd_DOGM.h b/Marlin/src/lcd/dogm/ultralcd_DOGM.h index 4d9662d7db..71e4c39611 100644 --- a/Marlin/src/lcd/dogm/ultralcd_DOGM.h +++ b/Marlin/src/lcd/dogm/ultralcd_DOGM.h @@ -145,6 +145,15 @@ #define LCD_PIXEL_HEIGHT 64 #endif +// LCD_FULL_PIXEL_WIDTH = +// LCD_PIXEL_OFFSET_X + (LCD_PIXEL_WIDTH * 2) + LCD_PIXEL_OFFSET_X +#if ENABLED(FSMC_GRAPHICAL_TFT) + #define LCD_FULL_PIXEL_WIDTH 320 + #define LCD_PIXEL_OFFSET_X 32 + #define LCD_FULL_PIXEL_HEIGHT 240 + #define LCD_PIXEL_OFFSET_Y 32 +#endif + // For selective rendering within a Y range #define PAGE_OVER(ya) ((ya) <= u8g.getU8g()->current_page.y1) // Does the current page follow a region top? #define PAGE_UNDER(yb) ((yb) >= u8g.getU8g()->current_page.y0) // Does the current page precede a region bottom?