diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 80d8c4ab..6e56959c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -51,7 +51,7 @@ jobs: - out: seeed-studios env: "sensecap-indicator-d1_8MB" - out: sunton - env: "esp32-2432s028r_4MB -e esp32-2432s028r-st7789_4MB -e esp32-3248s035c_4MB -e esp32-3248s035r_4MB -e sunton-4827s043c_16MB -e sunton-8048s043c_16MB -e sunton-8048s050c_16MB -e sunton-8048s070c_16MB" + env: "esp32-2432s028r_4MB -e esp32-2432s028r-ili9342_4MB -e esp32-2432s028r-st7789_4MB -e esp32-3248s035c_4MB -e esp32-3248s035r_4MB -e sunton-4827s043c_16MB -e sunton-8048s043c_16MB -e sunton-8048s050c_16MB -e sunton-8048s070c_16MB" - out: waveshare env: "esp32-one_ili9486 -e esp32-one_st7796" - out: wireless-tag diff --git a/src/drv/tft/tft_driver_lovyangfx.cpp b/src/drv/tft/tft_driver_lovyangfx.cpp index e4f73ea4..9d6d9a6a 100644 --- a/src/drv/tft/tft_driver_lovyangfx.cpp +++ b/src/drv/tft/tft_driver_lovyangfx.cpp @@ -187,7 +187,7 @@ static lgfx::Bus_SPI* init_spi_bus(Preferences* prefs) static void configure_panel(lgfx::Panel_Device* panel, Preferences* prefs) { - auto cfg = panel->config(); // Get the structure for display panel settings. + auto cfg = panel->config(); // Get the structure for display panel settings. cfg.pin_cs = prefs->getInt("cs", TFT_CS); // CS required cfg.pin_rst = prefs->getInt("rst", TFT_RST); // RST sum development board RST linkage @@ -201,27 +201,27 @@ static void configure_panel(lgfx::Panel_Device* panel, Preferences* prefs) cfg.memory_width = prefs->getUInt("memory_width", cfg.panel_width); // Maximum width supported by driver IC cfg.memory_height = prefs->getUInt("memory_height", cfg.panel_height); // Maximum height supported by driver IC - cfg.offset_x = prefs->getUInt("offset_x", 0); // Amount of offset in the X direction of the panel - cfg.offset_y = prefs->getUInt("offset_y", 0); // Amount of offset in the Y direction of the panel + cfg.offset_x = prefs->getUInt("offset_x", 0); // Amount of offset in the X direction of the panel + cfg.offset_y = prefs->getUInt("offset_y", 0); // Amount of offset in the Y direction of the panel cfg.offset_rotation = - prefs->getUInt("offset_rotation", TFT_OFFSET_ROTATION); // Offset of the rotation 0 ~ 7 (4 ~ 7 is upside down) + prefs->getUInt("offset_rotation", TFT_OFFSET_ROTATION); // Offset of the rotation 0 ~ 7 (4 ~ 7 is upside down) cfg.dummy_read_pixel = prefs->getUInt("dummy_read_pixel", 8); // Number of dummy read bits before pixel read cfg.dummy_read_bits = prefs->getUInt("dummy_read_bits", 1); // bits of dummy read before reading data other than pixels cfg.readable = prefs->getBool("readable", false); // true if data can be read -#ifdef INVERT_COLORS // This is configurable un Web UI +#ifdef INVERT_COLORS // This is configurable un Web UI cfg.invert = prefs->getBool("invert", INVERT_COLORS != 0); // true if the light and darkness of the panel is reversed #else - cfg.invert = prefs->getBool("invert", false); // true if the light and darkness of the panel is reversed + cfg.invert = prefs->getBool("invert", false); // true if the light and darkness of the panel is reversed #endif #ifdef TFT_RGB_ORDER cfg.rgb_order = prefs->getBool("rgb_order", TFT_RGB_ORDER != 0); // true if the red and blue of the panel are swapped #else - cfg.rgb_order = prefs->getBool("rgb_order", false); // true if the red and blue of the panel are swapped + cfg.rgb_order = prefs->getBool("rgb_order", false); // true if the red and blue of the panel are swapped #endif bool dlen_16bit = false; @@ -453,7 +453,7 @@ lgfx::ITouch* _init_touch(Preferences* preferences) touch->config(cfg); return touch; } -#endif +#endif #endif // HASP_USE_LGFX_TOUCH @@ -592,7 +592,7 @@ void LovyanGfx::init(int w, int h) lgfx::i2c::writeRegister8(axp_i2c_port, axp_i2c_addr, 0x12, 0x04, ~0, axp_i2c_freq); // LDO2 enable lgfx::i2c::writeRegister8(axp_i2c_port, axp_i2c_addr, 0x92, 0x00, 0xF8, axp_i2c_freq); // GPIO1 OpenDrain (M5Tough TOUCH) - lgfx::i2c::writeRegister8(axp_i2c_port, axp_i2c_addr, 0x95, 0x84, 0x72, axp_i2c_freq); // GPIO4 enable + lgfx::i2c::writeRegister8(axp_i2c_port, axp_i2c_addr, 0x95, 0x84, 0x72, axp_i2c_freq); // GPIO4 enable if(/*use_reset*/ true) { lgfx::i2c::writeRegister8(axp_i2c_port, axp_i2c_addr, 0x96, 0, ~0x02, axp_i2c_freq); // GPIO4 LOW (LCD RST) lgfx::i2c::writeRegister8(axp_i2c_port, axp_i2c_addr, 0x94, 0, ~0x02, @@ -639,7 +639,14 @@ void LovyanGfx::init(int w, int h) _panel_instance->setLight(new Light_M5Tough()); #elif defined(ESP32_2432S028R) + +#if defined(ILI9341_DRIVER) auto _panel_instance = new lgfx::Panel_ILI9341(); +#elif defined(ILI9342_DRIVER) + auto _panel_instance = new lgfx::Panel_ILI9342(); +#elif defined(ST7789_DRIVER) + auto _panel_instance = new lgfx::Panel_ST7789(); +#endif auto _bus_instance = new lgfx::Bus_SPI(); auto _touch_instance = new lgfx::Touch_XPT2046(); @@ -675,7 +682,7 @@ void LovyanGfx::init(int w, int h) cfg.dummy_read_pixel = 8; cfg.dummy_read_bits = 1; cfg.readable = true; - cfg.invert = false; + cfg.invert = INVERT_COLORS; cfg.rgb_order = false; cfg.dlen_16bit = false; cfg.bus_shared = false; diff --git a/user_setups/esp32/esp32-2832s028.ini b/user_setups/esp32/esp32-2832s028.ini index 5cc2802a..086a9a3c 100644 --- a/user_setups/esp32/esp32-2832s028.ini +++ b/user_setups/esp32/esp32-2832s028.ini @@ -92,3 +92,31 @@ lib_deps = ;${tft_espi.lib_deps} ${lovyangfx.lib_deps} ;${goodix.lib_deps} + + +[env:esp32-2432s028r-ili9342_4MB] +extends = esp32-2432s028r, flash_4mb +build_flags = + ${esp32-2432s028r.build_flags} + -D ILI9342_DRIVER=1 + -D INVERT_COLORS=1 + -D TOUCH_DRIVER=0x2046 ; XPT2606 Resistive touch panel driver + -D HASP_USE_LGFX_TOUCH=1 + -D TOUCH_CS=33 + -D TOUCH_SCLK=25 + -D TOUCH_MOSI=32 + -D TOUCH_MISO=39 + -D TOUCH_SDA=-1 + -D TOUCH_SCL=-1 + -D TOUCH_IRQ=36 + -D SPI_FREQUENCY=55000000 + -D SPI_TOUCH_FREQUENCY=2500000 + +; -- Debugging options ----------------------------- +; -D CORE_DEBUG_LEVEL=ARDUHAL_LOG_LEVEL_VERBOSE + +lib_deps = + ${esp32-2432s028r.lib_deps} + ;${tft_espi.lib_deps} + ${lovyangfx.lib_deps} + ;${goodix.lib_deps}