diff --git a/CYD-Klipper/src/conf/global_config.h b/CYD-Klipper/src/conf/global_config.h index bc1b508..55a85c9 100644 --- a/CYD-Klipper/src/conf/global_config.h +++ b/CYD-Klipper/src/conf/global_config.h @@ -3,12 +3,12 @@ #include "lvgl.h" -#define CONFIG_VERSION 3 +#define CONFIG_VERSION 4 typedef struct _GLOBAL_CONFIG { unsigned char version; union { - unsigned char raw; + unsigned int raw; struct { // Internal bool screenCalibrated : 1; diff --git a/CYD-Klipper/src/core/device/ESP32-2432S028R.cpp b/CYD-Klipper/src/core/device/ESP32-2432S028R.cpp index 0332dfa..3112dfa 100644 --- a/CYD-Klipper/src/core/device/ESP32-2432S028R.cpp +++ b/CYD-Klipper/src/core/device/ESP32-2432S028R.cpp @@ -77,14 +77,14 @@ void touchscreen_calibrate(bool force) tft.drawFastHLine(300, 230, 20, ILI9341_BLACK); tft.drawFastVLine(310, 220, 20, ILI9341_BLACK); - int16_t xDist = 320 - 40; - int16_t yDist = 240 - 40; + int16_t xDist = 320 - 20; + int16_t yDist = 240 - 20; global_config.screenCalXMult = (float)xDist / (float)(x2 - x1); - global_config.screenCalXOffset = 20.0 - ((float)x1 * global_config.screenCalXMult); + global_config.screenCalXOffset = 10.0 - ((float)x1 * global_config.screenCalXMult); global_config.screenCalYMult = (float)yDist / (float)(y2 - y1); - global_config.screenCalYOffset = 20.0 - ((float)y1 * global_config.screenCalYMult); + global_config.screenCalYOffset = 10.0 - ((float)y1 * global_config.screenCalYMult); global_config.screenCalibrated = true; WriteGlobalConfig();