Theme update

This commit is contained in:
fvanroie 2020-10-28 18:00:49 +01:00
parent 7c966e7a2d
commit ae6cad97c4
5 changed files with 712 additions and 359 deletions

View File

@ -402,6 +402,7 @@ typedef void* lv_font_user_data_t;
#define LV_USE_THEME_EMPTY 1
#define LV_USE_THEME_TEMPLATE 1
#define LV_USE_THEME_HASP 1
/*=================
* Text settings

View File

@ -24,6 +24,7 @@
//#include "hasp_attr_get.h"
#include "hasp_attribute.h"
#include "hasp.h"
#include "lv_theme_hasp.h"
#include "EEPROM.h"
@ -358,7 +359,7 @@ void haspSetup()
#if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266)
lv_zifont_init();
if(lv_zifont_font_init(&haspFonts[0], haspZiFontPath, 24) != 0) {
if(lv_zifont_font_init(&haspFonts[0], haspZiFontPath, 32) != 0) {
Log.error(F("HASP: Failed to set font to %s"), haspZiFontPath);
haspFonts[0] = LV_FONT_DEFAULT;
} else {
@ -416,10 +417,11 @@ void haspSetup()
th = lv_theme_templ_init(haspThemeHue, defaultFont); // lightweight, not for production...
break;
#endif
#if(LV_USE_THEME_HASP == 1) || (LV_USE_THEME_TEMPLATE == 1)
#if(LV_USE_THEME_HASP == 1)
case 8:
th = lv_theme_template_init(LV_COLOR_PURPLE, LV_COLOR_ORANGE, LV_THEME_DEFAULT_FLAGS, haspFonts[0],
haspFonts[1], haspFonts[2], haspFonts[3]);
th = lv_theme_hasp_init(lv_color_hsv_to_rgb(haspThemeHue, 100, 100),
lv_color_hsv_to_rgb(haspThemeHue, 100, 100), LV_THEME_DEFAULT_FLAGS, haspFonts[0],
haspFonts[1], haspFonts[2], haspFonts[3]);
break;
#endif
/* case 0:

View File

@ -5,7 +5,7 @@
#include "hasp_conf.h"
#include "hasp_spiffs.h"
#if HASP_USE_SPIFFS>0
#if HASP_USE_SPIFFS > 0
#if defined(ARDUINO_ARCH_ESP32)
#include "SPIFFS.h"
#endif
@ -69,20 +69,31 @@ void spiffsInfo()
void spiffsList()
{
Log.verbose(F("FILE: Listing files on the internal flash:"));
#if HASP_USE_SPIFFS > 0
#if defined(ARDUINO_ARCH_ESP8266)
if(!SPIFFS.begin()) {
#else
if(!SPIFFS.begin(true)) {
#endif
Log.error(F("FILE: Flash file system not mouted."));
} else {
Log.verbose(F("FILE: Listing files on the internal flash:"));
#if defined(ARDUINO_ARCH_ESP32)
File root = SPIFFS.open("/");
File file = root.openNextFile();
while(file) {
Log.verbose(F("FILE: * %s (%u bytes)"), file.name(), (uint32_t)file.size());
file = root.openNextFile();
}
File root = SPIFFS.open("/");
File file = root.openNextFile();
while(file) {
Log.verbose(F("FILE: * %s (%u bytes)"), file.name(), (uint32_t)file.size());
file = root.openNextFile();
}
#endif
#if defined(ARDUINO_ARCH_ESP8266)
Dir dir = SPIFFS.openDir("/");
while(dir.next()) {
Log.notice(F("FILE: * %s (%u bytes)"), dir.fileName().c_str(), (uint32_t)dir.fileSize());
Dir dir = SPIFFS.openDir("/");
while(dir.next()) {
Log.notice(F("FILE: * %s (%u bytes)"), dir.fileName().c_str(), (uint32_t)dir.fileSize());
}
#endif
}
#endif
}
@ -91,7 +102,7 @@ void spiffsSetup()
{
// no SPIFFS settings, as settings depend on SPIFFS
#if HASP_USE_SPIFFS>0
#if HASP_USE_SPIFFS > 0
#if defined(ARDUINO_ARCH_ESP8266)
if(!SPIFFS.begin()) {
#else

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/**
* @file lv_theme_default.h
* @file lv_theme_hasp.h
*
*/
@ -13,8 +13,7 @@ extern "C" {
/*********************
* INCLUDES
*********************/
#include "lvgl.h"
//#include "../lib/lvgl/src/lv_conf_internal.h"
#include "lv_conf.h"
#if LV_USE_THEME_HASP
@ -31,19 +30,19 @@ extern "C" {
**********************/
/**
* Initialize the default theme
* @param hue [0..360] hue value from HSV color space to define the theme's base color
* @param font pointer to a font (NULL to use the default)
* @return pointer to the initialized theme
* Initialize the default
* @param color_primary the primary color of the theme
* @param color_secondary the secondary color for the theme
* @param flags ORed flags starting with `LV_THEME_DEF_FLAG_...`
* @param font_small pointer to a small font
* @param font_normal pointer to a normal font
* @param font_subtitle pointer to a large font
* @param font_title pointer to a extra large font
* @return a pointer to reference this theme later
*/
lv_theme_t * lv_theme_hasp_init(uint16_t hue, lv_font_t * font);
/**
* Get a pointer to the theme
* @return pointer to the theme
*/
lv_theme_t * lv_theme_get_hasp(void);
lv_theme_t * lv_theme_hasp_init(lv_color_t color_primary, lv_color_t color_secondary, uint32_t flags,
const lv_font_t * font_small, const lv_font_t * font_normal,
const lv_font_t * font_subtitle, const lv_font_t * font_title);
/**********************
* MACROS
**********************/
@ -54,4 +53,4 @@ lv_theme_t * lv_theme_get_hasp(void);
} /* extern "C" */
#endif
#endif /*LV_THEME_TEMPL_H*/
#endif /*LV_THEME_HASP_H*/