Description
Arduino IDE returns error message that not able to load .c image array converted from lvgl online tool.
What MCU/Processor/Board and compiler are you using?
ESP32 under Arduino IDE.
What do you experience?
I follow lvgl.pdf to convert the jpg image into .c image array online and included into program, I thought everything was followed the lvgl.pdf said. And I got below error:
indo_480_320_http.h:353:4: error: expected primary-expression before ‘.’ token
.header.always_zero = 0,
^
indo_480_320_http.h:354:4: error: expected primary-expression before ‘.’ token
.header.w = 480,
^
indo_480_320_http.h:355:4: error: expected primary-expression before ‘.’ token
.header.h = 320,
^
indo_480_320_http.h:357:4: error: expected primary-expression before ‘.’ token
.header.cf = LV_IMG_CF_INDEXED_4BIT,
^
exit status 1
expected primary-expression before ‘.’ token
The main problem seems happened in the const struct from .c file converted online,
const lv_img_dsc_t indo_480_320_http = {
.header.always_zero = 0,
.header.w = 480,
.header.h = 320,
.data_size = 76864,
.header.cf = LV_IMG_CF_INDEXED_4BIT,
.data = indo_480_320_http_map,
Having searched on internet, I found exactly the same issue : https://github.com/lvgl/lv_arduino/issues/41 Problem remains open.
Code to reproduce
#include "lvgl.h"
#ifndef LV_ATTRIBUTE_MEM_ALIGN
#define LV_ATTRIBUTE_MEM_ALIGN
#endif
#ifndef LV_ATTRIBUTE_IMG_INDO_480_320_HTTP
#define LV_ATTRIBUTE_IMG_INDO_480_320_HTTP
#endif
const LV_ATTRIBUTE_MEM_ALIGN LV_ATTRIBUTE_IMG_INDO_480_320_HTTP unsigned char indo_480_320_http_map[] = {
0x04, 0x02, 0x04, 0xff, /*Color of index 0*/
0x4f, 0x90, 0x14, 0xff, /*Color of index 1*/
0x1c, 0x96, 0xf1, 0xff, /*Color of index 2*/
0x75, 0xd1, 0x24, 0xff, /*Color of index 3*/
0x12, 0x49, 0x76, 0xff, /*Color of index 4*/
0x2c, 0x52, 0x0b, 0xff, /*Color of index 5*/
0x7c, 0xe5, 0x18, 0xff, /*Color of index 6*/
0x63, 0xb9, 0x15, 0xff, /*Color of index 7*/
0x0c, 0x30, 0x4f, 0xff, /*Color of index 8*/
0x15, 0x70, 0xb5, 0xff, /*Color of index 9*/
0x18, 0x2e, 0x06, 0xff, /*Color of index 10*/
0x3b, 0x6f, 0x0f, 0xff, /*Color of index 11*/
0x8a, 0xef, 0x35, 0xff, /*Color of index 12*/
0x14, 0x5c, 0x94, 0xff, /*Color of index 13*/
0x0c, 0x22, 0x34, 0xff, /*Color of index 14*/
0x06, 0x1a, 0x2b, 0xff, /*Color of index 15*/
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
/*
intentionly remove the image array, as it's too large...
*/
};
const lv_img_dsc_t indo_480_320_http = {
.header.always_zero = 0,
.header.w = 480,
.header.h = 320,
.data_size = 76864,
.header.cf = LV_IMG_CF_INDEXED_4BIT,
.data = indo_480_320_http_map,
};