touch calibration on startup for marlin ui - classic and color

This commit is contained in:
Victor Mateus Oliveira 2020-11-10 00:31:40 -03:00
parent a9e41e5e81
commit 4fba2dd7e4
3 changed files with 15 additions and 1 deletions

View file

@ -1299,6 +1299,10 @@ void setup() {
SETUP_RUN(password.lock_machine()); // Will not proceed until correct password provided SETUP_RUN(password.lock_machine()); // Will not proceed until correct password provided
#endif #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; marlin_state = MF_RUNNING;
SETUP_LOG("setup() completed."); SETUP_LOG("setup() completed.");

View file

@ -31,6 +31,10 @@
#include "../sd/cardreader.h" #include "../sd/cardreader.h"
#endif #endif
#if ENABLED(TOUCH_SCREEN_CALIBRATION)
#include "tft_io/touch_calibration.h"
#endif
#if EITHER(HAS_LCD_MENU, ULTIPANEL_FEEDMULTIPLY) #if EITHER(HAS_LCD_MENU, ULTIPANEL_FEEDMULTIPLY)
#define HAS_ENCODER_ACTION 1 #define HAS_ENCODER_ACTION 1
#endif #endif
@ -313,6 +317,12 @@ public:
// LCD implementations // LCD implementations
static void clear_lcd(); 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) #if ENABLED(SDSUPPORT)
static void media_changed(const uint8_t old_stat, const uint8_t stat); static void media_changed(const uint8_t old_stat, const uint8_t stat);
#endif #endif

View file

@ -31,7 +31,7 @@ XPT2046 touchIO;
#include "../tft_io/touch_calibration.h" #include "../tft_io/touch_calibration.h"
#endif #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_LEFT TFT_PIXEL_OFFSET_X
#define DOGM_AREA_TOP TFT_PIXEL_OFFSET_Y #define DOGM_AREA_TOP TFT_PIXEL_OFFSET_Y