diff --git a/src/drv/tft/tft_driver_lovyangfx.cpp b/src/drv/tft/tft_driver_lovyangfx.cpp index 2959a436..dd1f4db4 100644 --- a/src/drv/tft/tft_driver_lovyangfx.cpp +++ b/src/drv/tft/tft_driver_lovyangfx.cpp @@ -412,9 +412,9 @@ lgfx::ITouch* _init_touch(Preferences* preferences) auto cfg = touch->config(); cfg.x_min = 0; - cfg.x_max = TFT_WIDTH - 1; + cfg.x_max = TOUCH_WIDTH - 1; cfg.y_min = 0; - cfg.y_max = TFT_HEIGHT - 1; + cfg.y_max = TOUCH_HEIGHT - 1; cfg.pin_int = TOUCH_IRQ; cfg.bus_shared = true; cfg.offset_rotation = TOUCH_OFFSET_ROTATION; @@ -1043,7 +1043,11 @@ void LovyanGfx::init(int w, int h) #elif defined(ESP32_8040S070C) || defined(RGB_DRIVER) auto _panel_instance = new lgfx::Panel_RGB(); auto _bus_instance = new lgfx::Bus_RGB(); - auto _touch_instance = new lgfx::Touch_GT911(); + #if TOUCH_DRIVER == 0x911 + auto _touch_instance = new lgfx::Touch_GT911(); + #elif TOUCH_DRIVER == 0x6336 + auto _touch_instance = new lgfx::Touch_FT5x06(); + #endif { auto cfg = _panel_instance->config(); @@ -1105,17 +1109,18 @@ void LovyanGfx::init(int w, int h) { auto cfg = _touch_instance->config(); cfg.x_min = 0; - cfg.x_max = TFT_WIDTH; + cfg.x_max = TOUCH_WIDTH; cfg.y_min = 0; - cfg.y_max = TFT_HEIGHT; + cfg.y_max = TOUCH_HEIGHT; cfg.pin_int = TOUCH_IRQ; - cfg.bus_shared = false; + cfg.pin_rst = TOUCH_RST; + cfg.bus_shared = true; cfg.offset_rotation = TOUCH_OFFSET_ROTATION; cfg.i2c_port = I2C_TOUCH_PORT; cfg.pin_sda = TOUCH_SDA; cfg.pin_scl = TOUCH_SCL; - cfg.freq = 400000; - cfg.i2c_addr = 0x14; // 0x5D , 0x14 + cfg.freq = I2C_TOUCH_FREQUENCY; + cfg.i2c_addr = I2C_TOUCH_ADDRESS; // 0x5D , 0x14 _touch_instance->config(cfg); _panel_instance->setTouch(_touch_instance); } diff --git a/user_setups/esp32s3/4dsystems-gen4_esp32_50ct.ini b/user_setups/esp32s3/4dsystems-gen4_esp32_50ct.ini new file mode 100644 index 00000000..35765655 --- /dev/null +++ b/user_setups/esp32s3/4dsystems-gen4_esp32_50ct.ini @@ -0,0 +1,112 @@ +;***************************************************; +; 4D Systems GEN4-ESP32-S3 TFT 5.0" ; +; - 4D Systems Screen 4DLCD-50800480 https://uk.rs-online.com/web/p/lcd-colour-displays/2058704?searchId=afcc888a-a7c2-4b51-8eb6-bc5aacf64fa9&gb=s ; +; - Custom esp32-s3r8 board ; +; - ILI6122/ILI5960 display driver ; +; - FT5446 touch controller ; +;***************************************************; +; +; https://4dsystems.com.au/products/gen4-esp32-series/ +; + +[4dsystems-gen4_esp32_50] +extends = arduino_esp32s3_v2 +board = esp32-s3-devkitc-1 ; Correct board would be 4d_systems_esp32s3_gen4_r8n16 but only included from 3.x.x framework +board_build.arduino.memory_type = qio_opi + +build_flags = + ${arduino_esp32s3_v2.build_flags} + ${esp32s3.ps_ram} + +;region -- ArduinoGFX build options ------------------------ + -D HASP_LV_USE_SW_ROTATE=0 + -D TFT_BCKL=2 ;#define GFX_BL 2 +;endregion + +lib_deps = + ${arduino_esp32s3_v2.lib_deps} + ;;;;;;;${arduinogfx.lib_deps} + ${lovyangfx.lib_deps} + Arduino_RPi_DPI_RGBPanel_mod + ${goodix.lib_deps} + +board_build.partitions = huge_app.csv + +[4dsystems-tft-common-pins] +build_flags = + + + +; Bus Settings - LovyanGFX Library // ; Bus Settings - Ardunio_GFX Library + -D LGFX_USE_V1=1 + -D TFT_B0=8 ;8 /* B0 */, + -D TFT_B1=3 ;3 /* B1 */, + -D TFT_B2=46 ;46 /* B2 */, + -D TFT_B3=9 ;9 /* B3 */, + -D TFT_B4=1 ;1 /* B4 */, + + -D TFT_G0=5 ;5 /* G0 */, + -D TFT_G1=6 ;6 /* G1 */, + -D TFT_G2=7 ;7 /* G2 */, + -D TFT_G3=15 ;15 /* G3 */, + -D TFT_G4=16 ;16 /* G4 */, + -D TFT_G5=4 ;4 /* G5 */, + + -D TFT_R0=45 ;45 /* R0 */, + -D TFT_R1=48 ;48 /* R1 */, + -D TFT_R2=47 ;47 /* R2 */, + -D TFT_R3=21 ;21 /* R3 */, + -D TFT_R4=14 ;14 /* R4 */, + -D RGB_DRIVER=1 ; + + -D TFT_DE=40 ;40 /* DE */, + -D TFT_VSYNC=41 ;41 /* VSYNC */, + -D TFT_HSYNC=39 ;39 /* HSYNC */, + -D TFT_PCLK=42 ;42s /* PCLK */, + +[env:4dsystems-gen4_esp32_50ct_16MB] +extends = 4dsystems-gen4_esp32_50, flash_16mb + +build_flags = + -D HASP_MODEL="4D Systems gen4-ESP32-43CT" + -D HASP_LOG_LEVEL=LOG_LEVEL_VERBOSE + -D HASP_USE_CAPTIVE_PORTAL=0 + ; -D HASP_USE_CUSTOM=1 + ; -D MQTT_TOPIC_CUSTOM="SmartPICoop" + + + ${4dsystems-gen4_esp32_50.build_flags} + ${4dsystems-tft-common-pins.build_flags} + + ; Panel Settings ILI6122/LI5960 + -D TFT_WIDTH=800 ;800 /* width */, + -D TFT_HEIGHT=480 ;480 /* height */, + + -D TFT_HSYNC_POLARITY=0 ;0 /* hsync_polarity */, + -D TFT_HSYNC_FRONT_PORCH=8 ;8 /* hsync_front_porch */, + -D TFT_HSYNC_PULSE_WIDTH=4 ;???Pio_4 /* hsync_pulse_width */ ???Ard_1 /* hsync_pulse_width */, + -D TFT_HSYNC_BACK_PORCH=8 ;???Pio_43 /* hsync_back_porch */,???Ard_32 /* hsync_back_porch */, + -D TFT_VSYNC_POLARITY=0 ;0 /* vsync_polarity */, + -D TFT_VSYNC_FRONT_PORCH=8 ;8 /* vsync_front_porch */, + -D TFT_VSYNC_PULSE_WIDTH=4 ;???Pio_4 /* vsync_pulse_width */ ???Ard_1 /* vsync_pulse_width */, + -D TFT_VSYNC_BACK_PORCH=8 ;Pio_12 /* vsync_back_porch */ ???Ard_ 8 /* vsync_back_porch */, + -D TFT_PCLK_ACTIVE_NEG=1 ;1 /* pclk_active_neg */, + -D TFT_PREFER_SPEED=16000000 ;16000000 /* prefer_speed */ + -D TFT_AUTO_FLUSH=1 ;true /* auto_flush */ + + ; Touch Settings FT5446 + -D HASP_USE_LGFX_TOUCH=1 + -D TOUCH_OFFSET_ROTATION=1 + -D TOUCH_WIDTH=480 + -D TOUCH_HEIGHT=800 + -D TOUCH_DRIVER=0x6336 + -D I2C_TOUCH_PORT=0 + -D TOUCH_SCL=18 + -D TOUCH_SDA=17 + -D TOUCH_IRQ=-1 + -D TOUCH_RST=-1 + -D I2C_TOUCH_ADDRESS=0x38 + -D I2C_TOUCH_FREQUENCY=400000 + +lib_deps = + ${4dsystems-gen4_esp32_50.lib_deps}