From 12cb564db8e435995ae986c87975e56f92c222d9 Mon Sep 17 00:00:00 2001 From: fvanroie Date: Sun, 13 Dec 2020 00:53:30 +0100 Subject: [PATCH] Switch to lvgl 7.8.1 --- include/lv_conf.h | 7 +++++-- include/lv_conf_v7.h | 6 +++++- platformio.ini | 4 ++-- src/hasp_attribute.cpp | 6 +++--- src/hasp_object.cpp | 18 +++++++++--------- 5 files changed, 24 insertions(+), 17 deletions(-) diff --git a/include/lv_conf.h b/include/lv_conf.h index c8cb2da5..7a1d57a6 100644 --- a/include/lv_conf.h +++ b/include/lv_conf.h @@ -1,5 +1,7 @@ -//#include "lv_conf_v7.h" -#include "lv_conf_v8.h" +#include "lv_conf_v7.h" +#define LV_THEME_DEFAULT_FLAGS LV_THEME_DEFAULT_FLAG + +/*#include "lv_conf_v8.h" #ifndef LV_CONF_STUB_H #define LV_CONF_STUB_H @@ -83,3 +85,4 @@ #endif #endif +*/ \ No newline at end of file diff --git a/include/lv_conf_v7.h b/include/lv_conf_v7.h index 5a4e99c7..a077d3e3 100644 --- a/include/lv_conf_v7.h +++ b/include/lv_conf_v7.h @@ -467,7 +467,11 @@ typedef void* lv_font_user_data_t; *==================*/ /*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/ -typedef uint8_t lv_obj_user_data_t; +typedef struct { + uint8_t objid:8; + uint8_t groupid:8; + uint8_t id; +} lv_obj_user_data_t; /*1: enable `lv_obj_realaign()` based on `lv_obj_align()` parameters*/ #define LV_USE_OBJ_REALIGN 1 diff --git a/platformio.ini b/platformio.ini index 95680993..4415e89d 100644 --- a/platformio.ini +++ b/platformio.ini @@ -71,8 +71,8 @@ lib_deps = git+https://github.com/Bodmer/TFT_eSPI.git git+https://github.com/fvanroie/ConsoleInput.git git+https://github.com/andrethomas/TasmotaSlave.git - git+https://github.com/fvanroie/lv_components.git - git+https://github.com/lvgl/lvgl.git#dev-v8 + ;git+https://github.com/fvanroie/lv_components.git + git+https://github.com/lvgl/lvgl.git ;lvgl/lvgl @ ^7.7.2 ; from PIO library ;bodmer/TFT_eSPI @ 2.3.4 ; Tft SPI drivers EXACT version 2.3.5 has compile error ; ------ Unused / Test libraries diff --git a/src/hasp_attribute.cpp b/src/hasp_attribute.cpp index 2e4c0966..4e329a1c 100644 --- a/src/hasp_attribute.cpp +++ b/src/hasp_attribute.cpp @@ -393,7 +393,7 @@ lv_obj_t * FindButtonLabel(lv_obj_t * btn) { if(btn) { lv_obj_t * label = lv_obj_get_child_back(btn, NULL); -#if LVGL_VERSION_MAJOR != 7 +#if 1 if(label) { if(check_obj_type(label, LV_HASP_LABEL)) { return label; @@ -437,7 +437,7 @@ static bool haspGetLabelText(lv_obj_t * obj, char * text) lv_obj_t * label = lv_obj_get_child_back(obj, NULL); if(label) { -#if LVGL_VERSION_MAJOR != 7 +#if 1 if(check_obj_type(label, LV_HASP_LABEL)) { text = lv_label_get_text(label); return true; @@ -627,7 +627,7 @@ static void hasp_local_style_attr(lv_obj_t * obj, const char * attr_p, uint16_t return attribute_pad_left(obj, part, state, update, attr_p, (lv_style_int_t)var); case ATTR_PAD_RIGHT: return attribute_pad_right(obj, part, state, update, attr_p, (lv_style_int_t)var); -#if LVGL_VERSION_MAJOR == 7 +#if 0 case ATTR_PAD_INNER: return attribute_pad_inner(obj, part, state, update, attr_p, (lv_style_int_t)var); #endif diff --git a/src/hasp_object.cpp b/src/hasp_object.cpp index bae23250..37d7a71b 100644 --- a/src/hasp_object.cpp +++ b/src/hasp_object.cpp @@ -44,18 +44,18 @@ lv_obj_t * hasp_find_obj_from_parent_id(lv_obj_t * parent, uint8_t objid) /* check tabs */ if(check_obj_type(child, LV_HASP_TABVIEW)) { -#if LVGL_VERSION_MAJOR == 7 + //#if LVGL_VERSION_MAJOR == 7 uint16_t tabcount = lv_tabview_get_tab_count(child); for(uint16_t i = 0; i < tabcount; i++) { lv_obj_t * tab = lv_tabview_get_tab(child, i); Log.verbose(TAG_HASP, "Found tab %i", i); - if(tab->user_data && (lv_obj_user_data_t)objid == tab->user_data) return tab; /* tab found, return it */ + if(tab->user_data.objid && objid == tab->user_data.objid) return tab; /* tab found, return it */ /* check grandchildren */ grandchild = hasp_find_obj_from_parent_id(tab, objid); if(grandchild) return grandchild; /* grandchild found, return it */ } -#endif + //#endif } /* try next sibling */ @@ -161,7 +161,7 @@ bool check_obj_type_str(const char * lvobjtype, lv_hasp_obj_type_t haspobjtype) */ bool check_obj_type(lv_obj_t * obj, lv_hasp_obj_type_t haspobjtype) { -#if LVGL_VERSION_MAJOR != 7 +#if 1 return obj->user_data.objid == (uint8_t)haspobjtype; #else lv_obj_type_t list; @@ -193,12 +193,12 @@ void hasp_object_tree(lv_obj_t * parent, uint8_t pageid, uint16_t level) /* check tabs */ if(check_obj_type(parent, LV_HASP_TABVIEW)) { -#if LVGL_VERSION_MAJOR == 7 +#if 1 uint16_t tabcount = lv_tabview_get_tab_count(parent); for(uint16_t i = 0; i < tabcount; i++) { lv_obj_t * tab = lv_tabview_get_tab(child, i); Log.verbose(TAG_HASP, "Found tab %i", i); - if(tab->user_data) hasp_object_tree(tab, pageid, level + 1); + if(tab->user_data.objid) hasp_object_tree(tab, pageid, level + 1); } #endif } @@ -623,11 +623,11 @@ void hasp_new_object(const JsonObject & config, uint8_t & saved_page_id) if(obj) { lv_obj_t * tab; tab = lv_tabview_add_tab(obj, "tab 1"); - lv_obj_set_user_data(tab, id + 1); + //lv_obj_set_user_data(tab, id + 1); tab = lv_tabview_add_tab(obj, "tab 2"); - lv_obj_set_user_data(tab, id + 2); + //lv_obj_set_user_data(tab, id + 2); tab = lv_tabview_add_tab(obj, "tab 3"); - lv_obj_set_user_data(tab, id + 3); + //lv_obj_set_user_data(tab, id + 3); } break; }