mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-28 13:46:36 +00:00
Don't set calibration for capacitive touch panels
This commit is contained in:
parent
bbf6432606
commit
6dfe25a176
@ -313,7 +313,6 @@ lgfx::ITouch* _init_touch(Preferences* preferences)
|
|||||||
// switch(tft_driver) {
|
// switch(tft_driver) {
|
||||||
// default:
|
// default:
|
||||||
// case 0x9341: {
|
// case 0x9341: {
|
||||||
LOG_DEBUG(TAG_TFT, F("%s - %d"), __FILE__, __LINE__);
|
|
||||||
// break;
|
// break;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@ -331,20 +330,12 @@ lgfx::ITouch* _init_touch(Preferences* preferences)
|
|||||||
cfg.bus_shared = false; // 画面と共通のバスを使用している場合 trueを設定
|
cfg.bus_shared = false; // 画面と共通のバスを使用している場合 trueを設定
|
||||||
cfg.offset_rotation = TOUCH_OFFSET_ROTATION; // 表示とタッチの向きのが一致しない場合の調整 0~7の値で設定
|
cfg.offset_rotation = TOUCH_OFFSET_ROTATION; // 表示とタッチの向きのが一致しない場合の調整 0~7の値で設定
|
||||||
|
|
||||||
// SPI接続の場合
|
|
||||||
// cfg.spi_host = VSPI_HOST; // 使用するSPIを選択 (HSPI_HOST or VSPI_HOST)
|
|
||||||
// cfg.freq = 1000000; // SPIクロックを設定
|
|
||||||
// cfg.pin_sclk = 18; // SCLKが接続されているピン番号
|
|
||||||
// cfg.pin_mosi = 23; // MOSIが接続されているピン番号
|
|
||||||
// cfg.pin_miso = 19; // MISOが接続されているピン番号
|
|
||||||
// cfg.pin_cs = 5; // CSが接続されているピン番号
|
|
||||||
|
|
||||||
// I2C接続の場合
|
// I2C接続の場合
|
||||||
cfg.i2c_port = I2C_TOUCH_PORT; // 使用するI2Cを選択 (0 or 1)
|
cfg.i2c_port = I2C_TOUCH_PORT; // 使用するI2Cを選択 (0 or 1)
|
||||||
cfg.i2c_addr = I2C_TOUCH_ADDRESS; // I2Cデバイスアドレス番号
|
cfg.i2c_addr = I2C_TOUCH_ADDRESS; // I2Cデバイスアドレス番号
|
||||||
cfg.pin_sda = TOUCH_SDA; // SDAが接続されているピン番号
|
cfg.pin_sda = TOUCH_SDA; // SDAが接続されているピン番号
|
||||||
cfg.pin_scl = TOUCH_SCL; // SCLが接続されているピン番号
|
cfg.pin_scl = TOUCH_SCL; // SCLが接続されているピン番号
|
||||||
cfg.pin_int = -1; // INTが接続されているピン番号
|
cfg.pin_int = TOUCH_IRQ; // INTが接続されているピン番号
|
||||||
cfg.freq = I2C_TOUCH_FREQUENCY; // I2Cクロックを設定
|
cfg.freq = I2C_TOUCH_FREQUENCY; // I2Cクロックを設定
|
||||||
|
|
||||||
touch->config(cfg);
|
touch->config(cfg);
|
||||||
|
@ -55,30 +55,34 @@ class TouchLovyanGfx : public BaseTouch {
|
|||||||
|
|
||||||
void set_calibration(uint16_t* calData)
|
void set_calibration(uint16_t* calData)
|
||||||
{
|
{
|
||||||
|
#if TOUCH_DRIVER == 0x2046
|
||||||
if(haspTft.tft.panel() && haspTft.tft.width() && haspTft.tft.height()) {
|
if(haspTft.tft.panel() && haspTft.tft.width() && haspTft.tft.height()) {
|
||||||
haspTft.tft.setTouchCalibrate(calData);
|
haspTft.tft.setTouchCalibrate(calData);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void calibrate(uint16_t* calData)
|
void calibrate(uint16_t* calData)
|
||||||
{
|
{
|
||||||
|
#if TOUCH_DRIVER == 0x2046
|
||||||
if(haspTft.tft.panel() && haspTft.tft.width() && haspTft.tft.height()) {
|
if(haspTft.tft.panel() && haspTft.tft.width() && haspTft.tft.height()) {
|
||||||
|
|
||||||
haspTft.tft.fillScreen(TFT_BLACK);
|
haspTft.tft.fillScreen(TFT_BLACK);
|
||||||
// haspTft.tft.setCursor(20, 0);
|
// haspTft.tft.setCursor(20, 0);
|
||||||
// haspTft.tft.setTextFont(1);
|
// haspTft.tft.setTextFont(1);
|
||||||
// haspTft.tft.setTextSize(1);
|
// haspTft.tft.setTextSize(1);
|
||||||
// haspTft.tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
// haspTft.tft.setTextColor(TFT_WHITE, TFT_BLACK);
|
||||||
|
|
||||||
// // tft.println(PSTR("Touch corners as indicated"));
|
// // tft.println(PSTR("Touch corners as indicated"));
|
||||||
|
|
||||||
// haspTft.tft.setTextFont(1);
|
// haspTft.tft.setTextFont(1);
|
||||||
delay(500);
|
delay(500);
|
||||||
haspTft.tft.calibrateTouch(calData, TFT_MAGENTA, TFT_BLACK, 15);
|
haspTft.tft.calibrateTouch(calData, TFT_MAGENTA, TFT_BLACK, 15);
|
||||||
set_calibration(calData);
|
set_calibration(calData);
|
||||||
delay(500);
|
delay(500);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace dev
|
} // namespace dev
|
||||||
|
Loading…
x
Reference in New Issue
Block a user