From 8cb646cc20576ed6cf4462e9ac9125f396a38bd9 Mon Sep 17 00:00:00 2001 From: EvilGremlin <22657714+EvilGremlin@users.noreply.github.com> Date: Mon, 15 Nov 2021 00:15:07 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8=20Simplify=20touchscreen=20calibra?= =?UTF-8?q?tion=20for=20SimUI=20(#23124)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/inc/SanityCheck.h | 4 +- Marlin/src/pins/linux/pins_RAMPS_LINUX.h | 53 +++++++++++++++++++----- 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/Marlin/src/inc/SanityCheck.h b/Marlin/src/inc/SanityCheck.h index fbdda2c127..866b86ef6b 100644 --- a/Marlin/src/inc/SanityCheck.h +++ b/Marlin/src/inc/SanityCheck.h @@ -3652,8 +3652,8 @@ static_assert(_PLUS_TEST(4), "HOMING_FEEDRATE_MM_M values must be positive."); /** * Touch Screen Calibration */ -#if ENABLED(TFT_TOUCH_DEVICE_XPT2046) && DISABLED(TOUCH_SCREEN_CALIBRATION) \ - && (!defined(TOUCH_CALIBRATION_X) || !defined(TOUCH_CALIBRATION_Y) || !defined(TOUCH_OFFSET_X) || !defined(TOUCH_OFFSET_Y)) +#if !MB(LINUX_RAMPS) && ENABLED(TFT_TOUCH_DEVICE_XPT2046) && DISABLED(TOUCH_SCREEN_CALIBRATION) \ + && !(defined(TOUCH_CALIBRATION_X) && defined(TOUCH_CALIBRATION_Y) && defined(TOUCH_OFFSET_X) && defined(TOUCH_OFFSET_Y)) #error "TOUCH_CALIBRATION_[XY] and TOUCH_OFFSET_[XY] are required for resistive touch screens with TOUCH_SCREEN_CALIBRATION disabled." #endif diff --git a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h index 20bd5ef8cc..acf2d31cf6 100644 --- a/Marlin/src/pins/linux/pins_RAMPS_LINUX.h +++ b/Marlin/src/pins/linux/pins_RAMPS_LINUX.h @@ -391,6 +391,7 @@ #define BEEPER_PIN 42 #define TOUCH_CS_PIN 33 + #define SD_DETECT_PIN 41 #define HAS_SPI_FLASH 1 @@ -407,17 +408,47 @@ #ifndef TFT_DRIVER #define TFT_DRIVER ST7796 #endif - #ifndef XPT2046_X_CALIBRATION - #define XPT2046_X_CALIBRATION 63934 - #endif - #ifndef XPT2046_Y_CALIBRATION - #define XPT2046_Y_CALIBRATION 63598 - #endif - #ifndef XPT2046_X_OFFSET - #define XPT2046_X_OFFSET -1 - #endif - #ifndef XPT2046_Y_OFFSET - #define XPT2046_Y_OFFSET -20 + #ifndef TOUCH_SCREEN_CALIBRATION + #if ENABLED(TFT_RES_320x240) + #ifndef TOUCH_CALIBRATION_X + #define TOUCH_CALIBRATION_X 20525 + #endif + #ifndef TOUCH_CALIBRATION_Y + #define TOUCH_CALIBRATION_Y 15335 + #endif + #ifndef TOUCH_OFFSET_X + #define TOUCH_OFFSET_X -1 + #endif + #ifndef TOUCH_OFFSET_Y + #define TOUCH_OFFSET_Y 0 + #endif + #elif ENABLED(TFT_RES_480x272) + #ifndef TOUCH_CALIBRATION_X + #define TOUCH_CALIBRATION_X 30715 + #endif + #ifndef TOUCH_CALIBRATION_Y + #define TOUCH_CALIBRATION_Y 17415 + #endif + #ifndef TOUCH_OFFSET_X + #define TOUCH_OFFSET_X 0 + #endif + #ifndef TOUCH_OFFSET_Y + #define TOUCH_OFFSET_Y -1 + #endif + #elif ENABLED(TFT_RES_480x320) + #ifndef TOUCH_CALIBRATION_X + #define TOUCH_CALIBRATION_X 30595 + #endif + #ifndef TOUCH_CALIBRATION_Y + #define TOUCH_CALIBRATION_Y 20415 + #endif + #ifndef TOUCH_OFFSET_X + #define TOUCH_OFFSET_X 2 + #endif + #ifndef TOUCH_OFFSET_Y + #define TOUCH_OFFSET_Y 1 + #endif + #endif #endif #define BTN_BACK 70