From 6f0274f4b95770d64eed8e7a22c5d54d9171d1f3 Mon Sep 17 00:00:00 2001 From: thisiskeithb <13375512+thisiskeithb@users.noreply.github.com> Date: Wed, 8 Feb 2023 23:23:46 -0800 Subject: [PATCH] Fix TOUCH_SCREEN_CALIBRATION Invalid First Point Avoid registering first touch point as top-left corner when initiating touch calibration since user is touching TFT --- Marlin/src/lcd/tft_io/touch_calibration.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Marlin/src/lcd/tft_io/touch_calibration.cpp b/Marlin/src/lcd/tft_io/touch_calibration.cpp index 44ebc73d71a26..5f45a9506df2c 100644 --- a/Marlin/src/lcd/tft_io/touch_calibration.cpp +++ b/Marlin/src/lcd/tft_io/touch_calibration.cpp @@ -92,6 +92,13 @@ void TouchCalibration::validate_calibration() { bool TouchCalibration::handleTouch(uint16_t x, uint16_t y) { static millis_t next_button_update_ms = 0; const millis_t now = millis(); + + // Avoid registering first touch point as top-left corner when initiating touch calibration since user is touching TFT + if (next_button_update_ms == 0) { + next_button_update_ms = now + BUTTON_DELAY_MENU; + return true; + } + if (PENDING(now, next_button_update_ms)) return false; next_button_update_ms = now + BUTTON_DELAY_MENU;