From 19a1d0576ad0070f12be90ebba0fdf9107e557df Mon Sep 17 00:00:00 2001 From: arovak Date: Wed, 21 Apr 2021 22:14:58 +0200 Subject: [PATCH] Select used fonts via user_config_override --- include/lv_conf.h | 4 ++++ include/lv_conf_v7.h | 26 +++++++++++++++++++++++++ include/user_config_override-template.h | 18 +++++++++++++++++ src/hasp/hasp_attribute.cpp | 8 ++++---- 4 files changed, 52 insertions(+), 4 deletions(-) diff --git a/include/lv_conf.h b/include/lv_conf.h index 7a1d57a6..c7ea9aad 100644 --- a/include/lv_conf.h +++ b/include/lv_conf.h @@ -1,3 +1,7 @@ +#ifdef USE_CONFIG_OVERRIDE +#include "user_config_override.h" +#endif + #include "lv_conf_v7.h" #define LV_THEME_DEFAULT_FLAGS LV_THEME_DEFAULT_FLAG diff --git a/include/lv_conf_v7.h b/include/lv_conf_v7.h index a4d3b2eb..74897617 100644 --- a/include/lv_conf_v7.h +++ b/include/lv_conf_v7.h @@ -367,6 +367,19 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in #define ROBOTOCONDENSED_REGULAR_48_LATIN1 1 #endif +#ifndef HASP_FONT_SIZE_1 +#define HASP_FONT_SIZE_1 16 +#endif +#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 + #else #ifndef HASP_FONT_1 @@ -395,6 +408,19 @@ typedef void* lv_indev_drv_user_data_t; /*Type of user data in the in #define ROBOTOCONDENSED_REGULAR_32_LATIN1 1 #endif +#ifndef HASP_FONT_SIZE_1 +#define HASP_FONT_SIZE_1 12 +#endif +#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 + #endif /* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel. diff --git a/include/user_config_override-template.h b/include/user_config_override-template.h index fd01a783..02290927 100644 --- a/include/user_config_override-template.h +++ b/include/user_config_override-template.h @@ -88,6 +88,24 @@ #define D_HTTP_COLOR_BUTTON_RESET "#d43535" // Restart/Reset/Delete button color - Strong red */ +/*************************************************** + * Font Settings + **************************************************/ +// #define HASP_FONT_1 robotocondensed_regular_16_latin1 // Use available fonts from src/fonts directory +// #define HASP_FONT_2 robotocondensed_regular_22_latin1 +// #define HASP_FONT_3 robotocondensed_regular_40_latin1 +// #define HASP_FONT_4 robotocondensed_regular_48_latin1 + +// #define ROBOTOCONDENSED_REGULAR_16_LATIN1 1 // Enable the selected fonts +// #define ROBOTOCONDENSED_REGULAR_22_LATIN1 1 +// #define ROBOTOCONDENSED_REGULAR_40_LATIN1 1 +// #define ROBOTOCONDENSED_REGULAR_48_LATIN1 1 + +// #define HASP_FONT_SIZE_1 16 // Define used font sizes +// #define HASP_FONT_SIZE_2 22 +// #define HASP_FONT_SIZE_3 40 +// #define HASP_FONT_SIZE_4 48 + /*************************************************** * Other Settings **************************************************/ diff --git a/src/hasp/hasp_attribute.cpp b/src/hasp/hasp_attribute.cpp index 7378e2dd..661371b2 100644 --- a/src/hasp/hasp_attribute.cpp +++ b/src/hasp/hasp_attribute.cpp @@ -463,24 +463,24 @@ static lv_font_t* haspPayloadToFont(const char* payload) #ifndef ARDUINO_ARCH_ESP8266 #ifdef HASP_FONT_1 - case 12: + case HASP_FONT_SIZE_1: return &HASP_FONT_1; #endif #ifdef HASP_FONT_2 - case 16: + case HASP_FONT_SIZE_2: LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, HASP_FONT_2); return &HASP_FONT_2; #endif #ifdef HASP_FONT_3 - case 22: + case HASP_FONT_SIZE_3: LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, HASP_FONT_3); return &HASP_FONT_3; #endif #ifdef HASP_FONT_4 - case 28: + case HASP_FONT_SIZE_4: LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, HASP_FONT_4); return &HASP_FONT_4; #endif