I have new code that I tried to run on esp32 and failed. I loaded a code that used to work before and now during compile I have ‘lv_font_montserrat_48’ was not declared errorr and suggest to use the montserrat_14. I used 5 different size font and worked before in each of my sketches.
I tried the latest version in Arduino and reverted back to V3.3.6 but the results are the same. I set it to this version as I use the same in SquareLine Studio the same version. This used to work on previous versions.
This is a snipped of the code for a roller widget
// ROLLER
static lv_style_t style_sel;
lv_style_init(&style_sel);
lv_style_set_text_font(&style_sel, &lv_font_montserrat_48);
static lv_style_t style_def;
lv_style_init(&style_def);
lv_style_set_text_font(&style_def, &lv_font_montserrat_34);
both fonts triggered the same error and all of these fonts are enabled in the lv_conf.h heather file. I use other fonts too at different widgets and every font came up with the same error.
This is the error I get, do not worry about the SPI HOST problem that is a simple change as I switched to different esp32 to see if I get the same error for the fonts and got the same with different esp32 as well.
In file included from g:\documents\arduino\libraries\lvgl\src/misc/lv_log.h:16,
from g:\documents\arduino\libraries\lvgl\lvgl.h:25,
from g:\Documents\Arduino\libraries\lvgl\src/lvgl.h:17,
from G:\Documents\Arduino\LVGL_widgets_FT6236_2_screen_test_WORKING\LVGL_widgets_FT6236_2_screen_test_WORKING.ino:1:
g:\documents\arduino\libraries\lvgl\src\lv_conf_internal.h:46:120: note: #pragma message: Possible failure to include lv_conf.h, please read the comment in this file if you get errors
#pragma message(“Possible failure to include lv_conf.h, please read the comment in this file if you get errors”)
^
G:\Documents\Arduino\LVGL_widgets_FT6236_2_screen_test_WORKING\LVGL_widgets_FT6236_2_screen_test_WORKING.ino: In constructor ‘LGFX::LGFX()’:
G:\Documents\Arduino\LVGL_widgets_FT6236_2_screen_test_WORKING\LVGL_widgets_FT6236_2_screen_test_WORKING.ino:34:22: error: ‘HSPI_HOST’ was not declared in this scope
cfg.spi_host = HSPI_HOST; // 使用するSPIを選択 ESP32-S2,C3 : SPI2_HOST or SPI3_HOST / ESP32 : VSPI_HOST or HSPI_HOST
^~~~~~~~~
G:\Documents\Arduino\LVGL_widgets_FT6236_2_screen_test_WORKING\LVGL_widgets_FT6236_2_screen_test_WORKING.ino:34:22: note: suggested alternative: ‘SPI3_HOST’
cfg.spi_host = HSPI_HOST; // 使用するSPIを選択 ESP32-S2,C3 : SPI2_HOST or SPI3_HOST / ESP32 : VSPI_HOST or HSPI_HOST
^~~~~~~~~
SPI3_HOST
G:\Documents\Arduino\LVGL_widgets_FT6236_2_screen_test_WORKING\LVGL_widgets_FT6236_2_screen_test_WORKING.ino: In function ‘void lv_example_roller_2()’:
G:\Documents\Arduino\LVGL_widgets_FT6236_2_screen_test_WORKING\LVGL_widgets_FT6236_2_screen_test_WORKING.ino:380:41: error: ‘lv_font_montserrat_48’ was not declared in this scope
lv_style_set_text_font(&style_sel, &lv_font_montserrat_48);
^~~~~~~~~~~~~~~~~~~~~
G:\Documents\Arduino\LVGL_widgets_FT6236_2_screen_test_WORKING\LVGL_widgets_FT6236_2_screen_test_WORKING.ino:380:41: note: suggested alternative: ‘lv_font_montserrat_14’
lv_style_set_text_font(&style_sel, &lv_font_montserrat_48);
^~~~~~~~~~~~~~~~~~~~~
lv_font_montserrat_14
G:\Documents\Arduino\LVGL_widgets_FT6236_2_screen_test_WORKING\LVGL_widgets_FT6236_2_screen_test_WORKING.ino:384:41: error: ‘lv_font_montserrat_34’ was not declared in this scope
lv_style_set_text_font(&style_def, &lv_font_montserrat_34);
^~~~~~~~~~~~~~~~~~~~~
G:\Documents\Arduino\LVGL_widgets_FT6236_2_screen_test_WORKING\LVGL_widgets_FT6236_2_screen_test_WORKING.ino:384:41: note: suggested alternative: ‘lv_font_montserrat_14’
lv_style_set_text_font(&style_def, &lv_font_montserrat_34);
^~~~~~~~~~~~~~~~~~~~~
lv_font_montserrat_14
G:\Documents\Arduino\LVGL_widgets_FT6236_2_screen_test_WORKING\LVGL_widgets_FT6236_2_screen_test_WORKING.ino:450:52: error: ‘lv_font_montserrat_26’ was not declared in this scope
lv_obj_set_style_text_font(label_set_tension, &lv_font_montserrat_26, 0); // Setting the font size
^~~~~~~~~~~~~~~~~~~~~
G:\Documents\Arduino\LVGL_widgets_FT6236_2_screen_test_WORKING\LVGL_widgets_FT6236_2_screen_test_WORKING.ino:450:52: note: suggested alternative: ‘lv_font_montserrat_14’
lv_obj_set_style_text_font(label_set_tension, &lv_font_montserrat_26, 0); // Setting the font size
^~~~~~~~~~~~~~~~~~~~~
lv_font_montserrat_14
G:\Documents\Arduino\LVGL_widgets_FT6236_2_screen_test_WORKING\LVGL_widgets_FT6236_2_screen_test_WORKING.ino:475:39: error: ‘lv_font_montserrat_40’ was not declared in this scope
lv_obj_set_style_text_font(btn2, &lv_font_montserrat_40, 0); // Setting the font size
^~~~~~~~~~~~~~~~~~~~~
G:\Documents\Arduino\LVGL_widgets_FT6236_2_screen_test_WORKING\LVGL_widgets_FT6236_2_screen_test_WORKING.ino:475:39: note: suggested alternative: ‘lv_font_montserrat_14’
lv_obj_set_style_text_font(btn2, &lv_font_montserrat_40, 0); // Setting the font size
^~~~~~~~~~~~~~~~~~~~~
lv_font_montserrat_14
G:\Documents\Arduino\LVGL_widgets_FT6236_2_screen_test_WORKING\LVGL_widgets_FT6236_2_screen_test_WORKING.ino:553:47: error: ‘lv_font_montserrat_22’ was not declared in this scope
lv_obj_set_style_text_font(slider_label, &lv_font_montserrat_22, 0); // Setting the font size
^~~~~~~~~~~~~~~~~~~~~
G:\Documents\Arduino\LVGL_widgets_FT6236_2_screen_test_WORKING\LVGL_widgets_FT6236_2_screen_test_WORKING.ino:553:47: note: suggested alternative: ‘lv_font_montserrat_14’
lv_obj_set_style_text_font(slider_label, &lv_font_montserrat_22, 0); // Setting the font size
^~~~~~~~~~~~~~~~~~~~~
lv_font_montserrat_14
exit status 1
Compilation error: ‘HSPI_HOST’ was not declared in this scope
Is LV_FONT_MONTSERRAT_48
enabled in lv_conf.h
?
yes, all the relevant fonts are enabled that is why I do not get what is happening.
Just as test, please try adding this in your main.c
:
#if LV_FONT_MONTSERRAT_48
#error "ENABLED!"
#endif
You can also try
- cleaning and rebuilding the project.
- add
#error "ENABLED!" to
lv_font_montserrat_48.c` to see it’s really enabled