You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using fonts embedded in the source code, no checks should be made for its presence - this is absurd. However, if the font is used as a binary file, then its absence on the storage device leads to a crash. Using the ESP32-S3 as an example, I can say with confidence that by default, if any critical errors occur, the default system is configured to reboot immediately. If there is no font file, ESP32 will switch to bootloop, and even when monitoring via UART, it will be very difficult to understand the reason. And the reason is trivial - the missing file is due to the human factor.
Idea is this:
Add an error handling function and redefine the lv_binfont_create function in the screens.c template.
#include<Arduino.h>// This is necessary for the delay() function.lv_font_t *_lv_binfont_create(constchar *path_font)
{
lv_font_t *ui_font = lv_binfont_create(path_font);
if (ui_font == NULL)
{
printf("Font at the path \"%s\" not found!!", path_font);
while (1)
{
delay(100);
}
}
return ui_font;
}
// Only below the error handling function, otherwise get "infinite redefinition"!
#definelv_binfont_create _lv_binfont_create
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
When using fonts embedded in the source code, no checks should be made for its presence - this is absurd. However, if the font is used as a binary file, then its absence on the storage device leads to a crash. Using the ESP32-S3 as an example, I can say with confidence that by default, if any critical errors occur, the default system is configured to reboot immediately. If there is no font file, ESP32 will switch to bootloop, and even when monitoring via UART, it will be very difficult to understand the reason. And the reason is trivial - the missing file is due to the human factor.

Idea is this:
Add an error handling function and redefine the
lv_binfont_create
function in thescreens.c
template.I hope it will be useful to someone.
Beta Was this translation helpful? Give feedback.
All reactions