Lovyan Resistive Touch calibration #220

This commit is contained in:
fvanroie 2022-11-14 23:30:29 +01:00
parent e9ef961ef8
commit 4bc2cd5e24
4 changed files with 12 additions and 6 deletions

View File

@ -573,11 +573,11 @@ void LovyanGfx::init(int w, int h)
auto cfg = _touch_instance->config(); auto cfg = _touch_instance->config();
cfg.x_min = 300; cfg.x_min = 300;
cfg.x_max = 3900; cfg.x_max = 3900;
cfg.y_min = 200; cfg.y_min = 3700;
cfg.y_max = 3700; cfg.y_max = 200;
cfg.pin_int = -1; cfg.pin_int = -1;
cfg.bus_shared = false; cfg.bus_shared = false;
cfg.offset_rotation = 6; cfg.offset_rotation = TOUCH_OFFSET_ROTATION;
cfg.spi_host = VSPI_HOST; cfg.spi_host = VSPI_HOST;
cfg.freq = 1000000; cfg.freq = 1000000;
cfg.pin_sclk = 25; cfg.pin_sclk = 25;
@ -617,6 +617,13 @@ void LovyanGfx::init(int w, int h)
tft.begin(); tft.begin();
LOG_DEBUG(TAG_TFT, F("%s - %d"), __FILE__, __LINE__); LOG_DEBUG(TAG_TFT, F("%s - %d"), __FILE__, __LINE__);
tft.setSwapBytes(true); /* set endianess */ tft.setSwapBytes(true); /* set endianess */
// #if esp32_2432S028R
// LOG_VERBOSE(TAG_TFT, "Setting up touch calibration for esp32_2432S028R")
// uint16_t calData[] = {239, 3926, 233, 265, 3856, 3896, 3714, 308};
// tft.setTouchCalibrate(calData);
// #endif
LOG_INFO(TAG_TFT, F(D_SERVICE_STARTED)); LOG_INFO(TAG_TFT, F(D_SERVICE_STARTED));
} }

View File

@ -55,7 +55,6 @@ class TouchLovyanGfx : public BaseTouch {
void calibrate(uint16_t* calData) void calibrate(uint16_t* calData)
{ {
/*
haspTft.tft.fillScreen(TFT_BLACK); haspTft.tft.fillScreen(TFT_BLACK);
// haspTft.tft.setCursor(20, 0); // haspTft.tft.setCursor(20, 0);
@ -70,7 +69,6 @@ class TouchLovyanGfx : public BaseTouch {
haspTft.tft.calibrateTouch(calData, TFT_MAGENTA, TFT_BLACK, 15); haspTft.tft.calibrateTouch(calData, TFT_MAGENTA, TFT_BLACK, 15);
// haspTft.tft.setTouch(calData); // haspTft.tft.setTouch(calData);
*/
} }
}; };

View File

@ -479,7 +479,7 @@ bool guiGetConfig(const JsonObject& settings)
#if TOUCH_DRIVER == 0x2046 && defined(USER_SETUP_LOADED) && defined(TOUCH_CS) #if TOUCH_DRIVER == 0x2046 && defined(USER_SETUP_LOADED) && defined(TOUCH_CS)
// tft_espi_set_touch(gui_settings.cal_data); // tft_espi_set_touch(gui_settings.cal_data);
haspTft.tft.setTouch(gui_settings.cal_data); haspTft.tft.setTouch(gui_settings.cal_data);
#elif 0 #elif TOUCH_DRIVER == 0x2046 && defined(HASP_USE_LGFX_TOUCH)
haspTft.tft.setTouchCalibrate(gui_settings.cal_data); haspTft.tft.setTouchCalibrate(gui_settings.cal_data);
#endif #endif
} }

View File

@ -30,6 +30,7 @@ build_flags =
-D SUPPORT_TRANSACTIONS -D SUPPORT_TRANSACTIONS
-D SPI_FREQUENCY=55000000 -D SPI_FREQUENCY=55000000
-D SPI_READ_FREQUENCY=20000000 -D SPI_READ_FREQUENCY=20000000
-D TOUCH_OFFSET_ROTATION=0 ; 1=swap xy, 2=invert x, 4=inverty
-D ESP32_2432S028R=1 -D ESP32_2432S028R=1
;endregion ;endregion