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,6 +384,7 @@ 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
#if HASP_USE_FREETYPE<=0
#ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1
#define ROBOTOCONDENSED_REGULAR_48_LATIN1 1
#endif
@ -393,6 +394,7 @@ 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
#endif
#ifndef HASP_FONT_1
#define HASP_FONT_1 robotocondensed_regular_24_latin1 /* 5% Width */
@ -400,6 +402,7 @@ 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
#if HASP_USE_FREETYPE<=0
#ifndef HASP_FONT_3
#define HASP_FONT_3 robotocondensed_regular_48_latin1 /* 10% Width */
#endif
@ -409,6 +412,7 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef HASP_FONT_5
#define HASP_FONT_5 robotocondensed_regular_16_latin1 /* 5% Width */
#endif
#endif
#ifndef HASP_FONT_SIZE_1
#define HASP_FONT_SIZE_1 24
@ -416,6 +420,7 @@ 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
#if HASP_USE_FREETYPE<=0
#ifndef HASP_FONT_SIZE_3
#define HASP_FONT_SIZE_3 48
#endif
@ -425,6 +430,7 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef HASP_FONT_SIZE_5
#define HASP_FONT_SIZE_5 16
#endif
#endif
#elif TFT_HEIGHT>=320 && TFT_WIDTH>=320
#ifndef ROBOTOCONDENSED_REGULAR_16_LATIN1
@ -433,6 +439,7 @@ 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
#if HASP_USE_FREETYPE<=0
#ifndef ROBOTOCONDENSED_REGULAR_32_LATIN1
#define ROBOTOCONDENSED_REGULAR_32_LATIN1 1
#endif
@ -442,6 +449,7 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef ROBOTOCONDENSED_REGULAR_12_LATIN1
#define ROBOTOCONDENSED_REGULAR_12_LATIN1 1
#endif
#endif
#ifndef HASP_FONT_1
#define HASP_FONT_1 robotocondensed_regular_16_latin1 /* 5% Width */
@ -449,6 +457,7 @@ 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
#if HASP_USE_FREETYPE<=0
#ifndef HASP_FONT_3
#define HASP_FONT_3 robotocondensed_regular_32_latin1 /* 10% Width */
#endif
@ -458,6 +467,7 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef HASP_FONT_5
#define HASP_FONT_5 robotocondensed_regular_12_latin1 /* 5% Width */
#endif
#endif
#ifndef HASP_FONT_SIZE_1
#define HASP_FONT_SIZE_1 16
@ -465,6 +475,7 @@ 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
#if HASP_USE_FREETYPE<=0
#ifndef HASP_FONT_SIZE_3
#define HASP_FONT_SIZE_3 32
#endif
@ -474,6 +485,7 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef HASP_FONT_SIZE_5
#define HASP_FONT_SIZE_5 12
#endif
#endif
#elif TFT_HEIGHT>=272 && TFT_WIDTH>=272
#ifndef ROBOTOCONDENSED_REGULAR_14_LATIN1
@ -482,6 +494,7 @@ 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
#if HASP_USE_FREETYPE<=0
#ifndef ROBOTOCONDENSED_REGULAR_28_LATIN1
#define ROBOTOCONDENSED_REGULAR_28_LATIN1 1
#endif
@ -491,6 +504,7 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1
#define ROBOTOCONDENSED_REGULAR_48_LATIN1 1
#endif
#endif
#ifndef HASP_FONT_1
#define HASP_FONT_1 robotocondensed_regular_14_latin1 /* 5% Width */
@ -498,6 +512,7 @@ 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
#if HASP_USE_FREETYPE<=0
#ifndef HASP_FONT_3
#define HASP_FONT_3 robotocondensed_regular_28_latin1 /* 10% Width */
#endif
@ -507,6 +522,7 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef HASP_FONT_5
#define HASP_FONT_5 robotocondensed_regular_48_latin1 /* 5% Width */
#endif
#endif
#ifndef HASP_FONT_SIZE_1
#define HASP_FONT_SIZE_1 14
@ -514,6 +530,7 @@ 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
#if HASP_USE_FREETYPE<=0
#ifndef HASP_FONT_SIZE_3
#define HASP_FONT_SIZE_3 28
#endif
@ -523,6 +540,7 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef HASP_FONT_SIZE_5
#define HASP_FONT_SIZE_5 48
#endif
#endif
#else // smaller than 272
@ -532,12 +550,14 @@ 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
#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
#define ROBOTOCONDENSED_REGULAR_12_LATIN1 1
@ -545,6 +565,7 @@ 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
#if HASP_USE_FREETYPE<=0
#ifndef ROBOTOCONDENSED_REGULAR_24_LATIN1
#define ROBOTOCONDENSED_REGULAR_24_LATIN1 1
#endif
@ -554,6 +575,7 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#ifndef ROBOTOCONDENSED_REGULAR_48_LATIN1
#define ROBOTOCONDENSED_REGULAR_48_LATIN1 1
#endif
#endif
#ifndef HASP_FONT_SIZE_1
#define HASP_FONT_SIZE_1 12
@ -561,6 +583,7 @@ 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
#if HASP_USE_FREETYPE<=0
#ifndef HASP_FONT_SIZE_3
#define HASP_FONT_SIZE_3 24
#endif
@ -571,6 +594,8 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in
#define HASP_FONT_SIZE_5 48
#endif
#endif
#endif
#endif
/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
@ -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;
}