Attempting to make a label:
// manually place some labels
lv_obj_t * temp_label = lv_label_create(lv_screen_active());
lv_label_set_text(temp_label, "temperature");
lv_obj_set_style_text_font(temp_label, &LV_FONT_MONTSERRAT_40);
That last line errors:
In file included from C:\Users\pllau\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\libraries\Arduino_H7_Video\src/lv_conf.h:3:0,
from c:\users\pllau\documents\arduino\libraries\lvgl\src/lv_conf_internal.h:58,
from c:\users\pllau\documents\arduino\libraries\lvgl\src/lv_init.h:16,
from c:\users\pllau\documents\arduino\libraries\lvgl\lvgl.h:21,
from C:\Users\pllau\Documents\Arduino\libraries\lvgl\src/lvgl.h:16,
from C:\Users\pllau\Documents\Arduino\chart_lvga_singley\chart_lvga_singley.ino:2:
C:\Users\pllau\Documents\Arduino\chart_lvga_singley\chart_lvga_singley.ino: In function 'void setup()':
C:\Users\pllau\AppData\Local\Arduino15\packages\arduino\hardware\mbed_giga\4.3.1\libraries\Arduino_H7_Video\src/lv_conf_9.h:390:31: error: lvalue required as unary '&' operand
#define LV_FONT_MONTSERRAT_40 0
^
C:\Users\pllau\Documents\Arduino\chart_lvga_singley\chart_lvga_singley.ino:64:43: note: in expansion of macro 'LV_FONT_MONTSERRAT_40'
lv_obj_set_style_text_font(temp_label, &LV_FONT_MONTSERRAT_40);
^
exit status 1
Compilation error: exit status 1
I can’t seem to get that function to work at all. My lvgl.h:
#define LV_FONT_MONTSERRAT_8 0
#define LV_FONT_MONTSERRAT_10 0
#define LV_FONT_MONTSERRAT_12 0
#define LV_FONT_MONTSERRAT_14 0
#define LV_FONT_MONTSERRAT_16 0
#define LV_FONT_MONTSERRAT_18 0
#define LV_FONT_MONTSERRAT_20 0
#define LV_FONT_MONTSERRAT_22 0
#define LV_FONT_MONTSERRAT_24 0
#define LV_FONT_MONTSERRAT_26 0
#define LV_FONT_MONTSERRAT_28 0
#define LV_FONT_MONTSERRAT_30 0
#define LV_FONT_MONTSERRAT_32 0
#define LV_FONT_MONTSERRAT_34 0
#define LV_FONT_MONTSERRAT_36 0
#define LV_FONT_MONTSERRAT_38 0
#define LV_FONT_MONTSERRAT_40 1
#define LV_FONT_MONTSERRAT_42 0
#define LV_FONT_MONTSERRAT_44 0
#define LV_FONT_MONTSERRAT_46 0
#define LV_FONT_MONTSERRAT_48 0
I tried many different fonts. None work. I seem to be following the documentation. What’s going on?
I see a similar topic here:Error: lvalue required as unary '&' operand #define LV_FONT_MONTSERRAT_14 1 but that code doesn’t work in v9.2.
Is this a bug?
I’ve also tried
lv_obj_set_style_text_font(temp_label, &lv_font_montserrat_40);
(lowercase) with a slightly different error:
C:\Users\pllau\Documents\Arduino\chart_lvga_singley\chart_lvga_singley.ino: In function 'void setup()':
C:\Users\pllau\Documents\Arduino\chart_lvga_singley\chart_lvga_singley.ino:66:43: error: 'lv_font_montserrat_40' was not declared in this scope
lv_obj_set_style_text_font(temp_label, &lv_font_montserrat_40, LV_PART_MAIN);
^~~~~~~~~~~~~~~~~~~~~
C:\Users\pllau\Documents\Arduino\chart_lvga_singley\chart_lvga_singley.ino:66:43: note: suggested alternative: 'lv_font_montserrat_14'
lv_obj_set_style_text_font(temp_label, &lv_font_montserrat_40, LV_PART_MAIN);
^~~~~~~~~~~~~~~~~~~~~
lv_font_montserrat_14
exit status 1
Compilation error: 'lv_font_montserrat_40' was not declared in this scope