Skip to content
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

LVGL8 isn't compat with LVGL demos #8

Closed
GPSBabelDeveloper opened this issue Mar 13, 2022 · 3 comments
Closed

LVGL8 isn't compat with LVGL demos #8

GPSBabelDeveloper opened this issue Mar 13, 2022 · 3 comments

Comments

@GPSBabelDeveloper
Copy link

Hi, and thank you (again). I was about to drive a 7735 from BL602, and thought I'd give your demos a try.
Of course, the resolution is wrong and the chip is wrong, but I thought that would be a few easy #defines to tweak. Of course, it never is that easy.

In section 10.2 of there is a git submodule add https://github.com/lvgl/lvgl , which pulls in trunk of LVGL.

"And that's where the plot sours."

LVGL seems to hold cross-version compatibility is low regard, which is an unfortunate trait for a library. I scoured dozens and dozens of reports and complaints and the general advice for those with existing code is to basically not upgrade. In https://forum.lvgl.io/t/lvgl-v8-is-available-for-testing/4924/68 one of th maintainers says "one either has to rewrite their entire application, or stick with the older major release and patch it."

Your demos seem to be written for LVGL7.something (determining which 7.something isn't trivial) but the LVGL trunk is now 8.2 and they incompatible. I got as far as the changes below and then I ran into dozens of link errors.

Realizing I was drifting further and further from my goal ("easy sanity check of hardware") and needing to change the chip drivers, enter an untested land of LVGL, to ultimately do it all on another OS, and battling Git in wanting to take a submodule from a branch, I realized I was in the Sunk Cost Fallacy and needed to flee. Exactly none of this is your fault and some of it was expected. I merely post this as a cautionary tale (and Google fodder) to those expecting to build these projects.

I post this with absolutely no expectations of fixes. If anything, the smart money for your project is to just pin the module to whatever version of LVGL you were happily using.

Thank you for all the examples.

--- a/customer_app/sdk_app_st7789/sdk_app_st7789/lv_port_disp.c
+++ b/customer_app/sdk_app_st7789/sdk_app_st7789/lv_port_disp.c
@@ -75,9 +75,14 @@ void lv_port_disp_init(void)
/* LVGL requires a buffer where it draws the objects. The buffer's has to b
e greater than 1 display row
* We create ONE buffer with 10 rows. LVGL will draw the display's content
here and writes it to the display
* */

+#if 0
static lv_disp_buf_t disp_buf_1;
lv_disp_buf_init(&disp_buf_1, spi_tx_buf, NULL, LV_HOR_RES_MAX * BUFFER_ROW
S); /Initialize the display buffer/
+#else

  • static lv_disp_draw_buf_t disp_buf_1;

  • static lv_color_t buf_1[LV_HOR_RES_MAX * 10]; /A buffer for 10 rows/

  • lv_disp_draw_buf_init(&disp_buf_1, buf_1, NULL, LV_HOR_RES_MAX * 10); /Initialize the display buffer/
    +#endif

    /*-----------------------------------

    • Register the display in LVGL
      @@ -96,7 +104,9 @@ void lv_port_disp_init(void)
      disp_drv.flush_cb = disp_flush;

    /Set a display buffer/
    +#if 0
    disp_drv.buffer = &disp_buf_1;
    +#else

  • // do something
    +#endif

#if LV_USE_GPU
/Optionally add functions to access the GPU. (Only in buffered mode, LV_VDB_SIZE != 0)/

 diff --git a/customer_app/sdk_app_st7789/sdk_app_st7789/lvgl.c b/customer_app/sdk_app_st7789/sdk_app_st7789/lvgl.c

index 7f61ba12..9f0a361e 100644
--- a/customer_app/sdk_app_st7789/sdk_app_st7789/lvgl.c
+++ b/customer_app/sdk_app_st7789/sdk_app_st7789/lvgl.c
@@ -54,11 +54,11 @@ int lvgl_create(void) {
lvgl_created = true;
printf("Create LVGL widgets...\r\n");

  • btn = lv_btn_create(lv_scr_act(), NULL); // Add a button the current screen
  • btn = lv_btn_create(lv_scr_act()); // Add a button the current screen
    lv_obj_set_pos(btn, 10, 80); // Set its position
    lv_obj_set_size(btn, 220, 80); // Set its size
  • label = lv_label_create(btn, NULL); // Add a label to the button
  • label = lv_label_create(btn); // Add a label to the button
    lv_label_set_text(label, "BL602 LVGL"); // Set the label text
    return 0;
    }
    @@ -88,4 +88,4 @@ int lvgl_render(void) {
    // Call LVGL to render the display and flush our display driver
    lv_task_handler();
    return 0;
    -}
    \ No newline at end of file
    +}
@lupyuen
Copy link
Owner

lupyuen commented Mar 13, 2022

Thanks for the fixes :-) Sorry my code won't work with the latest "hosal" HAL in BL IoT SDK, because the SPI HAL has changed.

I'm planning to redo the LVGL app with NuttX instead. NuttX has built-in support for LVGL, so it might be simpler: https://docs.lvgl.io/latest/en/html/get-started/nuttx.html

I'll also work on SPI DMA for BL602 NuttX, since we'll be pushing lots of pixel data to the display.

BTW: BL MCU SDK also supports LVGL: https://github.com/bouffalolab/bl_mcu_sdk/tree/master/components/lvgl

@GPSBabelDeveloper
Copy link
Author

GPSBabelDeveloper commented Mar 13, 2022 via email

@lupyuen
Copy link
Owner

lupyuen commented Mar 25, 2022

Let's move to NuttX since LVGL works fine with ST7789 thanks :-)

https://github.com/lupyuen/st7789-nuttx

@lupyuen lupyuen closed this as completed Mar 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants