diff --git a/.gitignore b/.gitignore index 6cc26bf2..5b934592 100644 --- a/.gitignore +++ b/.gitignore @@ -8,11 +8,12 @@ bin/* data/* !data/edit.htm !data/edit.htm.gz -!data/vars.css +!data/openhasp.ttf !data/style.css !data/style.css.gz !data/script.js !data/script.js.gz +!data/vars.css !data/cert/ !data/cert/x509_crt_bundle.bin !data/static/ diff --git a/data/openhasp.ttf b/data/openhasp.ttf new file mode 100644 index 00000000..a44d5e58 Binary files /dev/null and b/data/openhasp.ttf differ diff --git a/lib/lv_lib_freetype/lv_freetype.c b/lib/lv_lib_freetype/lv_freetype.c index 4af20eb7..0f38e308 100644 --- a/lib/lv_lib_freetype/lv_freetype.c +++ b/lib/lv_lib_freetype/lv_freetype.c @@ -6,7 +6,6 @@ /********************* * INCLUDES *********************/ -#include "lv_freetype.h" #if LV_USE_FREETYPE #include "ft2build.h" diff --git a/src/hasp/hasp_font.cpp b/src/hasp/hasp_font.cpp index 8959f2fb..efbe329f 100644 --- a/src/hasp/hasp_font.cpp +++ b/src/hasp/hasp_font.cpp @@ -23,6 +23,11 @@ typedef struct #include "hasp_mem.h" #include "font/hasp_font_loader.h" +extern const uint8_t OPENHASP_TTF_START[] asm("_binary_data_openhasp_ttf_start"); +extern const uint8_t OPENHASP_TTF_END[] asm("_binary_data_openhasp_ttf_end"); +extern const uint8_t OPENHASPLITE_TTF_START[] asm("_binary_data_openhasplite_ttf_start"); +extern const uint8_t OPENHASPLITE_TTF_END[] asm("_binary_data_openhasplite_ttf_end"); + static lv_ll_t hasp_fonts_ll; typedef struct @@ -162,7 +167,7 @@ static lv_font_t* font_add_to_list(const char* payload) size_t pos = font_split_payload(payload); if(pos > 0 && pos < 56) { uint16_t size = atoi(payload + pos); - if(payload[pos - 1] == '_') pos--; // trancate trailing underscore + if(payload[pos - 1] == '_') pos--; // truncate trailing underscore char fontname[256]; memset(fontname, 0, sizeof(fontname)); @@ -182,10 +187,11 @@ static lv_font_t* font_add_to_list(const char* payload) } lv_ft_info_t info; - info.name = filename; - info.weight = size; - info.mem = NULL; - info.style = FT_FONT_STYLE_NORMAL; + info.name = filename; + info.weight = size; + info.mem = NULL; + info.mem_size = 0; + info.style = FT_FONT_STYLE_NORMAL; LOG_VERBOSE(TAG_FONT, F("Loading font %s size %d"), filename, size); if(lv_ft_font_init(&info)) { font = info.font; @@ -194,6 +200,24 @@ static lv_font_t* font_add_to_list(const char* payload) } } } + + if(!font) { + strcpy(filename, "openhasp"); + uint16_t size = atoi(payload); + if(size > 8) { + lv_ft_info_t info; + info.name = filename; + info.weight = size; + info.mem = (const void*) OPENHASP_TTF_START; + info.mem_size = OPENHASP_TTF_END - OPENHASP_TTF_START; + info.style = FT_FONT_STYLE_NORMAL; + LOG_VERBOSE(TAG_FONT, F("Loading font %s size %d"), filename, size); + if(lv_ft_font_init(&info)) { + font = info.font; + font_type = 1; + } + } + } #endif if(!font) return NULL; diff --git a/user_setups/esp32/_esp32.ini b/user_setups/esp32/_esp32.ini index fa4b8d26..5dfcea02 100644 --- a/user_setups/esp32/_esp32.ini +++ b/user_setups/esp32/_esp32.ini @@ -7,6 +7,8 @@ debug_tool = esp-prog debug_init_break = tbreak setup board_build.embed_files = data/edit.htm.gz + data/openhasp.ttf + data/openhasplite.ttf data/style.css.gz data/script.js.gz data/cert/x509_crt_bundle.bin diff --git a/user_setups/esp32/freetouchdeck.ini b/user_setups/esp32/freetouchdeck.ini index 9ab6d86e..b311d62e 100644 --- a/user_setups/esp32/freetouchdeck.ini +++ b/user_setups/esp32/freetouchdeck.ini @@ -10,9 +10,8 @@ board = esp32dev build_flags = ${env.build_flags} ${esp32.build_flags} + ${esp32.ps_ram} -D HASP_MODEL="FreeTouchDeck" - -DBOARD_HAS_PSRAM ; uses 78kB - ;-mfix-esp32-psram-cache-issue ; uses 24kB ;region -- TFT_eSPI build options ------------------------ ${esp32.vspi} ; Use VSPI hardware SPI bus