Description
- Making the images work on the arduino lvgl with esp32
What MCU/Processor/Board and compiler are you using?
- Board --> ESP32
- Enviroment --> Arduino with LVGL V7.0
What do you want to achieve?
- Printing the images / JPEG from the .h file
What have you tried so far?
- Tested the code on simulator on Linux and eclipse
- Tested the code on simulator on windows with codeblocks
- Tested the code on ESP-IDF
All the above tests run and are successfully working.
Code to reproduce
Add the relevant code snippets here.
- The only relevant code here which never worked on the arduino is , inside of the header file, the chunk will be pasted below.
/* Any Random .h Image code */
const lv_img_dsc_t _mainScreen_alpha_320x240 = {
.header.always_zero = 0,
.header.w = 320,
.header.h = 240,
.data_size = 76800 * LV_COLOR_SIZE / 8,
.header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA,
.data = _mainScreen_alpha_320x240_map,
};
Screenshot and/or video
- The error i get with the arduino IDE
logo.h:266: error: expected primary-expression before '.' token
.header.always_zero = 0,
^
logo.h:267: error: expected primary-expression before '.' token
.header.w = 320,
^
logo.h:268: error: expected primary-expression before '.' token
.header.h = 240,
^
logo.h:270: error: expected primary-expression before '.' token
.header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA,
^
Yes i have tried the most basic ways to fix it but still have no success with the arduino. i have to finalize the prototype by 15th and i am out of time already.
it will be great if someone can help me solve this perhaps it is like a minor issue but could not solve it for over a week now.
thanks a ton in advance.
hi,
thanks for the prompt reply. really appreciate that, perhaps im still not able to get it working. i know i should give myself some time to fix this but apologies of me being lazy and seeking for help quite quickly over here.
but to get to the point here is the next list of issues
warning: large integer implicitly truncated to unsigned type [-Woverflow]
};
error: invalid conversion from 'const uint8_t* {aka const unsigned char*}' to 'uint32_t {aka unsigned int}' [-fpermissive]
any ideas?
thanks a lot in advance again…
the logo.h
let me attach it
logo.h (1.3 MB)
You can’t initialize the image the way you are trying to do it; it has to be done similarly to how the converter made it.
Please refer to this post for an example of how to make it work on Arduino.
1 Like
hey,
thanks a ton so far so good and the things are at least taking shape the way i want them to work. thank you very much, i failed to search properly on the forum for the solution. apologies. but here is what i did if someone else also ever need the same solution.
what does not work
const lv_img_dsc_t _ra_alpha_320x240 =
{
.header.always_zero = 0,
.header.w = 320,
.header.h = 240,
.data_size = 76800 * LV_COLOR_SIZE / 8,
.header.cf = LV_IMG_CF_TRUE_COLOR_ALPHA,
.data = _ra_alpha_320x240_map,
};
What works with arduino
const lv_img_dsc_t _ra_alpha_320x240 = {
{
LV_IMG_CF_TRUE_COLOR_ALPHA, //Header CF
0, // header.alwayszero
2, // Unknown
320, // Width
240, // height
},
76800 * LV_COLOR_SIZE / 8, // data size
_ra_alpha_320x240_map, // data
};
finally i would like to have some api for the above working example. as i feel like im just aiming blindly if we have to add more features to it.
thanks a lot for the prompt reply and your patience , really appreciate that