LovyanGFX Settings for 7" Display
I've recently bought a few Elecrow ESP32 Displays. I've been getting them to work with various Arduino graphics libraries and have found several working configurations.
I was unable to get the 7" screen to work properly with recent versions of Arduino_GFX, but this configuration works for me with the 7" display using the latest LovyanGFX library:
class LGFX : public lgfx::LGFX_Device { public: lgfx::Bus_RGB _bus_instance; lgfx::Panel_RGB _panel_instance; lgfx::Light_PWM _light_instance; lgfx::Touch_GT911 _touch_instance; LGFX(void) { { auto cfg = _panel_instance.config(); cfg.memory_width = 800; cfg.memory_height = 480; cfg.panel_width = 800; cfg.panel_height = 480; cfg.offset_x = 0; cfg.offset_y = 0; _panel_instance.config(cfg); } { auto cfg = _bus_instance.config(); cfg.panel = &_panel_instance; cfg.pin_d0 = GPIO_NUM_15; // B0 cfg.pin_d1 = GPIO_NUM_7; // B1 cfg.pin_d2 = GPIO_NUM_6; // B2 cfg.pin_d3 = GPIO_NUM_5; // B3 cfg.pin_d4 = GPIO_NUM_4; // B4 cfg.pin_d5 = GPIO_NUM_9; // G0 cfg.pin_d6 = GPIO_NUM_46; // G1 cfg.pin_d7 = GPIO_NUM_3; // G2 cfg.pin_d8 = GPIO_NUM_8; // G3 cfg.pin_d9 = GPIO_NUM_16; // G4 cfg.pin_d10 = GPIO_NUM_1; // G5 cfg.pin_d11 = GPIO_NUM_14; // R0 cfg.pin_d12 = GPIO_NUM_21; // R1 cfg.pin_d13 = GPIO_NUM_47; // R2 cfg.pin_d14 = GPIO_NUM_48; // R3 cfg.pin_d15 = GPIO_NUM_45; // R4 cfg.pin_henable = GPIO_NUM_41; cfg.pin_vsync = GPIO_NUM_40; cfg.pin_hsync = GPIO_NUM_39; cfg.pin_pclk = GPIO_NUM_0; cfg.freq_write = 12000000; cfg.hsync_polarity = 0; cfg.hsync_front_porch = 40; cfg.hsync_pulse_width = 48; cfg.hsync_back_porch = 40; cfg.vsync_polarity = 0; cfg.vsync_front_porch = 1; cfg.vsync_pulse_width = 31; cfg.vsync_back_porch = 13; cfg.pclk_active_neg = 1; cfg.de_idle_high = 0; cfg.pclk_idle_high = 0; _bus_instance.config(cfg); } _panel_instance.setBus(&_bus_instance); { auto cfg = _light_instance.config(); cfg.pin_bl = GPIO_NUM_2; _light_instance.config(cfg); } _panel_instance.light(&_light_instance); { auto cfg = _touch_instance.config(); cfg.x_min = 0; cfg.x_max = 799; cfg.y_min = 0; cfg.y_max = 479; cfg.pin_int = -1; cfg.pin_rst = -1; cfg.bus_shared = false; cfg.offset_rotation = 0; cfg.i2c_port = I2C_NUM_1; cfg.pin_sda = GPIO_NUM_19; cfg.pin_scl = GPIO_NUM_20; cfg.freq = 400000; cfg.i2c_addr = 0x14; _touch_instance.config(cfg); _panel_instance.setTouch(&_touch_instance); } setPanel(&_panel_instance); } };
Comments
Hi,
I have tried many combinations, and could not make only one example working with displays.
lvgl factory example for 7" : sha256 failed comparison.
GfX library for arduino : Hello example : black screen
LovyanGFX : black screen
U8g2 : which screen to select ?
Could you give a working example, with the version used (ide arduino, ESP32 espressif...) ?
Thanks for sharing your experience.
Cordially
Hi, please try the v2.0.3 of esp32 package.
Take a look at the sketch and settings I posted here: ESP32 HMI Demo Code Updated - compatible with new version of esp32 package — ELECROW - FORUM
I'm still trying to get my 7" screen to work with Squareline Studios, but cannot seem to get it to work! Files seem to export from Squareline well, and I can even upload them. The home screen is displayed, as well as my buttons, but the buttons don't do anything. I can get the coordinates of where I touch the screen to show up, but they don't seem to register in the UI or make the UI perform the events that I set up. Can anyone take a look at this and point me in the right direction? So frustrated and have spent so much time trying to get this to work.
https://github.com/jrodanapolis/WE-UI
Hello @jrodanapolis ,
The touch is rotated 180°, your button is set at the top of the screen, but it only responds when you touch at the bottom of the screen. Please modify the origins of the x-axis and y-axis
Thank you Elecrow - works perfectly, finally!
Here is my updated code for any others trying to use this screen with Squareline. Should work with all UI's, just keep the .ino and touch.h files the same but replace my ui files with yours.
https://github.com/jrodanapolis/WE-UI_SLS