mirror of
https://github.com/HASwitchPlate/openHASP.git
synced 2025-07-27 05:06:44 +00:00
Update esptool to3.3.1
This commit is contained in:
parent
22d4360a2f
commit
d0ab4d7e96
@ -49,9 +49,18 @@ class BaseTouch {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if TOUCH_DRIVER == 0x2046 && defined(USER_SETUP_LOADED)
|
#if TOUCH_DRIVER == 0x2046 && defined(USER_SETUP_LOADED)
|
||||||
#warning Building for XPT2046
|
#warning Building for TFT_eSPI XPT2046
|
||||||
//#include "touch_driver_xpt2046.h"
|
//#include "touch_driver_xpt2046.h"
|
||||||
#include "touch_driver_tftespi.h"
|
#include "touch_driver_tftespi.h"
|
||||||
|
#elif TOUCH_DRIVER == 0x2046 && defined(LGFX_USE_V1) && defined(HASP_USE_LGFX_TOUCH)
|
||||||
|
#warning Building for LovyanGFX XPT2046
|
||||||
|
#include "touch_driver_lovyangfx.h"
|
||||||
|
#elif TOUCH_DRIVER == 0x0911 && defined(LGFX_USE_V1) && defined(HASP_USE_LGFX_TOUCH)
|
||||||
|
#warning Building for LovyanGFX GT911
|
||||||
|
#include "touch_driver_lovyangfx.h"
|
||||||
|
#elif TOUCH_DRIVER == 0x6336 && defined(LGFX_USE_V1) && defined(HASP_USE_LGFX_TOUCH)
|
||||||
|
#warning Building for LovyanGFX FT6336
|
||||||
|
#include "touch_driver_lovyangfx.h"
|
||||||
#elif TOUCH_DRIVER == 0x5206
|
#elif TOUCH_DRIVER == 0x5206
|
||||||
#warning Building for FT5206
|
#warning Building for FT5206
|
||||||
#include "touch_driver_ft5206.h"
|
#include "touch_driver_ft5206.h"
|
||||||
|
@ -4,9 +4,10 @@
|
|||||||
#ifndef HASP_LOVYANGFX_TOUCH_DRIVER_H
|
#ifndef HASP_LOVYANGFX_TOUCH_DRIVER_H
|
||||||
#define HASP_LOVYANGFX_TOUCH_DRIVER_H
|
#define HASP_LOVYANGFX_TOUCH_DRIVER_H
|
||||||
|
|
||||||
#ifdef ARDUINO
|
#if defined(ARDUINO) && defined(LGFX_USE_V1) && defined(HASP_USE_LGFX_TOUCH)
|
||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
|
#include "LovyanGFX.hpp"
|
||||||
|
|
||||||
#include "touch_driver.h" // base class
|
#include "touch_driver.h" // base class
|
||||||
#include "touch_helper.h" // wire scan
|
#include "touch_helper.h" // wire scan
|
||||||
@ -23,20 +24,21 @@ class TouchLovyanGfx : public BaseTouch {
|
|||||||
public:
|
public:
|
||||||
IRAM_ATTR bool read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
|
IRAM_ATTR bool read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data)
|
||||||
{
|
{
|
||||||
int16_t touchX = 0;
|
lgfx::v1::touch_point_t tp;
|
||||||
int16_t touchY = 0;
|
|
||||||
|
|
||||||
if(haspTft.tft.getTouch((uint16_t*)&touchX, (uint16_t*)&touchY)) {
|
if(haspTft.tft.getTouch(&tp, 1)) {
|
||||||
if(hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_state(); // update Idle
|
if(hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_state(); // update Idle
|
||||||
|
|
||||||
data->point.x = touchX;
|
data->point.x = tp.x;
|
||||||
data->point.y = touchY;
|
data->point.y = tp.y;
|
||||||
data->state = LV_INDEV_STATE_PR;
|
data->state = LV_INDEV_STATE_PR;
|
||||||
hasp_set_sleep_offset(0); // Reset the offset
|
hasp_set_sleep_offset(0); // Reset the offset
|
||||||
|
|
||||||
LOG_VERBOSE(TAG_DRVR, F("Touch: %d %d"), touchX, touchY);
|
LOG_DEBUG(TAG_DRVR, F("Touch: %d %d"), tp.x, tp.y);
|
||||||
|
// HASP_SERIAL.print('#');
|
||||||
} else {
|
} else {
|
||||||
data->state = LV_INDEV_STATE_REL;
|
data->state = LV_INDEV_STATE_REL;
|
||||||
|
// HASP_SERIAL.print('x');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*Return `false` because we are not buffering and no more data to read*/
|
/*Return `false` because we are not buffering and no more data to read*/
|
||||||
@ -52,14 +54,14 @@ 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);
|
||||||
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);
|
||||||
// haspTft.tft.setTouch(calData);
|
// haspTft.tft.setTouch(calData);
|
||||||
@ -68,6 +70,7 @@ class TouchLovyanGfx : public BaseTouch {
|
|||||||
|
|
||||||
} // namespace dev
|
} // namespace dev
|
||||||
|
|
||||||
|
#warning Using Lovyan Touch
|
||||||
using dev::TouchLovyanGfx;
|
using dev::TouchLovyanGfx;
|
||||||
extern dev::TouchLovyanGfx haspTouch;
|
extern dev::TouchLovyanGfx haspTouch;
|
||||||
|
|
||||||
|
@ -279,7 +279,8 @@ void guiSetup()
|
|||||||
font_setup();
|
font_setup();
|
||||||
|
|
||||||
/* Initialize the LVGL display driver with correct orientation */
|
/* Initialize the LVGL display driver with correct orientation */
|
||||||
#if(TOUCH_DRIVER == 0x2046) // || defined(LGFX_USE_V1) // Use native display driver to rotate display and touch
|
#if(TOUCH_DRIVER == 0x2046) || \
|
||||||
|
(defined(LGFX_USE_V1) && defined(HASP_USE_LGFX_TOUCH)) // Use native display driver to rotate display and touch
|
||||||
static lv_disp_drv_t disp_drv;
|
static lv_disp_drv_t disp_drv;
|
||||||
lv_disp_drv_init(&disp_drv);
|
lv_disp_drv_init(&disp_drv);
|
||||||
disp_drv.buffer = &disp_buf;
|
disp_drv.buffer = &disp_buf;
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user