Bring back 2 bitmap fonts

This commit is contained in:
fvanroie 2023-01-18 20:52:21 +01:00
parent b3a641db15
commit 1e517c3b24
5 changed files with 138 additions and 117 deletions

Binary file not shown.

View File

@ -376,7 +376,7 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
/*==================
* FONT USAGE
*===================*/
#if HASP_USE_FREETYPE<=0
#if 1 || HASP_USE_FREETYPE<=0
#if TFT_HEIGHT>=480 && TFT_WIDTH>=480
#ifndef ROBOTOCONDENSED_REGULAR_24_LATIN1
#define ROBOTOCONDENSED_REGULAR_24_LATIN1 1
@ -384,14 +384,16 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef ROBOTOCONDENSED_REGULAR_32_LATIN1
#define ROBOTOCONDENSED_REGULAR_32_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1
#define ROBOTOCONDENSED_REGULAR_48_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_64_LATIN1
#define ROBOTOCONDENSED_REGULAR_64_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_16_LATIN1
#define ROBOTOCONDENSED_REGULAR_16_LATIN1 1
#if HASP_USE_FREETYPE<=0
#ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1
#define ROBOTOCONDENSED_REGULAR_48_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_64_LATIN1
#define ROBOTOCONDENSED_REGULAR_64_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_16_LATIN1
#define ROBOTOCONDENSED_REGULAR_16_LATIN1 1
#endif
#endif
#ifndef HASP_FONT_1
@ -400,14 +402,16 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef HASP_FONT_2
#define HASP_FONT_2 robotocondensed_regular_32_latin1 /* 5% Width */
#endif
#ifndef HASP_FONT_3
#define HASP_FONT_3 robotocondensed_regular_48_latin1 /* 10% Width */
#endif
#ifndef HASP_FONT_4
#define HASP_FONT_4 robotocondensed_regular_64_latin1 /* 10% Height */
#endif
#ifndef HASP_FONT_5
#define HASP_FONT_5 robotocondensed_regular_16_latin1 /* 5% Width */
#if HASP_USE_FREETYPE<=0
#ifndef HASP_FONT_3
#define HASP_FONT_3 robotocondensed_regular_48_latin1 /* 10% Width */
#endif
#ifndef HASP_FONT_4
#define HASP_FONT_4 robotocondensed_regular_64_latin1 /* 10% Height */
#endif
#ifndef HASP_FONT_5
#define HASP_FONT_5 robotocondensed_regular_16_latin1 /* 5% Width */
#endif
#endif
#ifndef HASP_FONT_SIZE_1
@ -416,16 +420,18 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef HASP_FONT_SIZE_2
#define HASP_FONT_SIZE_2 32
#endif
#ifndef HASP_FONT_SIZE_3
#define HASP_FONT_SIZE_3 48
#if HASP_USE_FREETYPE<=0
#ifndef HASP_FONT_SIZE_3
#define HASP_FONT_SIZE_3 48
#endif
#ifndef HASP_FONT_SIZE_4
#define HASP_FONT_SIZE_4 64
#endif
#ifndef HASP_FONT_SIZE_5
#define HASP_FONT_SIZE_5 16
#endif
#endif
#ifndef HASP_FONT_SIZE_4
#define HASP_FONT_SIZE_4 64
#endif
#ifndef HASP_FONT_SIZE_5
#define HASP_FONT_SIZE_5 16
#endif
#elif TFT_HEIGHT>=320 && TFT_WIDTH>=320
#ifndef ROBOTOCONDENSED_REGULAR_16_LATIN1
#define ROBOTOCONDENSED_REGULAR_16_LATIN1 1
@ -433,14 +439,16 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef ROBOTOCONDENSED_REGULAR_24_LATIN1
#define ROBOTOCONDENSED_REGULAR_24_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_32_LATIN1
#define ROBOTOCONDENSED_REGULAR_32_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1
#define ROBOTOCONDENSED_REGULAR_48_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_12_LATIN1
#define ROBOTOCONDENSED_REGULAR_12_LATIN1 1
#if HASP_USE_FREETYPE<=0
#ifndef ROBOTOCONDENSED_REGULAR_32_LATIN1
#define ROBOTOCONDENSED_REGULAR_32_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1
#define ROBOTOCONDENSED_REGULAR_48_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_12_LATIN1
#define ROBOTOCONDENSED_REGULAR_12_LATIN1 1
#endif
#endif
#ifndef HASP_FONT_1
@ -449,14 +457,16 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef HASP_FONT_2
#define HASP_FONT_2 robotocondensed_regular_24_latin1 /* 5% Width */
#endif
#ifndef HASP_FONT_3
#define HASP_FONT_3 robotocondensed_regular_32_latin1 /* 10% Width */
#endif
#ifndef HASP_FONT_4
#define HASP_FONT_4 robotocondensed_regular_48_latin1 /* 10% Height */
#endif
#ifndef HASP_FONT_5
#define HASP_FONT_5 robotocondensed_regular_12_latin1 /* 5% Width */
#if HASP_USE_FREETYPE<=0
#ifndef HASP_FONT_3
#define HASP_FONT_3 robotocondensed_regular_32_latin1 /* 10% Width */
#endif
#ifndef HASP_FONT_4
#define HASP_FONT_4 robotocondensed_regular_48_latin1 /* 10% Height */
#endif
#ifndef HASP_FONT_5
#define HASP_FONT_5 robotocondensed_regular_12_latin1 /* 5% Width */
#endif
#endif
#ifndef HASP_FONT_SIZE_1
@ -465,14 +475,16 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef HASP_FONT_SIZE_2
#define HASP_FONT_SIZE_2 24
#endif
#ifndef HASP_FONT_SIZE_3
#define HASP_FONT_SIZE_3 32
#endif
#ifndef HASP_FONT_SIZE_4
#define HASP_FONT_SIZE_4 48
#endif
#ifndef HASP_FONT_SIZE_5
#define HASP_FONT_SIZE_5 12
#if HASP_USE_FREETYPE<=0
#ifndef HASP_FONT_SIZE_3
#define HASP_FONT_SIZE_3 32
#endif
#ifndef HASP_FONT_SIZE_4
#define HASP_FONT_SIZE_4 48
#endif
#ifndef HASP_FONT_SIZE_5
#define HASP_FONT_SIZE_5 12
#endif
#endif
#elif TFT_HEIGHT>=272 && TFT_WIDTH>=272
@ -482,14 +494,16 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef ROBOTOCONDENSED_REGULAR_18_LATIN1
#define ROBOTOCONDENSED_REGULAR_18_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_28_LATIN1
#define ROBOTOCONDENSED_REGULAR_28_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_36_LATIN1
#define ROBOTOCONDENSED_REGULAR_36_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1
#define ROBOTOCONDENSED_REGULAR_48_LATIN1 1
#if HASP_USE_FREETYPE<=0
#ifndef ROBOTOCONDENSED_REGULAR_28_LATIN1
#define ROBOTOCONDENSED_REGULAR_28_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_36_LATIN1
#define ROBOTOCONDENSED_REGULAR_36_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1
#define ROBOTOCONDENSED_REGULAR_48_LATIN1 1
#endif
#endif
#ifndef HASP_FONT_1
@ -498,14 +512,16 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef HASP_FONT_2
#define HASP_FONT_2 robotocondensed_regular_18_latin1 /* 5% Width */
#endif
#ifndef HASP_FONT_3
#define HASP_FONT_3 robotocondensed_regular_28_latin1 /* 10% Width */
#endif
#ifndef HASP_FONT_4
#define HASP_FONT_4 robotocondensed_regular_36_latin1 /* 10% Height */
#endif
#ifndef HASP_FONT_5
#define HASP_FONT_5 robotocondensed_regular_48_latin1 /* 5% Width */
#if HASP_USE_FREETYPE<=0
#ifndef HASP_FONT_3
#define HASP_FONT_3 robotocondensed_regular_28_latin1 /* 10% Width */
#endif
#ifndef HASP_FONT_4
#define HASP_FONT_4 robotocondensed_regular_36_latin1 /* 10% Height */
#endif
#ifndef HASP_FONT_5
#define HASP_FONT_5 robotocondensed_regular_48_latin1 /* 5% Width */
#endif
#endif
#ifndef HASP_FONT_SIZE_1
@ -514,14 +530,16 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef HASP_FONT_SIZE_2
#define HASP_FONT_SIZE_2 18
#endif
#ifndef HASP_FONT_SIZE_3
#define HASP_FONT_SIZE_3 28
#endif
#ifndef HASP_FONT_SIZE_4
#define HASP_FONT_SIZE_4 36
#endif
#ifndef HASP_FONT_SIZE_5
#define HASP_FONT_SIZE_5 48
#if HASP_USE_FREETYPE<=0
#ifndef HASP_FONT_SIZE_3
#define HASP_FONT_SIZE_3 28
#endif
#ifndef HASP_FONT_SIZE_4
#define HASP_FONT_SIZE_4 36
#endif
#ifndef HASP_FONT_SIZE_5
#define HASP_FONT_SIZE_5 48
#endif
#endif
#else // smaller than 272
@ -532,11 +550,13 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef HASP_FONT_2
#define HASP_FONT_2 robotocondensed_regular_16_latin1 /* 5% Width */
#endif
#ifndef HASP_FONT_3
#define HASP_FONT_3 robotocondensed_regular_24_latin1 /* 10% Width */
#endif
#ifndef HASP_FONT_4
#define HASP_FONT_4 robotocondensed_regular_32_latin1 /* 10% Height */
#if HASP_USE_FREETYPE<=0
#ifndef HASP_FONT_3
#define HASP_FONT_3 robotocondensed_regular_24_latin1 /* 10% Width */
#endif
#ifndef HASP_FONT_4
#define HASP_FONT_4 robotocondensed_regular_32_latin1 /* 10% Height */
#endif
#endif
#ifndef ROBOTOCONDENSED_REGULAR_12_LATIN1
@ -545,14 +565,16 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef ROBOTOCONDENSED_REGULAR_16_LATIN1
#define ROBOTOCONDENSED_REGULAR_16_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_24_LATIN1
#define ROBOTOCONDENSED_REGULAR_24_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_32_LATIN1
#define ROBOTOCONDENSED_REGULAR_32_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1
#define ROBOTOCONDENSED_REGULAR_48_LATIN1 1
#if HASP_USE_FREETYPE<=0
#ifndef ROBOTOCONDENSED_REGULAR_24_LATIN1
#define ROBOTOCONDENSED_REGULAR_24_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_32_LATIN1
#define ROBOTOCONDENSED_REGULAR_32_LATIN1 1
#endif
#ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1
#define ROBOTOCONDENSED_REGULAR_48_LATIN1 1
#endif
#endif
#ifndef HASP_FONT_SIZE_1
@ -561,15 +583,18 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef HASP_FONT_SIZE_2
#define HASP_FONT_SIZE_2 16
#endif
#ifndef HASP_FONT_SIZE_3
#define HASP_FONT_SIZE_3 24
#endif
#ifndef HASP_FONT_SIZE_4
#define HASP_FONT_SIZE_4 32
#endif
#ifndef HASP_FONT_SIZE_5
#define HASP_FONT_SIZE_5 48
#if HASP_USE_FREETYPE<=0
#ifndef HASP_FONT_SIZE_3
#define HASP_FONT_SIZE_3 24
#endif
#ifndef HASP_FONT_SIZE_4
#define HASP_FONT_SIZE_4 32
#endif
#ifndef HASP_FONT_SIZE_5
#define HASP_FONT_SIZE_5 48
#endif
#endif
#endif
#endif
@ -694,9 +719,12 @@ typedef void* lv_font_user_data_t;
#else
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(unscii_8_icon);
//#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(unscii_8_icon);
#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(HASP_FONT_1) \
LV_FONT_DECLARE(HASP_FONT_2) \
#ifndef LV_FONT_DEFAULT
#define LV_FONT_DEFAULT &unscii_8_icon //&lv_font_unscii_8
#define LV_FONT_DEFAULT &HASP_FONT_2 //&lv_font_unscii_8
#endif
#endif // LV_HIGH_RESOURCE_MCU
@ -715,8 +743,8 @@ typedef void* lv_font_user_data_t;
#if HASP_USE_FREETYPE<=0 //LV_HIGH_RESOURCE_MCU
#define LV_THEME_DEFAULT_FONT_SMALL &HASP_FONT_1 //&lv_font_montserrat_12
#define LV_THEME_DEFAULT_FONT_NORMAL &HASP_FONT_2 //&lv_font_montserrat_16
#define LV_THEME_DEFAULT_FONT_SUBTITLE &HASP_FONT_3 //&lv_font_montserrat_22
#define LV_THEME_DEFAULT_FONT_TITLE &HASP_FONT_4 //&lv_font_montserrat_22 //&lv_font_montserrat_28_compressed
#define LV_THEME_DEFAULT_FONT_SUBTITLE &HASP_FONT_2 //&lv_font_montserrat_22
#define LV_THEME_DEFAULT_FONT_TITLE &HASP_FONT_2 //&lv_font_montserrat_22 //&lv_font_montserrat_28_compressed
#else
#define LV_THEME_DEFAULT_FONT_SMALL LV_FONT_DEFAULT // &lv_font_montserrat_12
#define LV_THEME_DEFAULT_FONT_NORMAL LV_FONT_DEFAULT // &lv_font_montserrat_16

View File

@ -557,8 +557,8 @@ void haspSetup(void)
/* ********** Font Initializations ********** */
LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, nullptr);
LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, haspFonts[0]);
// LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, nullptr);
// LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, haspFonts[0]);
// LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, &robotocondensed_regular_16);
#if HASP_USE_FREETYPE > 0
@ -566,40 +566,34 @@ void haspSetup(void)
#if TFT_HEIGHT >= 480 && TFT_WIDTH >= 480
haspFonts[0] = get_font("24");
haspFonts[1] = get_font("32");
haspFonts[2] = get_font("48");
haspFonts[3] = get_font("64");
#elif TFT_HEIGHT >= 320 && TFT_WIDTH >= 320
haspFonts[0] = get_font("16");
haspFonts[1] = get_font("24");
haspFonts[2] = get_font("32");
haspFonts[3] = get_font("48");
#elif TFT_HEIGHT >= 272 && TFT_WIDTH >= 272
haspFonts[0] = get_font("14");
haspFonts[1] = get_font("18");
haspFonts[2] = get_font("28");
haspFonts[3] = get_font("36");
#else // smaller than 272
haspFonts[0] = get_font("12");
haspFonts[1] = get_font("16");
haspFonts[2] = get_font("24");
haspFonts[3] = get_font("32");
#endif
// Check for failed font pointers
if(haspFonts[0] == nullptr) haspFonts[0] = LV_FONT_DEFAULT;
if(haspFonts[1] == nullptr) haspFonts[1] = LV_FONT_DEFAULT;
if(haspFonts[2] == nullptr) haspFonts[2] = LV_FONT_DEFAULT;
if(haspFonts[3] == nullptr) haspFonts[3] = LV_FONT_DEFAULT;
#else
if(haspFonts[0] == nullptr) haspFonts[0] = LV_THEME_DEFAULT_FONT_SMALL;
if(haspFonts[1] == nullptr) haspFonts[1] = LV_THEME_DEFAULT_FONT_NORMAL;
if(haspFonts[2] == nullptr) haspFonts[2] = LV_THEME_DEFAULT_FONT_SUBTITLE;
if(haspFonts[3] == nullptr) haspFonts[3] = LV_THEME_DEFAULT_FONT_TITLE;
// if(haspFonts[2] == nullptr) haspFonts[2] = LV_THEME_DEFAULT_FONT_SUBTITLE;
// if(haspFonts[3] == nullptr) haspFonts[3] = LV_THEME_DEFAULT_FONT_TITLE;
#endif // HASP_USE_FREETYPE
haspFonts[2] = haspFonts[1]; // subtitle isn't used in themes, set to normal font
haspFonts[3] = haspFonts[1]; // title isn't used in themes, set to normal font
hasp_set_theme(haspThemeId);
/* Create all screens using the theme */

View File

@ -239,7 +239,7 @@ static void basic_init(lv_style_int_t border_width, lv_style_int_t outline_width
lv_style_set_border_opa(&styles->transparent, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_style_set_outline_opa(&styles->transparent, LV_STATE_DEFAULT, LV_OPA_TRANSP);
lv_style_set_value_color(&styles->transparent, LV_STATE_DEFAULT, color_scr_text);
lv_style_set_value_font(&styles->transparent, LV_STATE_DEFAULT, theme.font_subtitle);
lv_style_set_value_font(&styles->transparent, LV_STATE_DEFAULT, theme.font_normal);
if(!NO_FOCUS) lv_style_set_outline_width(&styles->transparent, LV_STATE_DEFAULT, outline_width);
@ -264,7 +264,7 @@ static void basic_init(lv_style_int_t border_width, lv_style_int_t outline_width
// lv_style_set_text_color(&styles->pretty, LV_STATE_DEFAULT, color_scr_text);
// lv_style_set_value_color(&styles->pretty, LV_STATE_DEFAULT, color_scr_text);
lv_style_set_value_font(&styles->pretty, LV_STATE_DEFAULT, theme.font_subtitle);
lv_style_set_value_font(&styles->pretty, LV_STATE_DEFAULT, theme.font_normal);
lv_style_set_border_opa(&styles->pretty, LV_STATE_DEFAULT, LV_OPA_30);
lv_style_set_border_width(&styles->pretty, LV_STATE_DEFAULT, border_width);
@ -299,7 +299,7 @@ static void basic_init(lv_style_int_t border_width, lv_style_int_t outline_width
my_style_set_fg_color(&styles->pretty_color, LV_STATE_DEFAULT, color_scr_text);
// lv_style_set_value_color(&styles->pretty_color, LV_STATE_DEFAULT, color_scr_text);
lv_style_set_value_font(&styles->pretty_color, LV_STATE_DEFAULT, theme.font_subtitle);
lv_style_set_value_font(&styles->pretty_color, LV_STATE_DEFAULT, theme.font_normal);
lv_style_set_border_opa(&styles->pretty_color, LV_STATE_DEFAULT, LV_OPA_50);
lv_style_set_border_width(&styles->pretty_color, LV_STATE_DEFAULT, border_width);

View File

@ -530,7 +530,6 @@ bool wifiEvery5Seconds()
#endif
if(WiFi.status() == WL_CONNECTED && WiFi.localIP() > 0) {
LOG_DEBUG(TAG_WIFI, F("5sec OK"));
return true;
}