adafruit / Adafruit_LvGL_Glue

“Glue” library between LittlevGL and Adafruit GFX (SPITFT)
Other
35 stars 14 forks source link

Multiple Errors When Compiling Library #2

Closed lambrou closed 3 years ago

lambrou commented 4 years ago
  1. include Adafruit_LvGL_Glue library
  2. Compile
  3. Does this with or without the example code.

Errors:

C:\Users\alexander\Documents\Arduino\libraries\Adafruit_LittlevGL_Glue_Library\Adafruit_LvGL_Glue.cpp:65:63: error: 'struct _lv_indev_drv_t' has no member named 'user_data'
   Adafruit_LvGL_Glue *glue = (Adafruit_LvGL_Glue *)indev_drv->user_data;
                                                               ^~~~~~~~~
C:\Users\alexander\Documents\Arduino\libraries\Adafruit_LittlevGL_Glue_Library\Adafruit_LvGL_Glue.cpp: In function 'void lv_flush_callback(lv_disp_drv_t*, const lv_area_t*, lv_color_t*)':
C:\Users\alexander\Documents\Arduino\libraries\Adafruit_LittlevGL_Glue_Library\Adafruit_LvGL_Glue.cpp:186:58: error: 'lv_disp_drv_t' {aka 'struct _disp_drv_t'} has no member named 'user_data'
   Adafruit_LvGL_Glue *glue = (Adafruit_LvGL_Glue *)disp->user_data;
                                                          ^~~~~~~~~
C:\Users\alexander\Documents\Arduino\libraries\Adafruit_LittlevGL_Glue_Library\Adafruit_LvGL_Glue.cpp: In member function 'LvGLStatus Adafruit_LvGL_Glue::begin(Adafruit_SPITFT*, void*, bool)':
C:\Users\alexander\Documents\Arduino\libraries\Adafruit_LittlevGL_Glue_Library\Adafruit_LvGL_Glue.cpp:356:17: error: 'lv_disp_drv_t' {aka 'struct _disp_drv_t'} has no member named 'user_data'
     lv_disp_drv.user_data = (lv_disp_drv_user_data_t)this;
                 ^~~~~~~~~
C:\Users\alexander\Documents\Arduino\libraries\Adafruit_LittlevGL_Glue_Library\Adafruit_LvGL_Glue.cpp:364:20: error: 'lv_indev_drv_t' {aka 'struct _lv_indev_drv_t'} has no member named 'user_data'
       lv_indev_drv.user_data = (lv_indev_drv_user_data_t)this;
                    ^~~~~~~~~
ladyada commented 4 years ago

looks like something changed with lvgl in the last two months

@PaintYourDragon take a look some time this week?

lambrou commented 4 years ago

I just found this: According to: https://github.com/lvgl/lvgl/blob/master/CHANGELOG.md There is a planned release on 07.07.2020 that will

  • Add user_data to themes

It may get fixed on its own.

ladyada commented 4 years ago

oki for now you can use an earlier version of lvgl

PaintYourDragon commented 4 years ago

Confirmed, please use a 2.X release of lv_arduino for the time being.

Version 3 of lv_arduino introduced a number of breaking changes. Not just user_data, but some function names and very different behavior with styles. This is going to require changes to LvGL_Glue and all of the widget examples.

If you want to brave it on your own with 3.x, in lv_conf.h you must enable user_data explicitly (it's no longer the default, but LvGL_Glue requires it):

define LV_USE_USER_DATA 1

That’ll fix the user_data parts, and the “Hello” examples will compile and run. Beyond that it gets complicated. The btnm functions have been renamed btnmatrix (it’s possible other widget functions have been renamed, I haven’t gone through the whole set). Handling of styles is altogether different and is not a search-and-replace operation. Looking at newer LittlevGL examples might be helpful there, I don’t know.

photomoose commented 4 years ago

Another thing that has changed: if you enable LV_USE_LOG you will discover that the logging callback function prototype has changed.

Previously, it was:

typedef void (*lv_log_print_g_cb_t)(lv_log_level_t level, const char *, uint32_t, const char *);

Now, it is:

typedef void (*lv_log_print_g_cb_t)(lv_log_level_t level, const char *, uint32_t, const char *, const char *);

This results in compilation errors similar to below:

.pio/libdeps/featheresp32/Adafruit LittlevGL Glue Library/Adafruit_LvGL_Glue.cpp: In member function 'LvGLStatus Adafruit_LvGL_Glue::begin(Adafruit_SPITFT*, void*, bool)':
.pio/libdeps/featheresp32/Adafruit LittlevGL Glue Library/Adafruit_LvGL_Glue.cpp:324:38: error: invalid conversion from 'void (*)(lv_log_level_t, const char*, uint32_t, const char*) {aka void (*)(signed char, const char*, unsigned int, const char*)}' to 'lv_log_print_g_cb_t {aka void (*)(signed char, const char*, unsigned int, const char*, const char*)}' [-fpermissive]
     lv_log_register_print_cb(lv_debug); // Register debug print function
ngeisler11 commented 3 years ago

Confirmed, please use a 2.X release of lv_arduino for the time being.

Version 3 of lv_arduino introduced a number of breaking changes. Not just user_data, but some function names and very different behavior with styles. This is going to require changes to LvGL_Glue and all of the widget examples.

If you want to brave it on your own with 3.x, in lv_conf.h you must enable user_data explicitly (it's no longer the default, but LvGL_Glue requires it):

define LV_USE_USER_DATA 1

That’ll fix the user_data parts, and the “Hello” examples will compile and run. Beyond that it gets complicated. The btnm functions have been renamed btnmatrix (it’s possible other widget functions have been renamed, I haven’t gone through the whole set). Handling of styles is altogether different and is not a search-and-replace operation. Looking at newer LittlevGL examples might be helpful there, I don’t know.

@PaintYourDragon, Apologies if there is another post answering this (I haven't been able to find anything recent) but I am trying to better understand myself the gaps between the 2.1.5 and updating to the 3.X version of lv-arduino.

I currently have an app working with 2.1.5, but there are a few things in the latest version of LVGL that i would love to take advantage of. If I were to upgrade to v3.X of lv_arduino, and I make that change you mention above to resolve the user_data change, are there a bunch of dependencies the the lvgl_Glue library has which i would also need to fix? I am not using any of the examples and so if those break that's OK, and I am also able to go and update my own app code to use the new LVGL v7 semantics (such as Styles), but where I am unsure of is if there is a whole bucket of other things that the Glue library does that I would be missing.

Thanks for the help.

ladyada commented 3 years ago

if you are able to get it working with the latest version and submit a PR, we'd review it...however we'd not merge code that breaks any examples

PaintYourDragon commented 3 years ago

I don’t recall any dependency changes…last I checked, it was just the required configuration and function name changes mentioned above. But it’s been a while.

The guide and examples will stick with 2.X for the time being. If you can get things to compile with 3.X, best bet might be to mash up LvGL_Glue examples for the display setup and code from the lv_examples (a separate download in the Library Manager) for the 3.X-ification.

ngeisler11 commented 3 years ago

@PaintYourDragon - you are correct. I went through and made the change you mentioned:

define LV_USE_USER_DATA 1

And that was all that was needed to get it working. I didn't make any other changes and I have been able to use v7 with the new lvgl style implementation.

The only issue I have seen is the one mentioned in this issue: https://github.com/lvgl/lvgl/issues/1241 where the placeholder alignment doesn't follow in an textarea.