Closed FigueiredoStable closed 6 months ago
both ::init()
methods are identical; since LGFX has a desing pattern for display variants, let's create a Panel_ST7701_Base
to handle the redundant ::init()
and make both Panel_ST7701
and Panel_ST7701_guition_esp32_4848S040
inherit from it:
struct Panel_ST7701_Base : public Panel_RGB
{
bool init(bool) override;
};
struct Panel_ST7701 : public Panel_ST7701_Base
{
protected:
const uint8_t* getInitCommands(uint8_t listno) const override;
};
struct Panel_ST7701_guition_esp32_4848S040: public Panel_ST7701_Base
{
protected:
const uint8_t* getInitCommands(uint8_t listno) const override;
};
Panel_ST7701_Base::init(bool)
Panel_ST7701::init(bool)
Panel_ST7701_guition_esp32_4848S040::init(bool)
both
::init()
methods are identical; since LGFX has a desing pattern for display variants, let's create aPanel_ST7701_Base
to handle the redundant::init()
and make bothPanel_ST7701
andPanel_ST7701_guition_esp32_4848S040
inherit from it:lgfx/v1/platforms/esp32s3/Panel_RGB.hpp
struct Panel_ST7701_Base : public Panel_RGB { bool init(bool) override; }; struct Panel_ST7701 : public Panel_ST7701_Base { protected: const uint8_t* getInitCommands(uint8_t listno) const override; }; struct Panel_ST7701_guition_esp32_4848S040: public Panel_ST7701_Base { protected: const uint8_t* getInitCommands(uint8_t listno) const override; };
lgfx/v1/platforms/esp32s3/Panel_RGB.cpp
- create
Panel_ST7701_Base::init(bool)
- remove
Panel_ST7701::init(bool)
- remove
Panel_ST7701_guition_esp32_4848S040::init(bool)
Great point, i added Panel ST7701 base initialization. Tks
looks good, thanks for your contribution :+1:
@FigueiredoStable Thank you for your contribution. Happy to see that lgfx is working with this panel. Nevertheless I struggle to get it running myself. May I ask if it is possible to share your config file (PIN definitions etc.) to give me a kickstart. Here is my my hacked config. I get a picture but with distorted colors. I'm practicing trial and error for hours and can't get it right.
#define LGFX_USE_V1
#include <LovyanGFX.hpp>
#include <lgfx/v1/platforms/esp32s3/Panel_RGB.hpp>
#include <lgfx/v1/platforms/esp32s3/Bus_RGB.hpp>
#include <driver/i2c.h>
class LGFX : public lgfx::LGFX_Device
{
public:
lgfx::Bus_RGB _bus_instance;
lgfx::Panel_ST7701_guition_esp32_4848S040 _panel_instance;
lgfx::Touch_GT911 _touch_instance;
lgfx::Light_PWM _light_instance;
LGFX(void)
{
{
auto cfg = _panel_instance.config();
cfg.memory_width = 480;
cfg.memory_height = 480;
cfg.panel_width = 480;
cfg.panel_height = 480;
cfg.offset_x = 0;
cfg.offset_y = 0;
_panel_instance.config(cfg);
}
{
auto cfg = _panel_instance.config_detail();
cfg.pin_cs = 39;
cfg.pin_sclk = 48;
cfg.pin_mosi = 47; // SDA
_panel_instance.config_detail(cfg);
}
{
auto cfg = _bus_instance.config();
cfg.panel = &_panel_instance;
cfg.pin_d0 = GPIO_NUM_4; // B0
cfg.pin_d1 = GPIO_NUM_5; // B1
cfg.pin_d2 = GPIO_NUM_6; // B2
cfg.pin_d3 = GPIO_NUM_7; // B3
cfg.pin_d4 = GPIO_NUM_15; // B4
cfg.pin_d5 = GPIO_NUM_8; // G0
cfg.pin_d6 = GPIO_NUM_20; // G1
cfg.pin_d7 = GPIO_NUM_3; // G2
cfg.pin_d8 = GPIO_NUM_46; // G3
cfg.pin_d9 = GPIO_NUM_9; // G4
cfg.pin_d10 = GPIO_NUM_10; // G5
cfg.pin_d11 = GPIO_NUM_11; // R0
cfg.pin_d12 = GPIO_NUM_12; // R1
cfg.pin_d13 = GPIO_NUM_13; // R2
cfg.pin_d14 = GPIO_NUM_14; // R3
cfg.pin_d15 = GPIO_NUM_0; // R4
cfg.pin_henable = GPIO_NUM_18;
cfg.pin_vsync = GPIO_NUM_17;
cfg.pin_hsync = GPIO_NUM_16;
cfg.pin_pclk = GPIO_NUM_21;
cfg.freq_write = 14000000;
cfg.hsync_polarity = 0;
cfg.hsync_front_porch = 10;
cfg.hsync_pulse_width = 8;
cfg.hsync_back_porch = 50;
cfg.vsync_polarity = 0;
cfg.vsync_front_porch = 10;
cfg.vsync_pulse_width = 8;
cfg.vsync_back_porch = 20;
cfg.pclk_idle_high = 0;
cfg.de_idle_high = 1;
_bus_instance.config(cfg);
}
_panel_instance.setBus(&_bus_instance);
{
auto cfg = _light_instance.config();
cfg.pin_bl = GPIO_NUM_38;
_light_instance.config(cfg);
}
_panel_instance.light(&_light_instance);
{
auto cfg = _touch_instance.config();
cfg.x_min = 0;
cfg.x_max = 480;
cfg.y_min = 0;
cfg.y_max = 480;
cfg.bus_shared = false;
cfg.offset_rotation = 0;
cfg.i2c_port = I2C_NUM_1;
cfg.pin_int = GPIO_NUM_NC;
cfg.pin_sda = GPIO_NUM_19;
cfg.pin_scl = GPIO_NUM_45;
cfg.pin_rst = GPIO_NUM_NC;
cfg.freq = 400000;
_touch_instance.config(cfg);
_panel_instance.setTouch(&_touch_instance);
}
// {
// auto cfg = _light_instance.config();
// cfg.pin_bl = GPIO_NUM_44;
// _light_instance.config(cfg);
// }
// _panel_instance.light(&_light_instance);
setPanel(&_panel_instance);
}
};
Thank you for your help.
@FigueiredoStable Thank you for your contribution. Happy to see that lgfx is working with this panel. Nevertheless I struggle to get it running myself. May I ask if it is possible to share your config file (PIN definitions etc.) to give me a kickstart. Here is my my hacked config. I get a picture but with distorted colors. I'm practicing trial and error for hours and can't get it right.
Hy Christian, sure, i can help you i will put here my configuration as soon as a possible ok
Thank you very much. Any help is appreciated.
Thank you very much. Any help is appreciated.
Hi i'am back, i used your instruction in my test code and works very well, so if you use with LVGL i publishied on this repository below:
LovyanGFX-GUITION-ESP32-4848S040
In lv_conf set #define LV_COLOR_16_SWAP 1 because this work with SPI protocol. (prevent color reversed or distorced).
my_disp_flush use DMA to better performance.
I hope the repository help you, otherwise i'am here.
@FigueiredoStable Many, many thanx! That does the trick. You made my day.
@FigueiredoStable Many, many thanx! That does the trick. You made my day.
Glad that helped you Cristian, made my day too!
Just add a new device support for ST7701 manufactured by GUITION, link: GUITION Smart Display
* The board:
* Before the new instructions, colors were inverted or only rendered a partial size of the screen:
* After added instructions by manufacture