TFT 3x upscale followup (#18256)
This commit is contained in:
@ -25,9 +25,15 @@
|
||||
#include "../../inc/MarlinConfig.h"
|
||||
#include "../../lcd/dogm/ultralcd_DOGM.h" // for LCD_FULL_PIXEL_WIDTH, etc.
|
||||
|
||||
// Touch screen resolution independent of display resolution
|
||||
#define TOUCH_SCREEN_HEIGHT 240
|
||||
#define TOUCH_SCREEN_WIDTH 320
|
||||
|
||||
// Coordinates in terms of touch area
|
||||
#define BUTTON_AREA_TOP 175
|
||||
#define BUTTON_AREA_BOT 234
|
||||
#define SCREEN_START_TOP ((LCD_PIXEL_OFFSET_Y) * 240 / (LCD_FULL_PIXEL_HEIGHT))
|
||||
|
||||
#define SCREEN_START_TOP ((LCD_PIXEL_OFFSET_Y) * (TOUCH_SCREEN_HEIGHT) / (LCD_FULL_PIXEL_HEIGHT))
|
||||
#define TOUCHABLE_Y_HEIGHT (BUTTON_AREA_TOP - (SCREEN_START_TOP))
|
||||
|
||||
#ifndef TOUCH_INT_PIN
|
||||
@ -92,10 +98,10 @@ uint8_t XPT2046::read_buttons() {
|
||||
: WITHIN(x, 242, 305) ? EN_C
|
||||
: 0;
|
||||
|
||||
if (x > LCD_FULL_PIXEL_WIDTH || !WITHIN(y, SCREEN_START_TOP, BUTTON_AREA_TOP)) return 0;
|
||||
if (x > TOUCH_SCREEN_WIDTH || !WITHIN(y, SCREEN_START_TOP, BUTTON_AREA_TOP)) return 0;
|
||||
|
||||
// Column and row above BUTTON_AREA_TOP
|
||||
int8_t col = x * (LCD_WIDTH) / (LCD_FULL_PIXEL_WIDTH),
|
||||
int8_t col = x * (LCD_WIDTH) / (TOUCH_SCREEN_WIDTH),
|
||||
row = (y - (SCREEN_START_TOP)) * (LCD_HEIGHT) / (TOUCHABLE_Y_HEIGHT);
|
||||
|
||||
// Send the touch to the UI (which will simulate the encoder wheel)
|
||||
|
Reference in New Issue
Block a user