-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A few questions about setting up a project via menuconfig #277
Comments
Hello @SinglWolf , TL;DR Nobody has done it yet. Few thoughts on this:
There is a comment: /**
* Initialize a display driver with default values.
* It is used to surly have known values in the fields ant not memory junk.
* After it you can set the fields.
* @param driver pointer to driver variable to initialize
*/ so feel free to change(lower) Just out of my curiosity, why do you need to change display driver on runtime? Do you plan to support different displays with single binary? (haven't checked you project yet, sry ¯_(ツ)_/¯) FYI: the code was heavily modified in latest release of LVGL, see here:
|
Not entirely true statement. There are several places in the library where the
And I am using this widget.
Yes, I want to support multiple displays on the same firmware. Collecting separate firmware for a separate display is tedious and simply wrong. |
Again, just above the DISP_BUF_SIZE there is a comment:
|
I'll check draw_label issue tomorrow |
I read this. But another macro depends on the value of the |
Here is an example of my display initialization code: lv_init();
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
if (MainConfig->lcd_type == 0) // ILI9341
{
disp_drv.hor_res = 320;
disp_drv.ver_res = 240;
}
else if (MainConfig->lcd_type == 1) // ILI9488
{
disp_drv.hor_res = 480;
disp_drv.ver_res = 320;
}
static lv_color_t *buf1 = NULL;
static uint16_t disp_buff_size = 0, max_transfer = 0;
if ((MainConfig->lcd_type == 0) || (MainConfig->lcd_type == 1))
{
disp_buff_size = disp_drv.hor_res * 40;
}
if (!bigSram())
{
disp_buff_size = disp_drv.hor_res * 20;
}
if (MainConfig->lcd_type == 0) // ILI9341
{
max_transfer = disp_buff_size * 2;
}
else if (MainConfig->lcd_type == 1) // ILI9488
{
max_transfer = disp_buff_size * 3;
}
/* Initialize SPI or I2C bus used by the drivers */
lvgl_driver_init(max_transfer);
/* ****** */
ESP_LOGI(TAG, "Display buffer size: %d", disp_buff_size);
lv_disp_buf_init(&disp_buf, buf1, buf2, size_in_px);
/* ****** */
disp_drv.flush_cb = disp_driver_flush;
disp_drv.buffer = &disp_buf;
lv_disp_drv_register(&disp_drv); My fixes in /* Initialize detected SPI and I2C bus and devices */
// void lvgl_driver_init(void);
void lvgl_driver_init(uint16_t max_transfer_size);
/* Interface and driver initialization */
void lvgl_driver_init(uint16_t max_transfer_size)
{
// ESP_LOGI(TAG, "Display hor size: %d, ver size: %d", LV_HOR_RES_MAX, LV_VER_RES_MAX);
// ESP_LOGI(TAG, "Display buffer size: %d", DISP_BUF_SIZE);
ESP_LOGI(TAG, "Initializing shared SPI master");
gpio_num_t miso;
gpio_num_t mosi;
gpio_num_t sclk;
gpio_get_spi_bus_lcd(&miso, &mosi, &sclk);
lvgl_spi_driver_init(LCD_HOST,
miso, mosi, sclk,
max_transfer_size, 1,
-1, -1);
disp_spi_add_device(LCD_HOST);
tp_spi_add_device(LCD_HOST);
disp_driver_init();
touch_driver_init();
return;
/* ****** */
}
void lv_disp_drv_init(lv_disp_drv_t * driver)
{
_lv_memset_00(driver, sizeof(lv_disp_drv_t));
driver->flush_cb = NULL;
// driver->hor_res = LV_HOR_RES_MAX; // It makes no sense to initialize
// driver->ver_res = LV_VER_RES_MAX; // It makes no sense to initialize
driver->buffer = NULL;
driver->rotated = LV_DISP_ROT_NONE;
driver->sw_rotate = 0;
driver->color_chroma_key = LV_COLOR_TRANSP;
driver->dpi = LV_DPI;
/* ****** */
} I showed the code that I will use in my project, as food for thought, an idea, but not as a requirement to remake the library in this way. |
This issue or pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I'm waiting for the developer's answer. |
Hi, So back to you original question:
Change like this requires huge refactoring as multidisplay setups were not taken into account when designing these drivers. There is refactoring planned, but it will take ~months.
This is a topic for
Some displays swap these bytes in their graphical interface. We are lucky enough to have this handled by LVGL. Since LVGL does not know which display controller are you going to use, you have to specify this option at compile time.
You could have saved 'a lot of time and effort' by reading the README, which I'd like to encourage you to read in every open-source project. Thanks for those points, we will definitely take them into account. |
I never got an answer. I am also sincerely convinced that connecting the touchscreen controller to a separate SPI bus is only suitable for demonstration purposes. For example, the ESP32-S2 only has 2 SPI buses and the VS1053 module can no longer be connected. |
Checked on Wrover-kit with following setup:
Everything works as expected.
Off topic. Closing this issue. |
I express my deep gratitude for the wonderful library. My project sparkled with new colors and acquired new opportunities. Thank you! BUT there are a few annoying points.
Why is there no way to select a display driver at runtime? Flash size 4M (or larger) allows you to store multiple display driver code.
Only 1 display driver (touchscreen driver) is always available in a project. It is even spelled out at the CMakeLists.txt level.
Why is there no way to dynamically change the
LV_HOR_RES_MAX
andLV_VER_RES_MAX
values depending on the display driver (for example, as an external variable)?For example, for
ILI9341
LV_HOR_RES_MAX
= 320,LV_VER_RES_MAX
= 240. And forILI9488
LV_HOR_RES_MAX
= 480,LV_VER_RES_MAX
= 320.There are many places in the
lvgl
library as well as in thelvgl_esp32_drivers
files where theLV_HOR_RES_MAX
andLV_VER_RES_MAX
macros are used. E.g.When choosing a
DARK
theme, theLIGHT
theme always remains.Kconfig
lv_conf_internal.h
Initially I used the
ILI9341
driver and theLV_COLOR_16_SWAP
option was selected in the menuconfig.When the
ILI9488
driver was selected, the color display on the screen was incorrect. I spent a lot of time and effort to understand the problem of disgusting color on the display. The color was broken due to the selectedLV_COLOR_16_SWAP
option.Of course, I can modify the source myself to fix these problems. But on the next update, everything will break again.
The text was updated successfully, but these errors were encountered: