diff --git a/Marlin/src/MarlinCore.cpp b/Marlin/src/MarlinCore.cpp index d8f651b66a..fc127d22ce 100644 --- a/Marlin/src/MarlinCore.cpp +++ b/Marlin/src/MarlinCore.cpp @@ -1299,6 +1299,10 @@ void setup() { SETUP_RUN(password.lock_machine()); // Will not proceed until correct password provided #endif + #if HAS_LCD_MENU && ENABLED(TOUCH_SCREEN_CALIBRATION) && EITHER(TFT_CLASSIC_UI, TFT_COLOR_UI) + ui.check_touch_calibration(); + #endif + marlin_state = MF_RUNNING; SETUP_LOG("setup() completed."); diff --git a/Marlin/src/lcd/marlinui.h b/Marlin/src/lcd/marlinui.h index ce66ede86e..d7063d937c 100644 --- a/Marlin/src/lcd/marlinui.h +++ b/Marlin/src/lcd/marlinui.h @@ -31,6 +31,10 @@ #include "../sd/cardreader.h" #endif +#if ENABLED(TOUCH_SCREEN_CALIBRATION) + #include "tft_io/touch_calibration.h" +#endif + #if EITHER(HAS_LCD_MENU, ULTIPANEL_FEEDMULTIPLY) #define HAS_ENCODER_ACTION 1 #endif @@ -313,6 +317,12 @@ public: // LCD implementations static void clear_lcd(); + #if HAS_LCD_MENU && ENABLED(TOUCH_SCREEN_CALIBRATION) + static void check_touch_calibration() { + if (touch_calibration.need_calibration()) currentScreen = touch_calibration_screen; + } + #endif + #if ENABLED(SDSUPPORT) static void media_changed(const uint8_t old_stat, const uint8_t stat); #endif diff --git a/Marlin/src/lcd/touch/touch_buttons.cpp b/Marlin/src/lcd/touch/touch_buttons.cpp index 85bcff5bd3..8e231ca9ab 100644 --- a/Marlin/src/lcd/touch/touch_buttons.cpp +++ b/Marlin/src/lcd/touch/touch_buttons.cpp @@ -31,7 +31,7 @@ XPT2046 touchIO; #include "../tft_io/touch_calibration.h" #endif -#include "../../lcd/marlinui.h" // For EN_C bit mask +#include "../marlinui.h" // For EN_C bit mask #define DOGM_AREA_LEFT TFT_PIXEL_OFFSET_X #define DOGM_AREA_TOP TFT_PIXEL_OFFSET_Y