From 9b17008739125bd3eb6d34f0ee98cc6dc9189e5a Mon Sep 17 00:00:00 2001 From: fvanroie Date: Sat, 17 Jul 2021 16:27:51 +0200 Subject: [PATCH] Initial lvgl v8 test --- include/lv_conf.h | 68 +- include/lv_conf_v8.h | 1134 ++++++++--------- include/lv_symbol_mdi_def.h | 2 +- lib/lv_lib_qrcode/lv_qrcode.c | 133 +- lib/lv_lib_qrcode/lv_qrcode.h | 11 +- lib/lv_lib_zifont/lv_zifont.cpp | 10 +- lib/lv_lib_zifont/lv_zifont.h | 8 +- platformio.ini | 10 +- src/custom/my_custom_template.cpp | 4 +- src/drv/old/hasp_drv_touch.cpp | 14 +- src/drv/touch/touch_driver.h | 6 +- src/drv/touch/touch_driver_ft6336u.h | 2 +- src/drv/touch/touch_driver_gt911.h | 6 +- src/drv/touch/touch_driver_stmpe610.h | 11 +- src/drv/touch/touch_driver_tftespi.h | 5 +- .../robotocondensed_regular_12_ascii.cpp | 1 + .../robotocondensed_regular_14_ascii.cpp | 3 +- .../robotocondensed_regular_16_ascii.cpp | 1 + .../robotocondensed_regular_20_ascii.cpp | 3 +- .../robotocondensed_regular_22_ascii.cpp | 1 + .../robotocondensed_regular_24_ascii.cpp | 3 +- .../robotocondensed_regular_26_ascii.cpp | 1 + .../robotocondensed_regular_28_ascii.cpp | 3 +- .../robotocondensed_regular_32_ascii.cpp | 1 + .../robotocondensed_regular_36_ascii.cpp | 3 +- .../robotocondensed_regular_38_ascii.cpp | 1 + .../robotocondensed_regular_40_ascii.cpp | 3 +- .../robotocondensed_regular_44_ascii.cpp | 3 +- .../robotocondensed_regular_48_ascii.cpp | 3 +- .../robotocondensed_regular_12_cyrillic.cpp | 3 +- .../robotocondensed_regular_14_cyrillic.cpp | 3 +- .../robotocondensed_regular_16_cyrillic.cpp | 3 +- .../robotocondensed_regular_20_cyrillic.cpp | 3 +- .../robotocondensed_regular_22_cyrillic.cpp | 3 +- .../robotocondensed_regular_24_cyrillic.cpp | 3 +- .../robotocondensed_regular_26_cyrillic.cpp | 3 +- .../robotocondensed_regular_28_cyrillic.cpp | 3 +- .../robotocondensed_regular_32_cyrillic.cpp | 3 +- .../robotocondensed_regular_36_cyrillic.cpp | 3 +- .../robotocondensed_regular_38_cyrillic.cpp | 3 +- .../robotocondensed_regular_40_cyrillic.cpp | 3 +- .../robotocondensed_regular_44_cyrillic.cpp | 3 +- .../robotocondensed_regular_48_cyrillic.cpp | 3 +- .../robotocondensed_regular_12_greek.cpp | 3 +- .../robotocondensed_regular_14_greek.cpp | 3 +- .../robotocondensed_regular_16_greek.cpp | 3 +- .../robotocondensed_regular_20_greek.cpp | 3 +- .../robotocondensed_regular_22_greek.cpp | 3 +- .../robotocondensed_regular_24_greek.cpp | 3 +- .../robotocondensed_regular_26_greek.cpp | 3 +- .../robotocondensed_regular_28_greek.cpp | 3 +- .../robotocondensed_regular_32_greek.cpp | 3 +- .../robotocondensed_regular_36_greek.cpp | 3 +- .../robotocondensed_regular_38_greek.cpp | 3 +- .../robotocondensed_regular_40_greek.cpp | 3 +- .../robotocondensed_regular_44_greek.cpp | 3 +- .../robotocondensed_regular_48_greek.cpp | 3 +- src/font/hasp_font_loader.cpp | 4 + .../robotocondensed_regular_12_latin1.cpp | 3 +- .../robotocondensed_regular_14_latin1.cpp | 3 +- .../robotocondensed_regular_16_latin1.cpp | 3 +- .../robotocondensed_regular_20_latin1.cpp | 1 + .../robotocondensed_regular_22_latin1.cpp | 3 +- .../robotocondensed_regular_24_latin1.cpp | 3 +- .../robotocondensed_regular_26_latin1.cpp | 6 +- .../robotocondensed_regular_28_latin1.cpp | 3 +- .../robotocondensed_regular_32_latin1.cpp | 3 +- .../robotocondensed_regular_36_latin1.cpp | 3 +- .../robotocondensed_regular_38_latin1.cpp | 3 +- .../robotocondensed_regular_40_latin1.cpp | 3 +- .../robotocondensed_regular_44_latin1.cpp | 3 +- .../robotocondensed_regular_48_latin1.cpp | 3 +- .../robotocondensed_regular_12_latin2.cpp | 3 +- .../robotocondensed_regular_14_latin2.cpp | 3 +- .../robotocondensed_regular_16_latin2.cpp | 3 +- .../robotocondensed_regular_20_latin2.cpp | 3 +- .../robotocondensed_regular_22_latin2.cpp | 3 +- .../robotocondensed_regular_24_latin2.cpp | 3 +- .../robotocondensed_regular_26_latin2.cpp | 3 +- .../robotocondensed_regular_28_latin2.cpp | 3 +- .../robotocondensed_regular_32_latin2.cpp | 3 +- .../robotocondensed_regular_36_latin2.cpp | 3 +- .../robotocondensed_regular_38_latin2.cpp | 3 +- .../robotocondensed_regular_40_latin2.cpp | 3 +- .../robotocondensed_regular_44_latin2.cpp | 3 +- .../robotocondensed_regular_48_latin2.cpp | 3 +- src/hasp/hasp.cpp | 68 +- src/hasp/hasp.h | 2 +- src/hasp/hasp_attribute.cpp | 399 +++--- src/hasp/hasp_attribute.h | 201 +-- src/hasp/hasp_attribute_helper.h | 66 +- src/hasp/hasp_event.cpp | 255 ++-- src/hasp/hasp_event.h | 22 +- src/hasp/hasp_object.cpp | 412 +++--- src/hasp/hasp_object.h | 13 +- src/hasp/hasp_page.cpp | 5 +- src/hasp/hasp_style.cpp | 6 +- src/hasp/lv_theme_hasp.c | 781 ++++++------ src/hasp_debug.cpp | 33 +- src/hasp_debug.h | 2 +- src/hasp_gui.cpp | 68 +- src/hasp_oobe.cpp | 140 +- src/main_arduino.cpp | 3 +- src/sys/net/hasp_wifi.cpp | 2 + src/sys/svc/hasp_http.cpp | 20 +- src/sys/svc/hasp_http_async.cpp | 2 +- tools/hasp_font_create.py | 4 + 107 files changed, 2149 insertions(+), 1982 deletions(-) diff --git a/include/lv_conf.h b/include/lv_conf.h index c7ea9aad..20b78373 100644 --- a/include/lv_conf.h +++ b/include/lv_conf.h @@ -2,15 +2,19 @@ #include "user_config_override.h" #endif -#include "lv_conf_v7.h" -#define LV_THEME_DEFAULT_FLAGS LV_THEME_DEFAULT_FLAG +// #include "lv_conf_v7.h" +// #define LV_THEME_DEFAULT_FLAGS LV_THEME_DEFAULT_FLAG -/*#include "lv_conf_v8.h" +#include "lv_conf_v8.h" +#include "lv_symbol_mdi_def.h" #ifndef LV_CONF_STUB_H #define LV_CONF_STUB_H -#ifdef LV_THEME_DEFAULT_FLAG +#define LV_THEME_DEFAULT_FLAG 0 +#define LV_THEME_DEFAULT_FLAGS LV_THEME_DEFAULT_FLAG + +//#ifdef LV_THEME_DEFAULT_FLAG //#define lv_task_handler lv_timer_handler @@ -28,9 +32,9 @@ #define lv_checkbox_set_checked(obj, en) \ ((en) ? lv_obj_add_state(obj, LV_STATE_CHECKED) : lv_obj_clear_state(obj, LV_STATE_CHECKED)) -#define lv_checkbox_is_checked(obj) ((lv_obj_get_state(obj) & LV_STATE_CHECKED)?true:false) +#define lv_checkbox_is_checked(obj) ((lv_obj_get_state(obj) & LV_STATE_CHECKED) ? true : false) -#define lv_chart_set_range(chart, ymin, ymax) lv_chart_set_y_range(chart, LV_CHART_AXIS_PRIMARY_Y, ymin, ymax) +//#define lv_chart_set_range(chart, ymin, ymax) lv_chart_set_y_range(chart, LV_CHART_AXIS_PRIMARY_Y, ymin, ymax) #define lv_obj_set_style_local_pad_inner lv_obj_set_style_local_pad_top #define lv_dropdown_set_draw_arrow(obj, en) lv_dropdown_set_symbol(obj, en ? LV_SYMBOL_DOWN : NULL) @@ -38,6 +42,8 @@ #define lv_cont_set_layout(obj, fit) #define lv_roller_set_auto_fit(obj, fit) #define lv_obj_set_top(obj, fit) +#define lv_obj_add_protect(a, b) +#define LV_PROTECT_PRESS_LOST 0 #define LV_BTN_STATE_PRESSED LV_STATE_PRESSED #define LV_BTN_STATE_DISABLED LV_STATE_DISABLED @@ -50,6 +56,11 @@ #define lv_btn_get_state lv_obj_get_state #define lv_btn_state_t lv_state_t +#define lv_disp_buf_t lv_disp_draw_buf_t +#define lv_disp_buf_init lv_disp_draw_buf_init + +#define lv_switch_get_state lv_obj_get_state + #define LV_CPICKER_PART_MAIN LV_COLORWHEEL_PART_MAIN #define LV_CPICKER_PART_KNOB LV_COLORWHEEL_PART_KNOB #define LV_CPICKER_TYPE_RECT 0 @@ -64,21 +75,23 @@ #define LV_CHECKBOX_PART_BG LV_CHECKBOX_PART_MAIN #define LV_PAGE_PART_SCROLLBAR -#define LV_TEXTAREA_PART_BG LV_TEXTAREA_PART_MAIN -#define LV_BTNMATRIX_PART_BG LV_BTNMATRIX_PART_MAIN -#define LV_KEYBOARD_PART_BG LV_BTNMATRIX_PART_MAIN -#define LV_KEYBOARD_PART_BTN LV_BTNMATRIX_PART_BTN -#define LV_SPINBOX_PART_BG LV_ARC_PART_MAIN -#define LV_SWITCH_PART_BG LV_SWITCH_PART_MAIN -#define LV_SLIDER_PART_BG LV_SLIDER_PART_MAIN +#define LV_TEXTAREA_PART_BG LV_PART_MAIN +#define LV_BTNMATRIX_PART_BG LV_PART_MAIN +#define LV_KEYBOARD_PART_BG LV_PART_MAIN +#define LV_KEYBOARD_PART_BTN LV_PART +#define LV_SPINBOX_PART_BG LV_PART_MAIN +#define LV_SWITCH_PART_BG LV_PART_MAIN +#define LV_SLIDER_PART_BG LV_PART_MAIN #define LV_DROPDOWN_PART_SCROLLBAR LV_DROPDOWN_PART_LIST // ?? #define LV_TEXTAREA_PART_SCROLLBAR LV_TEXTAREA_PART_PLACEHOLDER // ?? #define LV_THEME_DEFAULT_FLAGS LV_THEME_DEFAULT_FLAG +#define lv_textarea_set_cursor_hidden(a, b) + #define lv_img_get_file_name(img) \ - (((lv_img_ext_t *)lv_obj_get_ext_attr(img))->src_type == LV_IMG_SRC_FILE) \ - ? (const char *)((lv_img_ext_t *)lv_obj_get_ext_attr(img))->src \ + (((lv_img_ext_t*)lv_obj_get_ext_attr(img))->src_type == LV_IMG_SRC_FILE) \ + ? (const char*)((lv_img_ext_t*)lv_obj_get_ext_attr(img))->src \ : "" // For hasp_theme.c @@ -87,6 +100,27 @@ #define lv_obj_add_style_list _lv_obj_add_style_list #define lv_obj_report_style_mod lv_obj_report_style_change +#define lv_keyboard_set_cursor_manage(a, b) +#define lv_obj_set_style_value_str(a, b, c) + +#define LV_OBJ_PART_MAIN LV_PART_MAIN +#define LV_BTN_PART_MAIN LV_PART_MAIN + +#define LV_THEME_DEFAULT_FONT_SMALL LV_FONT_DEFAULT +#define LV_THEME_DEFAULT_FONT_NORMAL LV_FONT_DEFAULT +#define LV_THEME_DEFAULT_FONT_SUBTITLE LV_FONT_DEFAULT +#define LV_THEME_DEFAULT_FONT_TITLE LV_FONT_DEFAULT + +#define LV_COLOR_BLACK lv_color_black() +#define LV_COLOR_WHITE lv_color_white() +#define LV_COLOR_SILVER lv_color_make(0xff, 0xff, 0xff) +#define LV_COLOR_RED lv_color_make(0xff, 0xff, 0xff) +#define LV_COLOR_GRAY lv_color_make(0xff, 0xff, 0xff) + +#define LV_IMG_CACHE_DEF_SIZE_PSRAM 20 + +#define _lv_memset_00(p, size) memset(p, 0, size); +#define LV_ASSERT_MEM(x) + +//#endif #endif -#endif -*/ \ No newline at end of file diff --git a/include/lv_conf_v8.h b/include/lv_conf_v8.h index 4cb1442c..ab8c9071 100644 --- a/include/lv_conf_v8.h +++ b/include/lv_conf_v8.h @@ -1,6 +1,6 @@ /** * @file lv_conf.h - * Configuration file for v8.0.0-dev + * Configuration file for v8.1.0-dev */ /* @@ -11,730 +11,634 @@ #ifndef LV_CONF_H #define LV_CONF_H -/* clang-format off */ +/*clang-format off*/ #include +#include "lv_symbol_mdi_def.h" + #if defined(ARDUINO_ARCH_ESP8266) -#define LV_HIGH_RESOURCE_MCU 0 +#define LV_HIGH_RESOURCE_MCU 0 #endif #ifndef LV_HIGH_RESOURCE_MCU -#define LV_HIGH_RESOURCE_MCU 1 +#define LV_HIGH_RESOURCE_MCU 1 #endif /*==================== - Graphical settings + COLOR SETTINGS *====================*/ -/* Maximal horizontal and vertical resolution to support by the library.*/ -#define LV_HOR_RES_DEF (TFT_WIDTH) -#define LV_VER_RES_DEF (TFT_HEIGHT) -#define LV_HOR_RES_MAX (TFT_WIDTH) -#define LV_VER_RES_MAX (TFT_HEIGHT) +/*Color depth: 1 (1 byte per pixel), 8 (RGB332), 16 (RGB565), 32 (ARGB8888)*/ +#define LV_COLOR_DEPTH 16 -/* Color depth: - * - 1: 1 byte per pixel - * - 8: RGB332 - * - 16: RGB565 - * - 32: ARGB8888 - */ -#define LV_COLOR_DEPTH 16 +/*Swap the 2 bytes of RGB565 color. Useful if the display has a 8 bit interface (e.g. SPI)*/ +#define LV_COLOR_16_SWAP 0 -/* Swap the 2 bytes of RGB565 color. - * Useful if the display has a 8 bit interface (e.g. SPI)*/ -#define LV_COLOR_16_SWAP 0 +/*Enable more complex drawing routines to manage screens transparency. + *Can be used if the UI is above another layer, e.g. an OSD menu or video player. + *Requires `LV_COLOR_DEPTH = 32` colors and the screen's `bg_opa` should be set to non LV_OPA_COVER value*/ +#define LV_COLOR_SCREEN_TRANSP 0 -/* 1: Enable screen transparency. - * Useful for OSD or other overlapping GUIs. - * Requires `LV_COLOR_DEPTH = 32` colors and the screen's style should be modified: `style.body.opa = ...`*/ -#define LV_COLOR_SCREEN_TRANSP 0 - -/*Images pixels with this color will not be drawn (with chroma keying)*/ -#define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/ - -/* Enable anti-aliasing (lines, and radiuses will be smoothed) */ -#define LV_ANTIALIAS 1 - -/* Default display refresh period. - * Can be changed in the display driver (`lv_disp_drv_t`).*/ -#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/ - -/* Dot Per Inch: used to initialize default sizes. - * E.g. a button with width = LV_DPI / 2 -> half inch wide - * (Not so important, you can adjust it to modify default sizes and spaces)*/ -#define LV_DPI 130 /*[px]*/ - -/* The the real width of the display changes some default values: - * default object sizes, layout of examples, etc. - * According to the width of the display (hor. res. / dpi) - * the displays fall in 4 categories. - * The 4th is extra large which has no upper limit so not listed here - * The upper limit of the categories are set below in 0.1 inch unit. - */ -#define LV_DISP_SMALL_LIMIT 30 -#define LV_DISP_MEDIUM_LIMIT 50 -#define LV_DISP_LARGE_LIMIT 70 - -/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */ -typedef int16_t lv_coord_t; +/*Images pixels with this color will not be drawn if they are chroma keyed)*/ +#define LV_COLOR_CHROMA_KEY lv_color_hex(0x00ff00) /*pure green*/ /*========================= - Memory manager settings + MEMORY SETTINGS *=========================*/ -/* LittelvGL's internal memory manager's settings. - * The graphical objects and other related data are stored here. */ - -/* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc` and `lv_mem_free` */ -#define LV_MEM_CUSTOM 0 +/*1: use custom malloc/free, 0: use the built-in `lv_mem_alloc()` and `lv_mem_free()`*/ +#define LV_MEM_CUSTOM 0 #if LV_MEM_CUSTOM == 0 -/* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/ -//# define LV_MEM_SIZE (32U * 1024U) - -/* Complier prefix for a big array declaration */ -# define LV_MEM_ATTR - -/* Set an address for the memory pool instead of allocating it as an array. - * Can be in external SRAM too. */ -# define LV_MEM_ADR 0 - -/* Automatically defrag. on free. Defrag. means joining the adjacent free cells. */ -# define LV_MEM_AUTO_DEFRAG 1 -#else /*LV_MEM_CUSTOM*/ -# define LV_MEM_CUSTOM_INCLUDE /*Header for the dynamic memory function*/ -# define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/ -# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/ -#endif /*LV_MEM_CUSTOM*/ - -/* Use the standard memcpy and memset instead of LVGL's own functions. - * The standard functions might or might not be faster depending on their implementation. */ -#define LV_MEMCPY_MEMSET_STD 0 - -/* Garbage Collector settings - * Used if lvgl is binded to higher level language and the memory is managed by that language */ -#define LV_ENABLE_GC 0 -#if LV_ENABLE_GC != 0 -# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/ -# define LV_MEM_CUSTOM_REALLOC your_realloc /*Wrapper to realloc*/ -# define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_get_size*/ -#endif /* LV_ENABLE_GC */ - -/*======================= - Input device settings - *=======================*/ - -/* Input device default settings. - * Can be changed in the Input device driver (`lv_indev_drv_t`)*/ - -/* Input device read period in milliseconds */ -#define LV_INDEV_DEF_READ_PERIOD 30 - -/* Drag threshold in pixels */ -#define LV_INDEV_DEF_DRAG_LIMIT 10 - -/* Drag throw slow-down in [%]. Greater value -> faster slow-down */ -#define LV_INDEV_DEF_DRAG_THROW 10 - -/* Long press time in milliseconds. - * Time to send `LV_EVENT_LONG_PRESSSED`) */ -#define LV_INDEV_DEF_LONG_PRESS_TIME 400 - -/* Repeated trigger period in long press [ms] - * Time between `LV_EVENT_LONG_PRESSED_REPEAT */ -#define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100 - - -/* Gesture threshold in pixels */ -#define LV_INDEV_DEF_GESTURE_LIMIT 50 - -/* Gesture min velocity at release before swipe (pixels)*/ -#define LV_INDEV_DEF_GESTURE_MIN_VELOCITY 3 - -/*================== - * Feature usage - *==================*/ - -/*1: Enable the Animations */ -#define LV_USE_ANIMATION 1 // needed for scroll mode -#if LV_USE_ANIMATION - -/*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/ -typedef void * lv_anim_user_data_t; - +/*Size of the memory available for `lv_mem_alloc()` in bytes (>= 2kB)*/ +#ifndef LV_MEM_SIZE +#define LV_MEM_SIZE (32U * 1024U) /*[bytes]*/ #endif -/* 1: Enable shadow drawing on rectangles*/ -#define LV_USE_SHADOW (LV_HIGH_RESOURCE_MCU) -#if LV_USE_SHADOW -/* Allow buffering some shadow calculation - * LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, - * where shadow size is `shadow_width + radius` - * Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/ -#define LV_SHADOW_CACHE_SIZE 0 -#endif +/*Set an address for the memory pool instead of allocating it as a normal array. Can be in external SRAM too.*/ +#define LV_MEM_ADR 0 /*0: unused*/ +#else /*LV_MEM_CUSTOM*/ +#define LV_MEM_CUSTOM_INCLUDE /*Header for the dynamic memory function*/ +#define LV_MEM_CUSTOM_ALLOC malloc +#define LV_MEM_CUSTOM_FREE free +#define LV_MEM_CUSTOM_REALLOC realloc +#endif /*LV_MEM_CUSTOM*/ -/*1: enable outline drawing on rectangles*/ -#define LV_USE_OUTLINE 1 +/*Use the standard `memcpy` and `memset` instead of LVGL's own functions. (Might or might not be faster).*/ +#define LV_MEMCPY_MEMSET_STD 0 -/*1: enable pattern drawing on rectangles*/ -#define LV_USE_PATTERN 1 - -/*1: enable value string drawing on rectangles*/ -#define LV_USE_VALUE_STR 1 - -/* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/ -#define LV_USE_BLEND_MODES 1 - -/* 1: Use the `opa_scale` style property to set the opacity of an object and its children at once*/ -#define LV_USE_OPA_SCALE 1 - -/* 1: Use image zoom and rotation*/ -#define LV_USE_IMG_TRANSFORM 1 - -/* 1: Enable object groups (for keyboard/encoder navigation) */ -#define LV_USE_GROUP 1 -#if LV_USE_GROUP -typedef void * lv_group_user_data_t; -#endif /*LV_USE_GROUP*/ - -/* 1: Enable GPU interface*/ -#define LV_USE_GPU 1 /*Only enables `gpu_fill_cb` and `gpu_blend_cb` in the disp. drv- */ -#define LV_USE_GPU_STM32_DMA2D 0 -/*If enabling LV_USE_GPU_STM32_DMA2D, LV_GPU_DMA2D_CMSIS_INCLUDE must be defined to include path of CMSIS header of target processor -e.g. "stm32f769xx.h" or "stm32f429xx.h" */ -#define LV_GPU_DMA2D_CMSIS_INCLUDE - -/*1: Use PXP for CPU off-load on NXP RTxxx platforms */ -#define LV_USE_GPU_NXP_PXP 0 - -/*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c) - * and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol FSL_RTOS_FREE_RTOS - * has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected. - *0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init() - * */ -#define LV_USE_GPU_NXP_PXP_AUTO_INIT 0 - -/*1: Use VG-Lite for CPU offload on NXP RTxxx platforms */ -#define LV_USE_GPU_NXP_VG_LITE 0 - -/* 1: Enable file system (might be required for images */ -#define LV_USE_FILESYSTEM 1 -#if LV_USE_FILESYSTEM -/*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/ -typedef void * lv_fs_drv_user_data_t; -#endif - -/*1: Add a `user_data` to drivers and objects*/ -#define LV_USE_USER_DATA 1 - -/*1: Show CPU usage and FPS count in the right bottom corner*/ -#define LV_USE_PERF_MONITOR 0 - -/*1: Use the functions and types from the older API if possible */ -#define LV_USE_API_EXTENSION_V6 0 -#define LV_USE_API_EXTENSION_V7 0 - -/*======================== - * Image decoder and cache - *========================*/ - -/* 1: Enable indexed (palette) images */ -#define LV_IMG_CF_INDEXED 1 - -/* 1: Enable alpha indexed images */ -#define LV_IMG_CF_ALPHA 1 - -/* Default image cache size. Image caching keeps the images opened. - * If only the built-in image formats are used there is no real advantage of caching. - * (I.e. no new image decoder is added) - * With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. - * However the opened images might consume additional RAM. - * LV_IMG_CACHE_DEF_SIZE must be >= 1 */ -#define LV_IMG_CACHE_DEF_SIZE 1 - -/*Declare the type of the user data of image decoder (can be e.g. `void *`, `int`, `struct`)*/ -typedef void * lv_img_decoder_user_data_t; - -/*===================== - * Compiler settings +/*==================== + HAL SETTINGS *====================*/ -/* For big endian systems set to 1 */ -#define LV_BIG_ENDIAN_SYSTEM 0 +/*Default display refresh period. LVG will redraw changed ares with this period time*/ +#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/ -/* Define a custom attribute to `lv_tick_inc` function */ +/*Input device read period in milliseconds*/ +#define LV_INDEV_DEF_READ_PERIOD 30 /*[ms]*/ + +/*Use a custom tick source that tells the elapsed time in milliseconds. + *It removes the need to manually update the tick with `lv_tick_inc()`)*/ +#define LV_TICK_CUSTOM 1 +#if LV_TICK_CUSTOM +#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/ +#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/ +#endif /*LV_TICK_CUSTOM*/ + +/*Default Dot Per Inch. Used to initialize default sizes such as widgets sized, style paddings. + *(Not so important, you can adjust it to modify default sizes and spaces)*/ +#define LV_DPI_DEF 130 /*[px/inch]*/ + +/*======================= + * FEATURE CONFIGURATION + *=======================*/ + +/*------------- + * Drawing + *-----------*/ + +/*Enable complex draw engine. + *Required to draw shadow, gradient, rounded corners, circles, arc, skew lines, image transformations or any masks*/ +#define LV_DRAW_COMPLEX 1 +#if LV_DRAW_COMPLEX != 0 + +/*Allow buffering some shadow calculation. + *LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer, where shadow size is `shadow_width + radius` + *Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/ +#define LV_SHADOW_CACHE_SIZE 0 +#endif /*LV_DRAW_COMPLEX*/ + +/*Default image cache size. Image caching keeps the images opened. + *If only the built-in image formats are used there is no real advantage of caching. (I.e. if no new image decoder is + *added) With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images. However + *the opened images might consume additional RAM. 0: to disable caching*/ +#define LV_IMG_CACHE_DEF_SIZE 0 + +/*Maximum buffer size to allocate for rotation. Only used if software rotation is enabled in the display driver.*/ +#define LV_DISP_ROT_MAX_BUF (10 * 1024) +/*------------- + * GPU + *-----------*/ + +/*Use STM32's DMA2D (aka Chrom Art) GPU*/ +#define LV_USE_GPU_STM32_DMA2D 0 +#if LV_USE_GPU_STM32_DMA2D +/*Must be defined to include path of CMSIS header of target processor +e.g. "stm32f769xx.h" or "stm32f429xx.h"*/ +#define LV_GPU_DMA2D_CMSIS_INCLUDE +#endif + +/*Use NXP's PXP GPU iMX RTxxx platforms*/ +#define LV_USE_GPU_NXP_PXP 0 +#if LV_USE_GPU_NXP_PXP +/*1: Add default bare metal and FreeRTOS interrupt handling routines for PXP (lv_gpu_nxp_pxp_osa.c) + * and call lv_gpu_nxp_pxp_init() automatically during lv_init(). Note that symbol SDK_OS_FREE_RTOS + * has to be defined in order to use FreeRTOS OSA, otherwise bare-metal implementation is selected. + *0: lv_gpu_nxp_pxp_init() has to be called manually before lv_init() + */ +#define LV_USE_GPU_NXP_PXP_AUTO_INIT 0 +#endif + +/*Use NXP's VG-Lite GPU iMX RTxxx platforms*/ +#define LV_USE_GPU_NXP_VG_LITE 0 + +/*------------- + * Logging + *-----------*/ + +/*Enable the log module*/ +#define LV_USE_LOG 1 +#if LV_USE_LOG + +/*How important log should be added: + *LV_LOG_LEVEL_TRACE A lot of logs to give detailed information + *LV_LOG_LEVEL_INFO Log important events + *LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem + *LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail + *LV_LOG_LEVEL_USER Only logs added by the user + *LV_LOG_LEVEL_NONE Do not log anything*/ +#define LV_LOG_LEVEL LV_LOG_LEVEL_WARN + +/*1: Print the log with 'printf'; + *0: User need to register a callback with `lv_log_register_print_cb()`*/ +#define LV_LOG_PRINTF 0 + +/*Enable/disable LV_LOG_TRACE in modules that produces a huge number of logs*/ +#define LV_LOG_TRACE_MEM 1 +#define LV_LOG_TRACE_TIMER 1 +#define LV_LOG_TRACE_INDEV 1 +#define LV_LOG_TRACE_DISP_REFR 1 +#define LV_LOG_TRACE_EVENT 1 +#define LV_LOG_TRACE_OBJ_CREATE 1 +#define LV_LOG_TRACE_LAYOUT 1 +#define LV_LOG_TRACE_ANIM 1 + +#endif /*LV_USE_LOG*/ + +/*------------- + * Asserts + *-----------*/ + +/*Enable asserts if an operation is failed or an invalid data is found. + *If LV_USE_LOG is enabled an error message will be printed on failure*/ +#define LV_USE_ASSERT_NULL 1 /*Check if the parameter is NULL. (Very fast, recommended)*/ +#define LV_USE_ASSERT_MALLOC 1 /*Checks is the memory is successfully allocated or no. (Very fast, recommended)*/ +#define LV_USE_ASSERT_STYLE 0 /*Check if the styles are properly initialized. (Very fast, recommended)*/ +#define LV_USE_ASSERT_MEM_INTEGRITY 0 /*Check the integrity of `lv_mem` after critical operations. (Slow)*/ +#define LV_USE_ASSERT_OBJ 0 /*Check the object's type and existence (e.g. not deleted). (Slow)*/ + +/*Add a custom handler when assert happens e.g. to restart the MCU*/ +#define LV_ASSERT_HANDLER_INCLUDE +#define LV_ASSERT_HANDLER \ + while(1) \ + ; /*Halt by default*/ + +/*------------- + * Others + *-----------*/ + +/*1: Show CPU usage and FPS count in the right bottom corner*/ +#define LV_USE_PERF_MONITOR 1 + +/*1: Show the used memory and the memory fragmentation in the left bottom corner + * Requires LV_MEM_CUSTOM = 0*/ +#define LV_USE_MEM_MONITOR 1 + +/*1: Draw random colored rectangles over the redrawn areas*/ +#define LV_USE_REFR_DEBUG 0 + +/*Change the built in (v)snprintf functions*/ +#define LV_SPRINTF_CUSTOM 0 +#if LV_SPRINTF_CUSTOM +#define LV_SPRINTF_INCLUDE +#define lv_snprintf snprintf +#define lv_vsnprintf vsnprintf +#else /*LV_SPRINTF_CUSTOM*/ +#define LV_SPRINTF_USE_FLOAT 0 +#endif /*LV_SPRINTF_CUSTOM*/ + +#define LV_USE_USER_DATA 1 + +typedef struct +{ + uint8_t id : 8; + uint8_t objid : 8; + uint8_t transitionid : 4; + uint8_t actionid : 4; + uint8_t groupid : 4; + uint8_t swipeid : 4; +} lv_obj_user_data_t; + +/*Garbage Collector settings + *Used if lvgl is binded to higher level language and the memory is managed by that language*/ +#define LV_ENABLE_GC 0 +#if LV_ENABLE_GC != 0 +#define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/ +#endif /*LV_ENABLE_GC*/ + +/*===================== + * COMPILER SETTINGS + *====================*/ + +/*For big endian systems set to 1*/ +#define LV_BIG_ENDIAN_SYSTEM 0 + +/*Define a custom attribute to `lv_tick_inc` function*/ #define LV_ATTRIBUTE_TICK_INC -/* Define a custom attribute to `lv_task_handler` function */ +/*Define a custom attribute to `lv_timer_handler` function*/ #define LV_ATTRIBUTE_TIMER_HANDLER -/* Define a custom attribute to `lv_disp_flush_ready` function */ +/*Define a custom attribute to `lv_disp_flush_ready` function*/ #define LV_ATTRIBUTE_FLUSH_READY -/* Required alignment size for buffers */ +/*Required alignment size for buffers*/ #define LV_ATTRIBUTE_MEM_ALIGN_SIZE -/* With size optimization (-Os) the compiler might not align data to - * 4 or 8 byte boundary. Some HW may need even 32 or 64 bytes. - * This alignment will be explicitly applied where needed. - * LV_ATTRIBUTE_MEM_ALIGN_SIZE should be used to specify required align size. - * E.g. __attribute__((aligned(LV_ATTRIBUTE_MEM_ALIGN_SIZE))) */ +/*Will be added where memories needs to be aligned (with -Os data might not be aligned to boundary by default). + * E.g. __attribute__((aligned(4)))*/ #define LV_ATTRIBUTE_MEM_ALIGN -/* Attribute to mark large constant arrays for example - * font's bitmaps */ +/*Attribute to mark large constant arrays for example font's bitmaps*/ #define LV_ATTRIBUTE_LARGE_CONST -/* Prefix performance critical functions to place them into a faster memory (e.g RAM) - * Uses 15-20 kB extra memory */ +/*Complier prefix for a big array declaration in RAM*/ +#define LV_ATTRIBUTE_LARGE_RAM_ARRAY + +/*Place performance critical functions into a faster memory (e.g RAM)*/ +#ifndef LV_ATTRIBUTE_FAST_MEM #define LV_ATTRIBUTE_FAST_MEM +#endif -/* Export integer constant to binding. - * This macro is used with constants in the form of LV_ that - * should also appear on lvgl binding API such as Micropython - * - * The default value just prevents a GCC warning. - */ -#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning - -/* Prefix variables that are used in GPU accelerated operations, often these need to be - * placed in RAM sections that are DMA accessible */ +/*Prefix variables that are used in GPU accelerated operations, often these need to be placed in RAM sections that are + * DMA accessible*/ #define LV_ATTRIBUTE_DMA -/*=================== - * HAL settings - *==================*/ +/*Export integer constant to binding. This macro is used with constants in the form of LV_ that + *should also appear on LVGL binding API such as Micropython.*/ +#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning /*The default value just prevents GCC warning*/ -/* 1: use a custom tick source. - * It removes the need to manually update the tick with `lv_tick_inc`) */ -#define LV_TICK_CUSTOM 1 -#if LV_TICK_CUSTOM == 1 -#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the sys time function*/ -#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current systime in ms*/ -#endif /*LV_TICK_CUSTOM*/ - -typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/ -typedef void * lv_indev_drv_user_data_t; /*Type of user data in the input device driver*/ - -/*================ - * Log settings - *===============*/ - -/*1: Enable the log module*/ -#define LV_USE_LOG 0 -#if LV_USE_LOG -/* How important log should be added: - * LV_LOG_LEVEL_TRACE A lot of logs to give detailed information - * LV_LOG_LEVEL_INFO Log important events - * LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem - * LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail - * LV_LOG_LEVEL_NONE Do not log anything - */ -# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN - -/* 1: Print the log with 'printf'; - * 0: user need to register a callback with `lv_log_register_print_cb`*/ -# define LV_LOG_PRINTF 0 -#endif /*LV_USE_LOG*/ - -/*================= - * Debug settings - *================*/ - -/* If Debug is enabled LittelvGL validates the parameters of the functions. - * If an invalid parameter is found an error log message is printed and - * the MCU halts at the error. (`LV_USE_LOG` should be enabled) - * If you are debugging the MCU you can pause - * the debugger to see exactly where the issue is. - * - * The behavior of asserts can be overwritten by redefining them here. - * E.g. #define LV_ASSERT_MEM(p) - */ -#define LV_USE_DEBUG 1 -#if LV_USE_DEBUG - -/*Check if the parameter is NULL. (Quite fast) */ -#define LV_USE_ASSERT_NULL 1 - -/*Checks is the memory is successfully allocated or no. (Quite fast)*/ -#define LV_USE_ASSERT_MEM 1 - -/*Check the integrity of `lv_mem` after critical operations. (Slow)*/ -#define LV_USE_ASSERT_MEM_INTEGRITY 0 - -/* Check the strings. - * Search for NULL, very long strings, invalid characters, and unnatural repetitions. (Slow) - * If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */ -#define LV_USE_ASSERT_STR 0 - -/* Check NULL, the object's type and existence (e.g. not deleted). (Quite slow) - * If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */ -#define LV_USE_ASSERT_OBJ 0 - -/*Check if the styles are properly initialized. (Fast)*/ -#define LV_USE_ASSERT_STYLE 0 - -#endif /*LV_USE_DEBUG*/ +/*Extend the default -32k..32k coordinate range to -4M..4M by using int32_t for coordinates instead of int16_t*/ +#define LV_USE_LARGE_COORD 0 /*================== - * FONT USAGE + * FONT USAGE *===================*/ -/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel. - * The symbols are available via `LV_SYMBOL_...` defines - * More info about fonts: https://docs.lvgl.io/v7/en/html/overview/font.html - * To create a new font go to: https://lvgl.com/ttf-font-to-c-array - */ +#if TFT_WIDTH >= 320 || TFT_WIDTH >= 480 -/* Montserrat fonts with bpp = 4 - * https://fonts.google.com/specimen/Montserrat */ -#define LV_FONT_MONTSERRAT_8 0 -#define LV_FONT_MONTSERRAT_10 0 -#define LV_FONT_MONTSERRAT_12 (LV_HIGH_RESOURCE_MCU) -#define LV_FONT_MONTSERRAT_14 0 -#define LV_FONT_MONTSERRAT_16 (LV_HIGH_RESOURCE_MCU) -#define LV_FONT_MONTSERRAT_18 0 -#define LV_FONT_MONTSERRAT_20 0 -#define LV_FONT_MONTSERRAT_22 (LV_HIGH_RESOURCE_MCU) -#define LV_FONT_MONTSERRAT_24 0 -#define LV_FONT_MONTSERRAT_26 0 -#define LV_FONT_MONTSERRAT_28 0 -#define LV_FONT_MONTSERRAT_30 0 -#define LV_FONT_MONTSERRAT_32 0 -#define LV_FONT_MONTSERRAT_34 0 -#define LV_FONT_MONTSERRAT_36 0 -#define LV_FONT_MONTSERRAT_38 0 -#define LV_FONT_MONTSERRAT_40 0 -#define LV_FONT_MONTSERRAT_42 0 -#define LV_FONT_MONTSERRAT_44 0 -#define LV_FONT_MONTSERRAT_46 0 -#define LV_FONT_MONTSERRAT_48 0 +#ifndef HASP_FONT_1 +#define HASP_FONT_1 robotocondensed_regular_16_latin1 /* 5% Width */ +#endif +#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 -/* Demonstrate special features */ -#define LV_FONT_MONTSERRAT_12_SUBPX 0 -#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/ -#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, PErisan letters and all their forms*/ -#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/ +#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 +#endif -/*Pixel perfect monospace font - * http://pelulamu.net/unscii/ */ -#define LV_FONT_UNSCII_8 0 -#define LV_FONT_UNSCII_16 0 +#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 -/*Custom font*/ -#define UNSCII_8_ICON 1 +#else // not 320x480 + +#ifndef HASP_FONT_1 +#define HASP_FONT_1 robotocondensed_regular_12_latin1 /* 5% Width */ +#endif +#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 */ +#endif + +#ifndef ROBOTOCONDENSED_REGULAR_12_LATIN1 +#define ROBOTOCONDENSED_REGULAR_12_LATIN1 1 +#endif +#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 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 + +/*Montserrat fonts with ASCII range and some symbols using bpp = 4 + *https://fonts.google.com/specimen/Montserrat*/ +#define LV_FONT_MONTSERRAT_8 0 +#define LV_FONT_MONTSERRAT_10 0 +#define LV_FONT_MONTSERRAT_12 0 +#define LV_FONT_MONTSERRAT_14 0 +#define LV_FONT_MONTSERRAT_16 0 +#define LV_FONT_MONTSERRAT_18 0 +#define LV_FONT_MONTSERRAT_20 0 +#define LV_FONT_MONTSERRAT_22 0 +#define LV_FONT_MONTSERRAT_24 0 +#define LV_FONT_MONTSERRAT_26 0 +#define LV_FONT_MONTSERRAT_28 0 +#define LV_FONT_MONTSERRAT_30 0 +#define LV_FONT_MONTSERRAT_32 0 +#define LV_FONT_MONTSERRAT_34 0 +#define LV_FONT_MONTSERRAT_36 0 +#define LV_FONT_MONTSERRAT_38 0 +#define LV_FONT_MONTSERRAT_40 0 +#define LV_FONT_MONTSERRAT_42 0 +#define LV_FONT_MONTSERRAT_44 0 +#define LV_FONT_MONTSERRAT_46 0 +#define LV_FONT_MONTSERRAT_48 0 + +/*Demonstrate special features*/ +#define LV_FONT_MONTSERRAT_12_SUBPX 0 +#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/ +#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, Perisan letters and all their forms*/ +#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/ + +/*Pixel perfect monospace fonts*/ +#define LV_FONT_UNSCII_8 0 +#define LV_FONT_UNSCII_16 0 -/* Optionally declare your custom fonts here. - * You can use these fonts as default font too - * and they will be available globally. E.g. - * #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \ - * LV_FONT_DECLARE(my_font_2) - */ /*Always set a default font from the built-in fonts*/ -#if LV_HIGH_RESOURCE_MCU>0 -#define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(lv_font_montserrat_16); -#define LV_FONT_DEFAULT &lv_font_montserrat_16 +#if LV_HIGH_RESOURCE_MCU > 0 +// #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(lv_font_montserrat_16); + +// #define LV_FONT_CUSTOM_12 LV_FONT_DECLARE(robotocondensed_regular_12) +// #define LV_FONT_CUSTOM_16 LV_FONT_DECLARE(robotocondensed_regular_16) +// #define LV_FONT_CUSTOM_22 LV_FONT_DECLARE(robotocondensed_regular_22) +// #define LV_FONT_CUSTOM_28 LV_FONT_DECLARE(robotocondensed_regular_28) + +#define LV_FONT_CUSTOM_DECLARE \ + LV_FONT_DECLARE(HASP_FONT_1) \ + LV_FONT_DECLARE(HASP_FONT_2) \ + LV_FONT_DECLARE(HASP_FONT_3) \ + LV_FONT_DECLARE(HASP_FONT_4) + +/*Always set a default font*/ +#define LV_FONT_DEFAULT &HASP_FONT_2 //&lv_font_montserrat_16 #else #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(unscii_8_icon); -#define LV_FONT_DEFAULT &unscii_8_icon //&lv_font_unscii_8 +/*Always set a default font*/ +#define LV_FONT_DEFAULT &unscii_8_icon //&lv_font_unscii_8 //#define LV_FONT_DEFAULT my_font #endif -/* Enable it if you have fonts with a lot of characters. - * The limit depends on the font size, font face and bpp - * but with > 10,000 characters if you see issues probably you need to enable it.*/ -#define LV_FONT_FMT_TXT_LARGE 0 +/*Enable handling large font and/or fonts with a lot of characters. + *The limit depends on the font size, font face and bpp. + *Compiler error will be triggered if a font needs it.*/ +#define LV_FONT_FMT_TXT_LARGE 0 -/* Enables/disables support for compressed fonts. If it's disabled, compressed - * glyphs cannot be processed by the library and won't be rendered. - */ +/*Enables/disables support for compressed fonts.*/ #define LV_USE_FONT_COMPRESSED 1 -/* Enable subpixel rendering */ +/*Enable subpixel rendering*/ #define LV_USE_FONT_SUBPX 0 #if LV_USE_FONT_SUBPX -/* Set the pixel order of the display. - * Important only if "subpx fonts" are used. - * With "normal" font it doesn't matter. - */ -#define LV_FONT_SUBPX_BGR 0 -#endif - -/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/ -typedef void * lv_font_user_data_t; - -/*================ - * THEME USAGE - *================*/ - -/*Always enable at least on theme*/ - -/* No theme, you can apply your styles as you need - * No flags. Set LV_THEME_DEFAULT_FLAG 0 */ -#define LV_USE_THEME_EMPTY 0 - -/* A fast and impressive theme. - * Flags: - * LV_THEME_MATERIAL_FLAG_LIGHT: light theme - * LV_THEME_MATERIAL_FLAG_DARK: dark theme - * LV_THEME_MATERIAL_FLAG_NO_TRANSITION: disable transitions (state change animations) - * LV_THEME_MATERIAL_FLAG_NO_FOCUS: disable indication of focused state) - * */ -#define LV_USE_THEME_MATERIAL 1 - -/* Mono-color theme for monochrome displays. - * If LV_THEME_DEFAULT_COLOR_PRIMARY is LV_COLOR_BLACK the - * texts and borders will be black and the background will be - * white. Else the colors are inverted. - * No flags. Set LV_THEME_DEFAULT_FLAG 0 */ -#define LV_USE_THEME_MONO 1 -#define LV_USE_THEME_HASP 1 - -#define LV_THEME_DEFAULT_INCLUDE /*Include a header for the init. function*/ -#define LV_THEME_DEFAULT_INIT lv_theme_hasp_init -#define LV_THEME_DEFAULT_COLOR_PRIMARY lv_color_hex(0x01a2b1) -#define LV_THEME_DEFAULT_COLOR_SECONDARY lv_color_hex(0x44d1b6) -#define LV_THEME_DEFAULT_FLAG LV_THEME_MATERIAL_FLAG_LIGHT -#if LV_HIGH_RESOURCE_MCU -#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_12 -#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_16 -#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_22 -#define LV_THEME_DEFAULT_FONT_TITLE &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 -#define LV_THEME_DEFAULT_FONT_SUBTITLE LV_FONT_DEFAULT // &lv_font_montserrat_22 -#define LV_THEME_DEFAULT_FONT_TITLE LV_FONT_DEFAULT // &lv_font_montserrat_28_compressed +/*Set the pixel order of the display. Physical order of RGB channels. Doesn't matter with "normal" fonts.*/ +#define LV_FONT_SUBPX_BGR 0 /*0: RGB; 1:BGR order*/ #endif /*================= - * Text settings + * TEXT SETTINGS *=================*/ -/* Select a character encoding for strings. +/** + * Select a character encoding for strings. * Your IDE or editor should have the same character encoding * - LV_TXT_ENC_UTF8 * - LV_TXT_ENC_ASCII - * */ + */ #define LV_TXT_ENC LV_TXT_ENC_UTF8 - /*Can break (wrap) texts on these chars*/ -#define LV_TXT_BREAK_CHARS " ,.;:-_" +/*Can break (wrap) texts on these chars*/ +#define LV_TXT_BREAK_CHARS " ,.;:-_" -/* If a word is at least this long, will break wherever "prettiest" - * To disable, set to a value <= 0 */ -#define LV_TXT_LINE_BREAK_LONG_LEN 0 +/*If a word is at least this long, will break wherever "prettiest" + *To disable, set to a value <= 0*/ +#define LV_TXT_LINE_BREAK_LONG_LEN 0 -/* Minimum number of characters in a long word to put on a line before a break. - * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ -#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 +/*Minimum number of characters in a long word to put on a line before a break. + *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ +#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3 -/* Minimum number of characters in a long word to put on a line after a break. - * Depends on LV_TXT_LINE_BREAK_LONG_LEN. */ +/*Minimum number of characters in a long word to put on a line after a break. + *Depends on LV_TXT_LINE_BREAK_LONG_LEN.*/ #define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3 -/* The control character to use for signalling text recoloring. */ +/*The control character to use for signalling text recoloring.*/ #define LV_TXT_COLOR_CMD "#" -/* Support bidirectional texts. - * Allows mixing Left-to-Right and Right-to-Left texts. - * The direction will be processed according to the Unicode Bidirectioanl Algorithm: - * https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ -#define LV_USE_BIDI 0 +/*Support bidirectional texts. Allows mixing Left-to-Right and Right-to-Left texts. + *The direction will be processed according to the Unicode Bidirectioanl Algorithm: + *https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/ +#define LV_USE_BIDI 0 #if LV_USE_BIDI -/* Set the default direction. Supported values: - * `LV_BIDI_DIR_LTR` Left-to-Right - * `LV_BIDI_DIR_RTL` Right-to-Left - * `LV_BIDI_DIR_AUTO` detect texts base direction */ -#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO +/*Set the default direction. Supported values: + *`LV_BASE_DIR_LTR` Left-to-Right + *`LV_BASE_DIR_RTL` Right-to-Left + *`LV_BASE_DIR_AUTO` detect texts base direction*/ +#define LV_BIDI_BASE_DIR_DEF LV_BASE_DIR_AUTO #endif -/* Enable Arabic/Persian processing - * In these languages characters should be replaced with - * an other form based on their position in the text */ +/*Enable Arabic/Persian processing + *In these languages characters should be replaced with an other form based on their position in the text*/ #define LV_USE_ARABIC_PERSIAN_CHARS 0 -/*Change the built in (v)snprintf functions*/ -#define LV_SPRINTF_CUSTOM 1 // saves 1.4 KiB -#if LV_SPRINTF_CUSTOM -# define LV_SPRINTF_INCLUDE -# define lv_snprintf snprintf -# define lv_vsnprintf vsnprintf -#else /*!LV_SPRINTF_CUSTOM*/ -# define LV_SPRINTF_DISABLE_FLOAT 1 -#endif /*LV_SPRINTF_CUSTOM*/ - -/*================= - * STYLE SETTINGS - *================*/ - -/* Enable/Disable caching some information about the most common style properties. - * Results in faster drawing but has some memory cost per object per part. - * LEVEL 0: no caching - * LEVEL 1: mark if a property is different from its default value (uses 4 extra byte) - * LEVEL 2: LEVEL 1 + cache the value of some common properties (uses 8 extra bytes) - */ -#define LV_STYLE_CACHE_LEVEL 0 /*Cache level*/ - -/*=================== - * LV_OBJ SETTINGS - *==================*/ - -typedef struct { - uint8_t id:8; - uint8_t objid:8; - uint8_t transitionid:4; - uint8_t actionid:4; - uint8_t groupid:4; - uint8_t swipeid:4; -} lv_obj_user_data_t; - -#if LV_USE_USER_DATA -/*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/ -//typedef hasp_obj_user_data_t lv_obj_user_data_t; -/*Provide a function to free user data*/ -#define LV_USE_USER_DATA_FREE 0 -#if LV_USE_USER_DATA_FREE -# define LV_USER_DATA_FREE_INCLUDE "something.h" /*Header for user data free function*/ -/* Function prototype : void user_data_free(lv_obj_t * obj); */ -# define LV_USER_DATA_FREE (user_data_free) /*Invoking for user data free function*/ -#endif -#endif - -#define LV_USE_OBJ_REALIGN 1 - -/* Enable to make the object clickable on a larger area. - * LV_EXT_CLICK_AREA_OFF or 0: Disable this feature - * LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px) - * LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px) - */ -#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_TINY - /*================== - * LV OBJ X USAGE + * WIDGET USAGE *================*/ -/* - * Documentation of the object types: https://docs.lvgl.com/#Object-types - */ -/*Arc (dependencies: -)*/ -#define LV_USE_ARC 1 +/*Documentation of the widgets: https://docs.lvgl.io/latest/en/html/widgets/index.html*/ -/*Bar (dependencies: -)*/ -#define LV_USE_BAR 1 +#define LV_USE_ARC 1 -/*Button (dependencies: lv_cont*/ -#define LV_USE_BTN 1 +#define LV_USE_ANIMIMG 1 -/*Button matrix (dependencies: -)*/ -#define LV_USE_BTNMATRIX 1 +#define LV_USE_BAR 1 -/*Canvas (dependencies: lv_img)*/ -#define LV_USE_CANVAS 1 +#define LV_USE_BTN 1 -/*Check box (dependencies: lv_btn, lv_label)*/ -#define LV_USE_CHECKBOX 1 +#define LV_USE_BTNMATRIX 1 -/*Chart (dependencies: -)*/ -#define LV_USE_CHART 1 -#if LV_USE_CHART -# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 256 +#define LV_USE_CANVAS 1 + +#define LV_USE_CHECKBOX 1 + +#define LV_USE_DROPDOWN 1 /*Requires: lv_label*/ + +#define LV_USE_IMG 1 /*Requires: lv_label*/ + +#define LV_USE_LABEL 1 +#if LV_USE_LABEL +#define LV_LABEL_TEXT_SELECTION 1 /*Enable selecting text of the label*/ +#define LV_LABEL_LONG_TXT_HINT 1 /*Store some extra info in labels to speed up drawing of very long texts*/ #endif -/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/ -#define LV_USE_DROPDOWN 1 -#if LV_USE_DROPDOWN != 0 -/*Open and close default animation time [ms] (0: no animation)*/ -# define LV_DROPDOWN_DEF_ANIM_TIME 200 +#define LV_USE_LINE 1 + +#define LV_USE_ROLLER 1 /*Requires: lv_label*/ +#if LV_USE_ROLLER +#define LV_ROLLER_INF_PAGES 7 /*Number of extra "pages" when the roller is infinite*/ #endif +#define LV_USE_SLIDER 1 /*Requires: lv_bar*/ -/*Gauge (dependencies:lv_bar, lv_linemeter)*/ -#define LV_USE_GAUGE 1 +#define LV_USE_SWITCH 1 -/*Image (dependencies: lv_label*/ -#define LV_USE_IMG 1 - -/*Image Button (dependencies: lv_btn*/ -#define LV_USE_IMGBTN 1 -#if LV_USE_IMGBTN -/*1: The imgbtn requires left, mid and right parts and the width can be set freely*/ -# define LV_IMGBTN_TILED 0 -#endif - -/*Label (dependencies: -*/ -#define LV_USE_LABEL 1 -#if LV_USE_LABEL != 0 -/*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_ROLL/ROLL_CIRC' mode*/ -# define LV_LABEL_DEF_SCROLL_SPEED 25 - -/* Waiting period at beginning/end of animation cycle */ -# define LV_LABEL_WAIT_CHAR_COUNT 3 - -/*Enable selecting text of the label */ -# define LV_LABEL_TEXT_SEL 0 - -/*Store extra some info in labels (12 bytes) to speed up drawing of very long texts*/ -# define LV_LABEL_LONG_TXT_HINT 0 -#endif - -/*Line (dependencies: -*/ -#define LV_USE_LINE 1 - -/*Linemeter (dependencies: -*/ -#define LV_USE_LINEMETER 1 -#if LV_USE_LINEMETER - -/* Set how precisely should the lines of the line meter be calculated. - * Higher precision means slower rendering. - * 0: normal - * 1: extra precision in the inner ring - * 2. extra precision on the outer ring too - */ -# define LV_LINEMETER_PRECISE 2 -#endif -/*Mask (dependencies: -)*/ -#define LV_USE_OBJMASK 1 - -/*Roller (dependencies: lv_ddlist)*/ -#define LV_USE_ROLLER 1 -#if LV_USE_ROLLER != 0 -/*Focus animation time [ms] (0: no animation)*/ -# define LV_ROLLER_DEF_ANIM_TIME 200 - -/*Number of extra "pages" when the roller is infinite*/ -# define LV_ROLLER_INF_PAGES 7 -#endif - -/*Slider (dependencies: lv_bar)*/ -#define LV_USE_SLIDER 1 - -/*Switch (dependencies: lv_slider)*/ -#define LV_USE_SWITCH 1 - -/*Text area (dependencies: lv_label, lv_page)*/ -#define LV_USE_TEXTAREA 1 +#define LV_USE_TEXTAREA 1 /*Requires: lv_label*/ #if LV_USE_TEXTAREA != 0 -# define LV_TEXTAREA_DEF_CURSOR_BLINK_TIME 400 /*ms*/ -# define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ +#define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/ #endif -/*Table (dependencies: lv_label)*/ -#define LV_USE_TABLE 1 -#if LV_USE_TABLE -# define LV_TABLE_COL_MAX 12 -# define LV_TABLE_CELL_STYLE_CNT 4 -#endif +#define LV_USE_TABLE 1 /*================== - * Non-user section + * EXTRA COMPONENTS *==================*/ -#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/ -# define _CRT_SECURE_NO_WARNINGS +/*----------- + * Widgets + *----------*/ +#define LV_USE_CALENDAR 1 +#if LV_USE_CALENDAR +#define LV_CALENDAR_WEEK_STARTS_MONDAY 0 +#if LV_CALENDAR_WEEK_STARTS_MONDAY +#define LV_CALENDAR_DEFAULT_DAY_NAMES \ + { \ + "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su" \ + } +#else +#define LV_CALENDAR_DEFAULT_DAY_NAMES \ + { \ + "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" \ + } #endif +#define LV_CALENDAR_DEFAULT_MONTH_NAMES \ + { \ + "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", \ + "December" \ + } +#define LV_USE_CALENDAR_HEADER_ARROW 1 +#define LV_USE_CALENDAR_HEADER_DROPDOWN 1 +#endif /*LV_USE_CALENDAR*/ + +#define LV_USE_CHART 1 + +#define LV_USE_COLORWHEEL 1 + +#define LV_USE_IMGBTN 1 + +#define LV_USE_KEYBOARD 1 + +#define LV_USE_LED 1 + +#define LV_USE_LIST 1 + +#define LV_USE_METER 1 + +#define LV_USE_MSGBOX 1 + +#define LV_USE_SPINBOX 1 + +#define LV_USE_SPINNER 1 + +#define LV_USE_TABVIEW 1 + +#define LV_USE_TILEVIEW 1 + +#define LV_USE_WIN 1 + +#define LV_USE_SPAN 1 +#if LV_USE_SPAN +/*A line text can contain maximum num of span descriptor */ +#define LV_SPAN_SNIPPET_STACK_SIZE 64 +#endif + +/*----------- + * Themes + *----------*/ +/*A simple, impressive and very complete theme*/ +#define LV_USE_THEME_DEFAULT 1 +#if LV_USE_THEME_DEFAULT + +/*0: Light mode; 1: Dark mode*/ +#define LV_THEME_DEFAULT_DARK 0 + +/*1: Enable grow on press*/ +#define LV_THEME_DEFAULT_GROW 1 + +/*Default transition time in [ms]*/ +#define LV_THEME_DEFAULT_TRANSITON_TIME 80 +#endif /*LV_USE_THEME_DEFAULT*/ + +/*An very simple them that is a good starting point for a custom theme*/ +#define LV_USE_THEME_BASIC 1 + +/*A theme designed for monochrome displays*/ +#define LV_USE_THEME_MONO 1 + +/*----------- + * Layouts + *----------*/ + +/*A layout similar to Flexbox in CSS.*/ +#define LV_USE_FLEX 1 + +/*A layout similar to Grid in CSS.*/ +#define LV_USE_GRID 1 + +/*================== + * EXAMPLES + *==================*/ + +/*Enable the examples to be built with the library*/ +#define LV_BUILD_EXAMPLES 0 + /*--END OF LV_CONF_H--*/ #endif /*LV_CONF_H*/ diff --git a/include/lv_symbol_mdi_def.h b/include/lv_symbol_mdi_def.h index 0edd74a4..ab832296 100644 --- a/include/lv_symbol_mdi_def.h +++ b/include/lv_symbol_mdi_def.h @@ -25,7 +25,7 @@ extern "C" { #define LV_SYMBOL_CLOSE "\xEE\x85\x96" /* 0xE156, close */ #define LV_SYMBOL_NEW_LINE "\xEE\x98\x8C" /* 0xE60C, subdirectory-arrow-left */ #define LV_SYMBOL_BACKSPACE "\xEE\x81\x8D" /* 0xE04D, arrow-left */ - +#define LV_SYMBOL_KEYBOARD "\xEF\xA3\xBF" /** Invalid symbol at (U+F8FF). If written before a string then `lv_img` will show it as a label*/ #define LV_SYMBOL_DUMMY "\xEF\xA3\xBF" diff --git a/lib/lv_lib_qrcode/lv_qrcode.c b/lib/lv_lib_qrcode/lv_qrcode.c index 77f2697e..bc6b026d 100644 --- a/lib/lv_lib_qrcode/lv_qrcode.c +++ b/lib/lv_lib_qrcode/lv_qrcode.c @@ -6,16 +6,13 @@ /********************* * INCLUDES *********************/ -#include "lvgl.h" -#include "lv_misc/lv_debug.h" -#include "lv_widgets/lv_canvas.h" #include "lv_qrcode.h" #include "qrcodegen.h" /********************* * DEFINES *********************/ -#define QR_SIZE 150 +#define QR_SIZE 140 /********************** * TYPEDEFS @@ -49,38 +46,17 @@ lv_obj_t* lv_qrcode_create(lv_obj_t* parent, lv_coord_t size, lv_color_t dark_co { uint32_t buf_size = LV_CANVAS_BUF_SIZE_INDEXED_1BIT(size, size); uint8_t* buf = lv_mem_alloc(buf_size); - LV_ASSERT_MEM(buf); + LV_ASSERT_MALLOC(buf); if(buf == NULL) return NULL; - lv_obj_t* canvas = lv_canvas_create(parent, NULL); + lv_obj_t* canvas = lv_canvas_create(parent); + if(canvas == NULL) return NULL; lv_canvas_set_buffer(canvas, buf, size, size, LV_IMG_CF_INDEXED_1BIT); lv_canvas_set_palette(canvas, 0, dark_color); lv_canvas_set_palette(canvas, 1, light_color); return canvas; - - // lv_img_dsc_t * img_buf = lv_img_buf_alloc(20, 20, LV_IMG_CF_TRUE_COLOR); - // if(img_buf == NULL) { - // LV_LOG_ERROR("img_buf failed"); - // return NULL; - // } - - // lv_obj_t * image = lv_img_create(parent, NULL); // empty image - // if(image == NULL) { - // lv_img_buf_free(img_buf); - // LV_LOG_ERROR("image failed"); - // return NULL; - // } - - // lv_img_set_auto_size(image, true); // auto size according to img_buf - // lv_img_set_src(image, img_buf); // assign the image buffer - - // lv_img_set_zoom(image, 5 * LV_IMG_ZOOM_NONE); // default zoom - // lv_img_set_antialias(image, false); // don't anti-alias - // lv_obj_set_style_local_image_recolor(image, LV_IMG_PART_MAIN, LV_STATE_DEFAULT, dark_color); - - // return image; } /** @@ -94,8 +70,7 @@ lv_res_t lv_qrcode_update(lv_obj_t* qrcode, const void* data, uint32_t data_len) { lv_color_t c; c.full = 1; - lv_canvas_fill_bg(qrcode, c, 0); - // lv_canvas_zoom(); + lv_canvas_fill_bg(qrcode, c, LV_OPA_COVER); if(data_len > qrcodegen_BUFFER_LEN_MAX) return LV_RES_INV; @@ -108,60 +83,58 @@ lv_res_t lv_qrcode_update(lv_obj_t* qrcode, const void* data, uint32_t data_len) if(!ok) return LV_RES_INV; - lv_coord_t obj_w = lv_obj_get_width(qrcode); - int qr_size = qrcodegen_getSize(qr0); - int scale = obj_w / qr_size; - int scaled = qr_size * scale; - int margin = (obj_w - scaled) / 2; + lv_img_dsc_t* imgdsc = lv_canvas_get_img(qrcode); + lv_coord_t obj_w = imgdsc->header.w; + int qr_size = qrcodegen_getSize(qr0); + int scale = obj_w / qr_size; + int scaled = qr_size * scale; + int margin = (obj_w - scaled) / 2; + uint8_t* buf_u8 = (uint8_t*)imgdsc->data + 8; /*+8 skip the palette*/ - for(int y = 0; y < scaled; y++) { - for(int x = 0; x < scaled; x++) { - c.full = qrcodegen_getModule(qr0, x / scale, y / scale) ? 0 : 1; - lv_canvas_set_px(qrcode, x + margin, y + margin, c); + /* Copy the qr code canvas: + * A simple `lv_canvas_set_px` would work but it's slow for so many pixels. + * So buffer 1 byte (8 px) from the qr code and set it in the canvas image */ + uint32_t row_byte_cnt = (imgdsc->header.w + 7) >> 3; + int y; + for(y = margin; y < scaled + margin; y += scale) { + uint8_t b = 0; + uint8_t p = 0; + bool aligned = false; + int x; + for(x = margin; x < scaled + margin; x++) { + bool a = qrcodegen_getModule(qr0, (x - margin) / scale, (y - margin) / scale); + + if(aligned == false && (x & 0x7) == 0) aligned = true; + + if(aligned == false) { + c.full = a ? 0 : 1; + lv_canvas_set_px(qrcode, x, y, c); + } else { + if(!a) b |= (1 << (7 - p)); + p++; + if(p == 8) { + uint32_t px = row_byte_cnt * y + (x >> 3); + buf_u8[px] = b; + b = 0; + p = 0; + } + } } - } - return LV_RES_OK; -} + /*Process the last byte of the row*/ + if(p) { + /*Make the rest of the bits white*/ + b |= (1 << (8 - p)) - 1; -lv_res_t lv_qrcode_update2(lv_obj_t* qrcode, const void* data, uint32_t data_len) -{ - lv_color_t c; - // c.full = 1; + uint32_t px = row_byte_cnt * y + (x >> 3); + buf_u8[px] = b; + } - if(data_len > qrcodegen_BUFFER_LEN_MAX) return LV_RES_INV; - - /* create a working cache and results buffer */ - uint8_t data_tmp[qrcodegen_BUFFER_LEN_MAX]; - uint8_t qr_pixels[qrcodegen_BUFFER_LEN_MAX]; - memcpy(data_tmp, data, data_len); - - /* convert data into pixels */ - bool ok = qrcodegen_encodeBinary(data_tmp, data_len, qr_pixels, qrcodegen_Ecc_MEDIUM, qrcodegen_VERSION_MIN, - qrcodegen_VERSION_MAX, qrcodegen_Mask_AUTO, true); - - if(!ok) return LV_RES_INV; - - // lv_coord_t obj_w = lv_obj_get_width(qrcode); - // int scale = 1; - // int scaled = 0; - // int qr_size = qrcodegen_getSize(qr_pixels); - int margin = 0; - - lv_img_ext_t* ext = (lv_img_ext_t*)lv_obj_get_ext_attr(qrcode); - if(!ext || !ext->src) return LV_RES_INV; - - lv_img_header_t header; - lv_img_decoder_get_info(ext->src, &header); - - lv_img_decoder_dsc_t dec_dsc; - lv_res_t res = lv_img_decoder_open(&dec_dsc, ext->src, LV_COLOR_CYAN); - (void)res; // unused - - for(int y = 0; y < dec_dsc.header.h; y++) { - for(int x = 0; x < dec_dsc.header.w; x++) { - c = qrcodegen_getModule(qr_pixels, x, y) ? LV_COLOR_WHITE : LV_COLOR_BLACK; - lv_img_buf_set_px_color((lv_img_dsc_t*)dec_dsc.src, x + margin, y + margin, c); + /*The Qr is probably scaled so simply to the repeated rows*/ + int s; + const uint8_t* row_ori = buf_u8 + row_byte_cnt * y; + for(s = 1; s < scale; s++) { + memcpy((uint8_t*)buf_u8 + row_byte_cnt * (y + s), row_ori, row_byte_cnt); } } @@ -175,8 +148,8 @@ lv_res_t lv_qrcode_update2(lv_obj_t* qrcode, const void* data, uint32_t data_len void lv_qrcode_delete(lv_obj_t* qrcode) { lv_img_dsc_t* img = lv_canvas_get_img(qrcode); + lv_img_cache_invalidate_src(img); lv_mem_free(img->data); - lv_mem_free(img); lv_obj_del(qrcode); } diff --git a/lib/lv_lib_qrcode/lv_qrcode.h b/lib/lv_lib_qrcode/lv_qrcode.h index 576cd445..74d108ce 100644 --- a/lib/lv_lib_qrcode/lv_qrcode.h +++ b/lib/lv_lib_qrcode/lv_qrcode.h @@ -13,8 +13,11 @@ extern "C" { /********************* * INCLUDES *********************/ +#ifdef LV_LVGL_H_INCLUDE_SIMPLE #include "lvgl.h" - +#else +#include "lvgl/lvgl.h" +#endif /********************* * DEFINES *********************/ @@ -35,7 +38,7 @@ extern "C" { * @param light_color light color of the QR code * @return pointer to the created QR code object */ -lv_obj_t * lv_qrcode_create(lv_obj_t * parent, lv_coord_t size, lv_color_t dark_color, lv_color_t light_color); +lv_obj_t* lv_qrcode_create(lv_obj_t* parent, lv_coord_t size, lv_color_t dark_color, lv_color_t light_color); /** * Set the data of a QR code object @@ -44,13 +47,13 @@ lv_obj_t * lv_qrcode_create(lv_obj_t * parent, lv_coord_t size, lv_color_t dark_ * @param data_len length of data in bytes * @return LV_RES_OK: if no error; LV_RES_INV: on error */ -lv_res_t lv_qrcode_update(lv_obj_t * qrcode, const void * data, uint32_t data_len); +lv_res_t lv_qrcode_update(lv_obj_t* qrcode, const void* data, uint32_t data_len); /** * Delete a QR code object * @param qrcode pointer to a QR code object */ -void lv_qrcode_delete(lv_obj_t * qrcode); +void lv_qrcode_delete(lv_obj_t* qrcode); /********************** * MACROS diff --git a/lib/lv_lib_zifont/lv_zifont.cpp b/lib/lv_lib_zifont/lv_zifont.cpp index 397d6724..210b005f 100644 --- a/lib/lv_lib_zifont/lv_zifont.cpp +++ b/lib/lv_lib_zifont/lv_zifont.cpp @@ -29,7 +29,7 @@ #endif // ARDUINO_ARCH #include "lvgl.h" -#include "lv_misc/lv_debug.h" +//#include "lv_misc/lv_debug.h" #include "lv_zifont.h" #include "ArduinoLog.h" #include "hasp_macro.h" @@ -68,6 +68,7 @@ HASP_ATTRIBUTE_FAST_MEM bool lv_font_get_glyph_dsc_fmt_zifont(const lv_font_t* f uint32_t charInBuffer = 0; // Last Character ID in the Bitmap Buffer // uint8_t filecharBitmap_p[20 * 1024]; lv_zifont_char_t lastCharInfo; // Holds the last Glyph DSC +size_t current_bitmap_size = 0; #if ESP32 // static lv_zifont_char_t charCache[256 - 32]; // glyphID DSC cache @@ -113,10 +114,11 @@ static inline bool openFont(File& file, const char* filename) static inline bool initCharacterFrame(size_t size) { - if(size > _lv_mem_get_size(charBitmap_p)) { + if(size > current_bitmap_size) { lv_mem_free(charBitmap_p); - charBitmap_p = (uint8_t*)lv_mem_alloc(size); - LOG_WARNING(TAG_FONT, F("Pixel buffer is %d bytes"), _lv_mem_get_size(charBitmap_p)); + charBitmap_p = (uint8_t*)lv_mem_alloc(size); + current_bitmap_size = size; + LOG_WARNING(TAG_FONT, F("Pixel buffer is %d bytes"), current_bitmap_size); } if(charBitmap_p != NULL) { diff --git a/lib/lv_lib_zifont/lv_zifont.h b/lib/lv_lib_zifont/lv_zifont.h index 4160fe4e..193127c8 100644 --- a/lib/lv_lib_zifont/lv_zifont.h +++ b/lib/lv_lib_zifont/lv_zifont.h @@ -63,7 +63,7 @@ typedef struct uint8_t Fontdataadd8byte; uint16_t reserved1; // Reserved 1 uint32_t Actualnumchars; - uint32_t * reserved3; // Reserved 3 + uint32_t* reserved3; // Reserved 3 } zi_font_header_t; typedef struct @@ -77,15 +77,15 @@ typedef struct uint32_t Startdataaddress; uint8_t Fontdataadd8byte; uint16_t last_glyph_id; - lv_zifont_char_t * last_glyph_dsc; - lv_zifont_char_t * ascii_glyph_dsc; + lv_zifont_char_t* last_glyph_dsc; + lv_zifont_char_t* ascii_glyph_dsc; } lv_font_fmt_zifont_dsc_t; /********************** * GLOBAL PROTOTYPES **********************/ int lv_zifont_init(void); -int lv_zifont_font_init(lv_font_t ** font, const char * font_path, uint16_t size); +int lv_zifont_font_init(lv_font_t** font, const char* font_path, uint16_t size); /********************** * MACROS diff --git a/platformio.ini b/platformio.ini index 99247404..a769626f 100644 --- a/platformio.ini +++ b/platformio.ini @@ -59,8 +59,8 @@ build_flags = ; -- Hasp build options ---------------------------- -D HASP_VER_MAJ=0 - -D HASP_VER_MIN=6 - -D HASP_VER_REV=1 + -D HASP_VER_MIN=7 + -D HASP_VER_REV=0-dev ; 0 or 0-dev ${override.build_flags} ; -- Shared library dependencies in all environments @@ -74,7 +74,7 @@ lib_deps = ;git+https://github.com/andrethomas/TasmotaSlave.git ;git+https://github.com/lvgl/lvgl.git ;Needed for touch rotation: - git+https://github.com/fvanroie/lvgl.git#release/v7 + git+https://github.com/lvgl/lvgl.git ;git+https://github.com/lvgl/lvgl.git#797212a3f346e9fdf71aef6f193889357eeae3f0 ;git+https://github.com/lvgl/lvgl.git#60ddd13465e4182893d748ae3cc3f69801768e8a ;lvgl/lvgl@^7.11.0 ; from PIO library @@ -136,7 +136,7 @@ build_flags = ;-D HASP_USE_EEPROM=1 -D HASP_USE_CONFIG=1 ; Native application, not library -D LV_LOG_TRACE_TIMER=1 - -D HASP_USE_PNGDECODE=1 + -D HASP_USE_PNGDECODE=0 ; -- LittleFS build options ------------------------ ;-D CONFIG_LITTLEFS_FOR_IDF_3_2 ; obsolete in IDF 3.3 @@ -154,7 +154,7 @@ lib_ignore = lib_deps = ESP Async WebServer LittleFS_esp32 - git+https://github.com/lvgl/lv_lib_png.git#release/v7 + git+https://github.com/lvgl/lv_lib_png.git ps_ram = -DBOARD_HAS_PSRAM diff --git a/src/custom/my_custom_template.cpp b/src/custom/my_custom_template.cpp index fdb5b38b..86284cce 100644 --- a/src/custom/my_custom_template.cpp +++ b/src/custom/my_custom_template.cpp @@ -1,7 +1,7 @@ /* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ -#include "hasplib.h" +//#include "hasplib.h" #if HASP_USE_CUSTOM > 0 && false // <-- set this to true in your code @@ -26,7 +26,7 @@ void custom_every_second() void custom_every_5seconds() { Log.verbose(TAG_CUSTOM, "5 seconds have passsed..."); - dispatch_state_subtopic("my_sensor","{\"test\":123}"); + dispatch_state_subtopic("my_sensor", "{\"test\":123}"); } bool custom_pin_in_use(uint pin) diff --git a/src/drv/old/hasp_drv_touch.cpp b/src/drv/old/hasp_drv_touch.cpp index 540c4e6e..e32b9b81 100644 --- a/src/drv/old/hasp_drv_touch.cpp +++ b/src/drv/old/hasp_drv_touch.cpp @@ -9,7 +9,7 @@ #if TOUCH_DRIVER == 2046 #if defined(USE_FSMC) #else -#include "drv/old/hasp_drv_tft_espi.h" +// #include "drv/old/hasp_drv_tft_espi.h" #endif #elif TOUCH_DRIVER == 2046 @@ -63,7 +63,7 @@ void drv_touch_init(uint8_t rotation) #endif #elif TOUCH_DRIVER == 911 - // GT911_init(); + // GT911_init(); #elif TOUCH_DRIVER == 0xADC // Analog Digital Touch Conroller // Touch_init(); @@ -93,10 +93,10 @@ static inline bool drv_touchpad_getXY(int16_t* touchX, int16_t* touchY) touched = haspTft.tft.getTouch((uint16_t*)&normal_x, (uint16_t*)&normal_y, 300); #elif TOUCH_DRIVER == 0x2046B - touched = XPT2046_getXY(&normal_x, &normal_y, true); + touched = XPT2046_getXY(&normal_x, &normal_y, true); #elif TOUCH_DRIVER == 911 - // touched = GT911_getXY(&normal_x, &normal_y, true); + // touched = GT911_getXY(&normal_x, &normal_y, true); #elif TOUCH_DRIVER == 0xADC // Analog Digital Touch Conroller touched = Touch_getXY(&normal_x, &normal_y, false); @@ -192,13 +192,13 @@ IRAM_ATTR bool drv_touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* dat if(hasp_sleep_state /* != HASP_SLEEP_OFF */) hasp_update_sleep_state(); // update Idle if(touch_invert_x) { - data->point.x = indev_driver->disp->driver.hor_res - touchX; + data->point.x = indev_driver->disp->driver->hor_res - touchX; } else { data->point.x = touchX; } if(touch_invert_y) { - data->point.y = indev_driver->disp->driver.ver_res - touchY; + data->point.y = indev_driver->disp->driver->ver_res - touchY; } else { data->point.y = touchY; } @@ -221,6 +221,6 @@ IRAM_ATTR bool drv_touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* dat IRAM_ATTR void drv_touch_loop() { #if TOUCH_DRIVER == 911 - // GT911_loop(); + // GT911_loop(); #endif } \ No newline at end of file diff --git a/src/drv/touch/touch_driver.h b/src/drv/touch/touch_driver.h index b9081504..ea6d4cec 100644 --- a/src/drv/touch/touch_driver.h +++ b/src/drv/touch/touch_driver.h @@ -25,10 +25,8 @@ class BaseTouch { {} void set_invert(bool invert_display) {} - IRAM_ATTR bool read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) - { - return false; - } + IRAM_ATTR void read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) + {} void calibrate(uint16_t* calData) {} bool is_driver_pin(uint8_t) diff --git a/src/drv/touch/touch_driver_ft6336u.h b/src/drv/touch/touch_driver_ft6336u.h index 5f3fb81d..a07d9dcf 100644 --- a/src/drv/touch/touch_driver_ft6336u.h +++ b/src/drv/touch/touch_driver_ft6336u.h @@ -33,7 +33,7 @@ HASP_ATTRIBUTE_FAST_MEM bool FT6336U_getXY(int16_t* touchX, int16_t* touchY) } } -IRAM_ATTR bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) +IRAM_ATTR void touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) { if(ft6336u_touch->read_touch_number() == 1) { diff --git a/src/drv/touch/touch_driver_gt911.h b/src/drv/touch/touch_driver_gt911.h index 53766060..6e51b82e 100644 --- a/src/drv/touch/touch_driver_gt911.h +++ b/src/drv/touch/touch_driver_gt911.h @@ -37,12 +37,12 @@ IRAM_ATTR void GT911_setXY(int8_t contacts, GTPoint* points) // } } -IRAM_ATTR bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) +IRAM_ATTR void touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) { // LOG_VERBOSE(TAG_GUI, F("Contacts: %d"), GT911_num_touches); static GTPoint points[5]; - if(touch.readInput((uint8_t*)&points)>0) { + if(touch.readInput((uint8_t*)&points) > 0) { if(hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_state(); // update Idle @@ -51,7 +51,7 @@ IRAM_ATTR bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) data->state = LV_INDEV_STATE_PR; } else { - data->state = LV_INDEV_STATE_REL; + data->state = LV_INDEV_STATE_REL; } touch.loop(); // reset IRQ diff --git a/src/drv/touch/touch_driver_stmpe610.h b/src/drv/touch/touch_driver_stmpe610.h index e6e150cf..19802bdd 100644 --- a/src/drv/touch/touch_driver_stmpe610.h +++ b/src/drv/touch/touch_driver_stmpe610.h @@ -25,7 +25,7 @@ extern uint8_t hasp_sleep_state; static Adafruit_STMPE610 stmpe610_touchpanel = Adafruit_STMPE610(TOUCH_CS); -bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) +IRAM_ATTR void touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) { data->state = LV_INDEV_STATE_REL; @@ -33,7 +33,7 @@ bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) while(data->state == LV_INDEV_STATE_REL && stmpe610_touchpanel.touched()) { TS_Point point = stmpe610_touchpanel.getPoint(); - Log.trace(TAG_DRVR, F("STMPE610: x=%i y=%i z=%i"), point.x, point.y, point.z); + // Log.trace(TAG_DRVR, F("STMPE610: x=%i y=%i z=%i"), point.x, point.y, point.z); if(point.z && point.x < 4096 && point.y < 4096) { // valid reading if(hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_state(); // update Idle @@ -48,9 +48,6 @@ bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) #endif } } - - /*Return `false` because we are not buffering and no more data to read*/ - return false; } namespace dev { @@ -58,9 +55,9 @@ namespace dev { class TouchStmpe610 : public BaseTouch { public: - IRAM_ATTR bool read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) + IRAM_ATTR void read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) { - return touch_read(indev_driver, data); + touch_read(indev_driver, data); } void init(int w, int h) diff --git a/src/drv/touch/touch_driver_tftespi.h b/src/drv/touch/touch_driver_tftespi.h index 82ed45ff..d6a95efb 100644 --- a/src/drv/touch/touch_driver_tftespi.h +++ b/src/drv/touch/touch_driver_tftespi.h @@ -14,7 +14,7 @@ #include "../../hasp/hasp.h" // for hasp_sleep_state extern uint8_t hasp_sleep_state; -IRAM_ATTR bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) +IRAM_ATTR void touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) { if(haspTft.tft.getTouch((uint16_t*)&data->point.x, (uint16_t*)&data->point.y, 300)) { if(hasp_sleep_state != HASP_SLEEP_OFF) hasp_update_sleep_state(); // update Idle @@ -23,9 +23,6 @@ IRAM_ATTR bool touch_read(lv_indev_drv_t* indev_driver, lv_indev_data_t* data) } else { data->state = LV_INDEV_STATE_REL; } - - /*Return `false` because we are not buffering and no more data to read*/ - return false; } namespace dev { diff --git a/src/font/ascii/robotocondensed_regular_12_ascii.cpp b/src/font/ascii/robotocondensed_regular_12_ascii.cpp index d5a35840..7b5fa018 100644 --- a/src/font/ascii/robotocondensed_regular_12_ascii.cpp +++ b/src/font/ascii/robotocondensed_regular_12_ascii.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 12 px * Bpp: 3 diff --git a/src/font/ascii/robotocondensed_regular_14_ascii.cpp b/src/font/ascii/robotocondensed_regular_14_ascii.cpp index e2382a67..48cd8c19 100644 --- a/src/font/ascii/robotocondensed_regular_14_ascii.cpp +++ b/src/font/ascii/robotocondensed_regular_14_ascii.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 14 px * Bpp: 3 @@ -1839,7 +1840,7 @@ lv_font_t robotocondensed_regular_14_ascii = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -1, .underline_thickness = 1, #endif diff --git a/src/font/ascii/robotocondensed_regular_16_ascii.cpp b/src/font/ascii/robotocondensed_regular_16_ascii.cpp index c09e9978..6c707f51 100644 --- a/src/font/ascii/robotocondensed_regular_16_ascii.cpp +++ b/src/font/ascii/robotocondensed_regular_16_ascii.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 16 px * Bpp: 3 diff --git a/src/font/ascii/robotocondensed_regular_20_ascii.cpp b/src/font/ascii/robotocondensed_regular_20_ascii.cpp index 120b565b..e08e8da4 100644 --- a/src/font/ascii/robotocondensed_regular_20_ascii.cpp +++ b/src/font/ascii/robotocondensed_regular_20_ascii.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 20 px * Bpp: 3 @@ -2421,7 +2422,7 @@ lv_font_t robotocondensed_regular_20_ascii = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -1, .underline_thickness = 1, #endif diff --git a/src/font/ascii/robotocondensed_regular_22_ascii.cpp b/src/font/ascii/robotocondensed_regular_22_ascii.cpp index 4ad6e525..2c252000 100644 --- a/src/font/ascii/robotocondensed_regular_22_ascii.cpp +++ b/src/font/ascii/robotocondensed_regular_22_ascii.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 22 px * Bpp: 3 diff --git a/src/font/ascii/robotocondensed_regular_24_ascii.cpp b/src/font/ascii/robotocondensed_regular_24_ascii.cpp index 31151f1a..384d179e 100644 --- a/src/font/ascii/robotocondensed_regular_24_ascii.cpp +++ b/src/font/ascii/robotocondensed_regular_24_ascii.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 24 px * Bpp: 3 @@ -2745,7 +2746,7 @@ lv_font_t robotocondensed_regular_24_ascii = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 1, #endif diff --git a/src/font/ascii/robotocondensed_regular_26_ascii.cpp b/src/font/ascii/robotocondensed_regular_26_ascii.cpp index c9722094..f49837be 100644 --- a/src/font/ascii/robotocondensed_regular_26_ascii.cpp +++ b/src/font/ascii/robotocondensed_regular_26_ascii.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 26 px * Bpp: 3 diff --git a/src/font/ascii/robotocondensed_regular_28_ascii.cpp b/src/font/ascii/robotocondensed_regular_28_ascii.cpp index 364f6f9e..d08265b8 100644 --- a/src/font/ascii/robotocondensed_regular_28_ascii.cpp +++ b/src/font/ascii/robotocondensed_regular_28_ascii.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 28 px * Bpp: 3 @@ -3366,7 +3367,7 @@ lv_font_t robotocondensed_regular_28_ascii = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 1, #endif diff --git a/src/font/ascii/robotocondensed_regular_32_ascii.cpp b/src/font/ascii/robotocondensed_regular_32_ascii.cpp index b754e4b9..a04a9812 100644 --- a/src/font/ascii/robotocondensed_regular_32_ascii.cpp +++ b/src/font/ascii/robotocondensed_regular_32_ascii.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 32 px * Bpp: 3 diff --git a/src/font/ascii/robotocondensed_regular_36_ascii.cpp b/src/font/ascii/robotocondensed_regular_36_ascii.cpp index b59a7d20..a3df64ab 100644 --- a/src/font/ascii/robotocondensed_regular_36_ascii.cpp +++ b/src/font/ascii/robotocondensed_regular_36_ascii.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 36 px * Bpp: 3 @@ -4416,7 +4417,7 @@ lv_font_t robotocondensed_regular_36_ascii = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/ascii/robotocondensed_regular_38_ascii.cpp b/src/font/ascii/robotocondensed_regular_38_ascii.cpp index dd24d354..5873b4fe 100644 --- a/src/font/ascii/robotocondensed_regular_38_ascii.cpp +++ b/src/font/ascii/robotocondensed_regular_38_ascii.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 38 px * Bpp: 3 diff --git a/src/font/ascii/robotocondensed_regular_40_ascii.cpp b/src/font/ascii/robotocondensed_regular_40_ascii.cpp index 1ca02af5..542613a0 100644 --- a/src/font/ascii/robotocondensed_regular_40_ascii.cpp +++ b/src/font/ascii/robotocondensed_regular_40_ascii.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 40 px * Bpp: 3 @@ -4942,7 +4943,7 @@ lv_font_t robotocondensed_regular_40_ascii = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/ascii/robotocondensed_regular_44_ascii.cpp b/src/font/ascii/robotocondensed_regular_44_ascii.cpp index bcae9d7f..b306ddab 100644 --- a/src/font/ascii/robotocondensed_regular_44_ascii.cpp +++ b/src/font/ascii/robotocondensed_regular_44_ascii.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 44 px * Bpp: 3 @@ -5465,7 +5466,7 @@ lv_font_t robotocondensed_regular_44_ascii = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/ascii/robotocondensed_regular_48_ascii.cpp b/src/font/ascii/robotocondensed_regular_48_ascii.cpp index 44c1ea9e..09dd69e0 100644 --- a/src/font/ascii/robotocondensed_regular_48_ascii.cpp +++ b/src/font/ascii/robotocondensed_regular_48_ascii.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 48 px * Bpp: 3 @@ -5791,7 +5792,7 @@ lv_font_t robotocondensed_regular_48_ascii = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -4, .underline_thickness = 2, #endif diff --git a/src/font/cyrillic/robotocondensed_regular_12_cyrillic.cpp b/src/font/cyrillic/robotocondensed_regular_12_cyrillic.cpp index 8bcf8fc6..67636afb 100644 --- a/src/font/cyrillic/robotocondensed_regular_12_cyrillic.cpp +++ b/src/font/cyrillic/robotocondensed_regular_12_cyrillic.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 12 px * Bpp: 3 @@ -2202,7 +2203,7 @@ lv_font_t robotocondensed_regular_12_cyrillic = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -1, .underline_thickness = 1, #endif diff --git a/src/font/cyrillic/robotocondensed_regular_14_cyrillic.cpp b/src/font/cyrillic/robotocondensed_regular_14_cyrillic.cpp index def95713..2f2347c7 100644 --- a/src/font/cyrillic/robotocondensed_regular_14_cyrillic.cpp +++ b/src/font/cyrillic/robotocondensed_regular_14_cyrillic.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 14 px * Bpp: 3 @@ -2462,7 +2463,7 @@ lv_font_t robotocondensed_regular_14_cyrillic = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -1, .underline_thickness = 1, #endif diff --git a/src/font/cyrillic/robotocondensed_regular_16_cyrillic.cpp b/src/font/cyrillic/robotocondensed_regular_16_cyrillic.cpp index 7783e98a..da1c9020 100644 --- a/src/font/cyrillic/robotocondensed_regular_16_cyrillic.cpp +++ b/src/font/cyrillic/robotocondensed_regular_16_cyrillic.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 16 px * Bpp: 3 @@ -2675,7 +2676,7 @@ lv_font_t robotocondensed_regular_16_cyrillic = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -1, .underline_thickness = 1, #endif diff --git a/src/font/cyrillic/robotocondensed_regular_20_cyrillic.cpp b/src/font/cyrillic/robotocondensed_regular_20_cyrillic.cpp index a8fe2e7f..ef6c8a92 100644 --- a/src/font/cyrillic/robotocondensed_regular_20_cyrillic.cpp +++ b/src/font/cyrillic/robotocondensed_regular_20_cyrillic.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 20 px * Bpp: 3 @@ -3213,7 +3214,7 @@ lv_font_t robotocondensed_regular_20_cyrillic = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -1, .underline_thickness = 1, #endif diff --git a/src/font/cyrillic/robotocondensed_regular_22_cyrillic.cpp b/src/font/cyrillic/robotocondensed_regular_22_cyrillic.cpp index 7e543a93..240d387c 100644 --- a/src/font/cyrillic/robotocondensed_regular_22_cyrillic.cpp +++ b/src/font/cyrillic/robotocondensed_regular_22_cyrillic.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 22 px * Bpp: 3 @@ -3507,7 +3508,7 @@ lv_font_t robotocondensed_regular_22_cyrillic = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 1, #endif diff --git a/src/font/cyrillic/robotocondensed_regular_24_cyrillic.cpp b/src/font/cyrillic/robotocondensed_regular_24_cyrillic.cpp index 96f69d6e..f759dcda 100644 --- a/src/font/cyrillic/robotocondensed_regular_24_cyrillic.cpp +++ b/src/font/cyrillic/robotocondensed_regular_24_cyrillic.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 24 px * Bpp: 3 @@ -3639,7 +3640,7 @@ lv_font_t robotocondensed_regular_24_cyrillic = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 1, #endif diff --git a/src/font/cyrillic/robotocondensed_regular_26_cyrillic.cpp b/src/font/cyrillic/robotocondensed_regular_26_cyrillic.cpp index 712ace84..9090d567 100644 --- a/src/font/cyrillic/robotocondensed_regular_26_cyrillic.cpp +++ b/src/font/cyrillic/robotocondensed_regular_26_cyrillic.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 26 px * Bpp: 3 @@ -4068,7 +4069,7 @@ lv_font_t robotocondensed_regular_26_cyrillic = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 1, #endif diff --git a/src/font/cyrillic/robotocondensed_regular_28_cyrillic.cpp b/src/font/cyrillic/robotocondensed_regular_28_cyrillic.cpp index 3ae7e13d..cb8d4def 100644 --- a/src/font/cyrillic/robotocondensed_regular_28_cyrillic.cpp +++ b/src/font/cyrillic/robotocondensed_regular_28_cyrillic.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 28 px * Bpp: 3 @@ -4418,7 +4419,7 @@ lv_font_t robotocondensed_regular_28_cyrillic = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 1, #endif diff --git a/src/font/cyrillic/robotocondensed_regular_32_cyrillic.cpp b/src/font/cyrillic/robotocondensed_regular_32_cyrillic.cpp index a4e9b6b6..eef62833 100644 --- a/src/font/cyrillic/robotocondensed_regular_32_cyrillic.cpp +++ b/src/font/cyrillic/robotocondensed_regular_32_cyrillic.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 32 px * Bpp: 3 @@ -5046,7 +5047,7 @@ lv_font_t robotocondensed_regular_32_cyrillic = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 2, #endif diff --git a/src/font/cyrillic/robotocondensed_regular_36_cyrillic.cpp b/src/font/cyrillic/robotocondensed_regular_36_cyrillic.cpp index 149c2bfd..4f3cb6fa 100644 --- a/src/font/cyrillic/robotocondensed_regular_36_cyrillic.cpp +++ b/src/font/cyrillic/robotocondensed_regular_36_cyrillic.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 36 px * Bpp: 3 @@ -5822,7 +5823,7 @@ lv_font_t robotocondensed_regular_36_cyrillic = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/cyrillic/robotocondensed_regular_38_cyrillic.cpp b/src/font/cyrillic/robotocondensed_regular_38_cyrillic.cpp index ce665d7c..a976382f 100644 --- a/src/font/cyrillic/robotocondensed_regular_38_cyrillic.cpp +++ b/src/font/cyrillic/robotocondensed_regular_38_cyrillic.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 38 px * Bpp: 3 @@ -6159,7 +6160,7 @@ lv_font_t robotocondensed_regular_38_cyrillic = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/cyrillic/robotocondensed_regular_40_cyrillic.cpp b/src/font/cyrillic/robotocondensed_regular_40_cyrillic.cpp index 42cfcf6b..2fbdbf6c 100644 --- a/src/font/cyrillic/robotocondensed_regular_40_cyrillic.cpp +++ b/src/font/cyrillic/robotocondensed_regular_40_cyrillic.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 40 px * Bpp: 3 @@ -6514,7 +6515,7 @@ lv_font_t robotocondensed_regular_40_cyrillic = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/cyrillic/robotocondensed_regular_44_cyrillic.cpp b/src/font/cyrillic/robotocondensed_regular_44_cyrillic.cpp index c8723601..6cc48ecd 100644 --- a/src/font/cyrillic/robotocondensed_regular_44_cyrillic.cpp +++ b/src/font/cyrillic/robotocondensed_regular_44_cyrillic.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 44 px * Bpp: 3 @@ -7216,7 +7217,7 @@ lv_font_t robotocondensed_regular_44_cyrillic = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/cyrillic/robotocondensed_regular_48_cyrillic.cpp b/src/font/cyrillic/robotocondensed_regular_48_cyrillic.cpp index 3701021b..a169bfb5 100644 --- a/src/font/cyrillic/robotocondensed_regular_48_cyrillic.cpp +++ b/src/font/cyrillic/robotocondensed_regular_48_cyrillic.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 48 px * Bpp: 3 @@ -7701,7 +7702,7 @@ lv_font_t robotocondensed_regular_48_cyrillic = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -4, .underline_thickness = 2, #endif diff --git a/src/font/greek/robotocondensed_regular_12_greek.cpp b/src/font/greek/robotocondensed_regular_12_greek.cpp index 59480e26..b9df94b7 100644 --- a/src/font/greek/robotocondensed_regular_12_greek.cpp +++ b/src/font/greek/robotocondensed_regular_12_greek.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 12 px * Bpp: 3 @@ -2058,7 +2059,7 @@ lv_font_t robotocondensed_regular_12_greek = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -1, .underline_thickness = 1, #endif diff --git a/src/font/greek/robotocondensed_regular_14_greek.cpp b/src/font/greek/robotocondensed_regular_14_greek.cpp index 4fd9276d..ebdadbd1 100644 --- a/src/font/greek/robotocondensed_regular_14_greek.cpp +++ b/src/font/greek/robotocondensed_regular_14_greek.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 14 px * Bpp: 3 @@ -2310,7 +2311,7 @@ lv_font_t robotocondensed_regular_14_greek = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -1, .underline_thickness = 1, #endif diff --git a/src/font/greek/robotocondensed_regular_16_greek.cpp b/src/font/greek/robotocondensed_regular_16_greek.cpp index 9cf44a89..de741ed5 100644 --- a/src/font/greek/robotocondensed_regular_16_greek.cpp +++ b/src/font/greek/robotocondensed_regular_16_greek.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 16 px * Bpp: 3 @@ -2506,7 +2507,7 @@ lv_font_t robotocondensed_regular_16_greek = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -1, .underline_thickness = 1, #endif diff --git a/src/font/greek/robotocondensed_regular_20_greek.cpp b/src/font/greek/robotocondensed_regular_20_greek.cpp index e6d8416b..01113cfa 100644 --- a/src/font/greek/robotocondensed_regular_20_greek.cpp +++ b/src/font/greek/robotocondensed_regular_20_greek.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 20 px * Bpp: 3 @@ -3018,7 +3019,7 @@ lv_font_t robotocondensed_regular_20_greek = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -1, .underline_thickness = 1, #endif diff --git a/src/font/greek/robotocondensed_regular_22_greek.cpp b/src/font/greek/robotocondensed_regular_22_greek.cpp index 0528664e..d525de78 100644 --- a/src/font/greek/robotocondensed_regular_22_greek.cpp +++ b/src/font/greek/robotocondensed_regular_22_greek.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 22 px * Bpp: 3 @@ -3299,7 +3300,7 @@ lv_font_t robotocondensed_regular_22_greek = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 1, #endif diff --git a/src/font/greek/robotocondensed_regular_24_greek.cpp b/src/font/greek/robotocondensed_regular_24_greek.cpp index b494a4c4..a843e471 100644 --- a/src/font/greek/robotocondensed_regular_24_greek.cpp +++ b/src/font/greek/robotocondensed_regular_24_greek.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 24 px * Bpp: 3 @@ -3442,7 +3443,7 @@ lv_font_t robotocondensed_regular_24_greek = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 1, #endif diff --git a/src/font/greek/robotocondensed_regular_26_greek.cpp b/src/font/greek/robotocondensed_regular_26_greek.cpp index 3f3e5d76..c93b8818 100644 --- a/src/font/greek/robotocondensed_regular_26_greek.cpp +++ b/src/font/greek/robotocondensed_regular_26_greek.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 26 px * Bpp: 3 @@ -3854,7 +3855,7 @@ lv_font_t robotocondensed_regular_26_greek = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 1, #endif diff --git a/src/font/greek/robotocondensed_regular_28_greek.cpp b/src/font/greek/robotocondensed_regular_28_greek.cpp index 6c29fbce..260b72e9 100644 --- a/src/font/greek/robotocondensed_regular_28_greek.cpp +++ b/src/font/greek/robotocondensed_regular_28_greek.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 28 px * Bpp: 3 @@ -4186,7 +4187,7 @@ lv_font_t robotocondensed_regular_28_greek = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 1, #endif diff --git a/src/font/greek/robotocondensed_regular_32_greek.cpp b/src/font/greek/robotocondensed_regular_32_greek.cpp index f7fc0dd5..e81f569b 100644 --- a/src/font/greek/robotocondensed_regular_32_greek.cpp +++ b/src/font/greek/robotocondensed_regular_32_greek.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 32 px * Bpp: 3 @@ -4789,7 +4790,7 @@ lv_font_t robotocondensed_regular_32_greek = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 2, #endif diff --git a/src/font/greek/robotocondensed_regular_36_greek.cpp b/src/font/greek/robotocondensed_regular_36_greek.cpp index 8ab746f6..0d92fcd8 100644 --- a/src/font/greek/robotocondensed_regular_36_greek.cpp +++ b/src/font/greek/robotocondensed_regular_36_greek.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 36 px * Bpp: 3 @@ -5536,7 +5537,7 @@ lv_font_t robotocondensed_regular_36_greek = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/greek/robotocondensed_regular_38_greek.cpp b/src/font/greek/robotocondensed_regular_38_greek.cpp index 012651cc..dc3cf3fc 100644 --- a/src/font/greek/robotocondensed_regular_38_greek.cpp +++ b/src/font/greek/robotocondensed_regular_38_greek.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 38 px * Bpp: 3 @@ -5868,7 +5869,7 @@ lv_font_t robotocondensed_regular_38_greek = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/greek/robotocondensed_regular_40_greek.cpp b/src/font/greek/robotocondensed_regular_40_greek.cpp index 58ff231e..1d430358 100644 --- a/src/font/greek/robotocondensed_regular_40_greek.cpp +++ b/src/font/greek/robotocondensed_regular_40_greek.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 40 px * Bpp: 3 @@ -6203,7 +6204,7 @@ lv_font_t robotocondensed_regular_40_greek = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/greek/robotocondensed_regular_44_greek.cpp b/src/font/greek/robotocondensed_regular_44_greek.cpp index 2e77b8e6..1fb15c7a 100644 --- a/src/font/greek/robotocondensed_regular_44_greek.cpp +++ b/src/font/greek/robotocondensed_regular_44_greek.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 44 px * Bpp: 3 @@ -6867,7 +6868,7 @@ lv_font_t robotocondensed_regular_44_greek = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/greek/robotocondensed_regular_48_greek.cpp b/src/font/greek/robotocondensed_regular_48_greek.cpp index 574fedeb..5091136f 100644 --- a/src/font/greek/robotocondensed_regular_48_greek.cpp +++ b/src/font/greek/robotocondensed_regular_48_greek.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 48 px * Bpp: 3 @@ -7331,7 +7332,7 @@ lv_font_t robotocondensed_regular_48_greek = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -4, .underline_thickness = 2, #endif diff --git a/src/font/hasp_font_loader.cpp b/src/font/hasp_font_loader.cpp index b1977894..8fdea3da 100644 --- a/src/font/hasp_font_loader.cpp +++ b/src/font/hasp_font_loader.cpp @@ -11,7 +11,11 @@ #include #include "lvgl.h" +#if LV_VERSION_CHECK(8, 0, 0) +#include "misc/lv_fs.h" +#else #include "lv_misc/lv_fs.h" +#endif #include "hasp_font_loader.h" #include "hasplib.h" diff --git a/src/font/latin1/robotocondensed_regular_12_latin1.cpp b/src/font/latin1/robotocondensed_regular_12_latin1.cpp index b9b8dae1..5d5ba94d 100644 --- a/src/font/latin1/robotocondensed_regular_12_latin1.cpp +++ b/src/font/latin1/robotocondensed_regular_12_latin1.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 12 px * Bpp: 3 @@ -2123,7 +2124,7 @@ lv_font_t robotocondensed_regular_12_latin1 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -1, .underline_thickness = 1, #endif diff --git a/src/font/latin1/robotocondensed_regular_14_latin1.cpp b/src/font/latin1/robotocondensed_regular_14_latin1.cpp index 194954f8..e80b31fa 100644 --- a/src/font/latin1/robotocondensed_regular_14_latin1.cpp +++ b/src/font/latin1/robotocondensed_regular_14_latin1.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 14 px * Bpp: 3 @@ -2374,7 +2375,7 @@ lv_font_t robotocondensed_regular_14_latin1 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -1, .underline_thickness = 1, #endif diff --git a/src/font/latin1/robotocondensed_regular_16_latin1.cpp b/src/font/latin1/robotocondensed_regular_16_latin1.cpp index 56666d4a..8a7b1ea8 100644 --- a/src/font/latin1/robotocondensed_regular_16_latin1.cpp +++ b/src/font/latin1/robotocondensed_regular_16_latin1.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 16 px * Bpp: 3 @@ -2575,7 +2576,7 @@ lv_font_t robotocondensed_regular_16_latin1 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -1, .underline_thickness = 1, #endif diff --git a/src/font/latin1/robotocondensed_regular_20_latin1.cpp b/src/font/latin1/robotocondensed_regular_20_latin1.cpp index 6198d044..42812e62 100644 --- a/src/font/latin1/robotocondensed_regular_20_latin1.cpp +++ b/src/font/latin1/robotocondensed_regular_20_latin1.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 20 px * Bpp: 3 diff --git a/src/font/latin1/robotocondensed_regular_22_latin1.cpp b/src/font/latin1/robotocondensed_regular_22_latin1.cpp index 1ec74432..3888fb6d 100644 --- a/src/font/latin1/robotocondensed_regular_22_latin1.cpp +++ b/src/font/latin1/robotocondensed_regular_22_latin1.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 22 px * Bpp: 3 @@ -3410,7 +3411,7 @@ lv_font_t robotocondensed_regular_22_latin1 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 1, #endif diff --git a/src/font/latin1/robotocondensed_regular_24_latin1.cpp b/src/font/latin1/robotocondensed_regular_24_latin1.cpp index 70b8e27d..7061bf2e 100644 --- a/src/font/latin1/robotocondensed_regular_24_latin1.cpp +++ b/src/font/latin1/robotocondensed_regular_24_latin1.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 24 px * Bpp: 3 @@ -3566,7 +3567,7 @@ lv_font_t robotocondensed_regular_24_latin1 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 1, #endif diff --git a/src/font/latin1/robotocondensed_regular_26_latin1.cpp b/src/font/latin1/robotocondensed_regular_26_latin1.cpp index 83dd586a..62e8d2bb 100644 --- a/src/font/latin1/robotocondensed_regular_26_latin1.cpp +++ b/src/font/latin1/robotocondensed_regular_26_latin1.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 26 px * Bpp: 3 @@ -3991,11 +3992,12 @@ lv_font_t robotocondensed_regular_26_latin1 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 1, #endif - .dsc = &font_dsc /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ + .dsc = &font_dsc, /*The custom font data. Will be accessed by `get_glyph_bitmap/dsc` */ + .user_data = NULL }; diff --git a/src/font/latin1/robotocondensed_regular_28_latin1.cpp b/src/font/latin1/robotocondensed_regular_28_latin1.cpp index 63bd194c..a2de2cd2 100644 --- a/src/font/latin1/robotocondensed_regular_28_latin1.cpp +++ b/src/font/latin1/robotocondensed_regular_28_latin1.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 28 px * Bpp: 3 @@ -4348,7 +4349,7 @@ lv_font_t robotocondensed_regular_28_latin1 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 1, #endif diff --git a/src/font/latin1/robotocondensed_regular_32_latin1.cpp b/src/font/latin1/robotocondensed_regular_32_latin1.cpp index 0e02875c..665e017f 100644 --- a/src/font/latin1/robotocondensed_regular_32_latin1.cpp +++ b/src/font/latin1/robotocondensed_regular_32_latin1.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 32 px * Bpp: 3 @@ -4969,7 +4970,7 @@ lv_font_t robotocondensed_regular_32_latin1 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 2, #endif diff --git a/src/font/latin1/robotocondensed_regular_36_latin1.cpp b/src/font/latin1/robotocondensed_regular_36_latin1.cpp index 80bdaf56..40d68695 100644 --- a/src/font/latin1/robotocondensed_regular_36_latin1.cpp +++ b/src/font/latin1/robotocondensed_regular_36_latin1.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 36 px * Bpp: 3 @@ -5753,7 +5754,7 @@ lv_font_t robotocondensed_regular_36_latin1 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/latin1/robotocondensed_regular_38_latin1.cpp b/src/font/latin1/robotocondensed_regular_38_latin1.cpp index 5f0aadd5..263be15c 100644 --- a/src/font/latin1/robotocondensed_regular_38_latin1.cpp +++ b/src/font/latin1/robotocondensed_regular_38_latin1.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 38 px * Bpp: 3 @@ -6098,7 +6099,7 @@ lv_font_t robotocondensed_regular_38_latin1 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/latin1/robotocondensed_regular_40_latin1.cpp b/src/font/latin1/robotocondensed_regular_40_latin1.cpp index 6babc76e..2280f3c1 100644 --- a/src/font/latin1/robotocondensed_regular_40_latin1.cpp +++ b/src/font/latin1/robotocondensed_regular_40_latin1.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 40 px * Bpp: 3 @@ -6461,7 +6462,7 @@ lv_font_t robotocondensed_regular_40_latin1 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/latin1/robotocondensed_regular_44_latin1.cpp b/src/font/latin1/robotocondensed_regular_44_latin1.cpp index 58148454..c6bbf441 100644 --- a/src/font/latin1/robotocondensed_regular_44_latin1.cpp +++ b/src/font/latin1/robotocondensed_regular_44_latin1.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 44 px * Bpp: 3 @@ -7153,7 +7154,7 @@ lv_font_t robotocondensed_regular_44_latin1 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/latin1/robotocondensed_regular_48_latin1.cpp b/src/font/latin1/robotocondensed_regular_48_latin1.cpp index 1f33d5fb..1ebaa068 100644 --- a/src/font/latin1/robotocondensed_regular_48_latin1.cpp +++ b/src/font/latin1/robotocondensed_regular_48_latin1.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 48 px * Bpp: 3 @@ -7652,7 +7653,7 @@ lv_font_t robotocondensed_regular_48_latin1 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -4, .underline_thickness = 2, #endif diff --git a/src/font/latin2/robotocondensed_regular_12_latin2.cpp b/src/font/latin2/robotocondensed_regular_12_latin2.cpp index 8f4a6da8..1c46f395 100644 --- a/src/font/latin2/robotocondensed_regular_12_latin2.cpp +++ b/src/font/latin2/robotocondensed_regular_12_latin2.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 12 px * Bpp: 3 @@ -2321,7 +2322,7 @@ lv_font_t robotocondensed_regular_12_latin2 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -1, .underline_thickness = 1, #endif diff --git a/src/font/latin2/robotocondensed_regular_14_latin2.cpp b/src/font/latin2/robotocondensed_regular_14_latin2.cpp index 3b547e71..99b21045 100644 --- a/src/font/latin2/robotocondensed_regular_14_latin2.cpp +++ b/src/font/latin2/robotocondensed_regular_14_latin2.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 14 px * Bpp: 3 @@ -2590,7 +2591,7 @@ lv_font_t robotocondensed_regular_14_latin2 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -1, .underline_thickness = 1, #endif diff --git a/src/font/latin2/robotocondensed_regular_16_latin2.cpp b/src/font/latin2/robotocondensed_regular_16_latin2.cpp index 43dbf47b..b883e1a0 100644 --- a/src/font/latin2/robotocondensed_regular_16_latin2.cpp +++ b/src/font/latin2/robotocondensed_regular_16_latin2.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 16 px * Bpp: 3 @@ -2792,7 +2793,7 @@ lv_font_t robotocondensed_regular_16_latin2 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -1, .underline_thickness = 1, #endif diff --git a/src/font/latin2/robotocondensed_regular_20_latin2.cpp b/src/font/latin2/robotocondensed_regular_20_latin2.cpp index 9825d26c..8d91d729 100644 --- a/src/font/latin2/robotocondensed_regular_20_latin2.cpp +++ b/src/font/latin2/robotocondensed_regular_20_latin2.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 20 px * Bpp: 3 @@ -3388,7 +3389,7 @@ lv_font_t robotocondensed_regular_20_latin2 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -1, .underline_thickness = 1, #endif diff --git a/src/font/latin2/robotocondensed_regular_22_latin2.cpp b/src/font/latin2/robotocondensed_regular_22_latin2.cpp index e53fc5bb..f0b3c9bd 100644 --- a/src/font/latin2/robotocondensed_regular_22_latin2.cpp +++ b/src/font/latin2/robotocondensed_regular_22_latin2.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 22 px * Bpp: 3 @@ -3689,7 +3690,7 @@ lv_font_t robotocondensed_regular_22_latin2 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 1, #endif diff --git a/src/font/latin2/robotocondensed_regular_24_latin2.cpp b/src/font/latin2/robotocondensed_regular_24_latin2.cpp index 2fde934a..1b859e3e 100644 --- a/src/font/latin2/robotocondensed_regular_24_latin2.cpp +++ b/src/font/latin2/robotocondensed_regular_24_latin2.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 24 px * Bpp: 3 @@ -3879,7 +3880,7 @@ lv_font_t robotocondensed_regular_24_latin2 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 1, #endif diff --git a/src/font/latin2/robotocondensed_regular_26_latin2.cpp b/src/font/latin2/robotocondensed_regular_26_latin2.cpp index de80b879..bebb3ba2 100644 --- a/src/font/latin2/robotocondensed_regular_26_latin2.cpp +++ b/src/font/latin2/robotocondensed_regular_26_latin2.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 26 px * Bpp: 3 @@ -4322,7 +4323,7 @@ lv_font_t robotocondensed_regular_26_latin2 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 1, #endif diff --git a/src/font/latin2/robotocondensed_regular_28_latin2.cpp b/src/font/latin2/robotocondensed_regular_28_latin2.cpp index ca079681..b926683c 100644 --- a/src/font/latin2/robotocondensed_regular_28_latin2.cpp +++ b/src/font/latin2/robotocondensed_regular_28_latin2.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 28 px * Bpp: 3 @@ -4710,7 +4711,7 @@ lv_font_t robotocondensed_regular_28_latin2 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 1, #endif diff --git a/src/font/latin2/robotocondensed_regular_32_latin2.cpp b/src/font/latin2/robotocondensed_regular_32_latin2.cpp index 0891da80..9cda1aad 100644 --- a/src/font/latin2/robotocondensed_regular_32_latin2.cpp +++ b/src/font/latin2/robotocondensed_regular_32_latin2.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 32 px * Bpp: 3 @@ -5391,7 +5392,7 @@ lv_font_t robotocondensed_regular_32_latin2 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -2, .underline_thickness = 2, #endif diff --git a/src/font/latin2/robotocondensed_regular_36_latin2.cpp b/src/font/latin2/robotocondensed_regular_36_latin2.cpp index 135b527a..9b9171f0 100644 --- a/src/font/latin2/robotocondensed_regular_36_latin2.cpp +++ b/src/font/latin2/robotocondensed_regular_36_latin2.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 36 px * Bpp: 3 @@ -6252,7 +6253,7 @@ lv_font_t robotocondensed_regular_36_latin2 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/latin2/robotocondensed_regular_38_latin2.cpp b/src/font/latin2/robotocondensed_regular_38_latin2.cpp index 6fb0f9dd..2cd10be4 100644 --- a/src/font/latin2/robotocondensed_regular_38_latin2.cpp +++ b/src/font/latin2/robotocondensed_regular_38_latin2.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 38 px * Bpp: 3 @@ -6622,7 +6623,7 @@ lv_font_t robotocondensed_regular_38_latin2 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/latin2/robotocondensed_regular_40_latin2.cpp b/src/font/latin2/robotocondensed_regular_40_latin2.cpp index 5a06401a..2f25e59c 100644 --- a/src/font/latin2/robotocondensed_regular_40_latin2.cpp +++ b/src/font/latin2/robotocondensed_regular_40_latin2.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 40 px * Bpp: 3 @@ -7016,7 +7017,7 @@ lv_font_t robotocondensed_regular_40_latin2 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/latin2/robotocondensed_regular_44_latin2.cpp b/src/font/latin2/robotocondensed_regular_44_latin2.cpp index 93a762dd..a118552b 100644 --- a/src/font/latin2/robotocondensed_regular_44_latin2.cpp +++ b/src/font/latin2/robotocondensed_regular_44_latin2.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 44 px * Bpp: 3 @@ -7754,7 +7755,7 @@ lv_font_t robotocondensed_regular_44_latin2 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -3, .underline_thickness = 2, #endif diff --git a/src/font/latin2/robotocondensed_regular_48_latin2.cpp b/src/font/latin2/robotocondensed_regular_48_latin2.cpp index 72399e1a..d96b5762 100644 --- a/src/font/latin2/robotocondensed_regular_48_latin2.cpp +++ b/src/font/latin2/robotocondensed_regular_48_latin2.cpp @@ -1,4 +1,5 @@ /* clang-format off */ +/* clang-format off */ /******************************************************************************* * Size: 48 px * Bpp: 3 @@ -8315,7 +8316,7 @@ lv_font_t robotocondensed_regular_48_latin2 = { #if !(LVGL_VERSION_MAJOR == 6 && LVGL_VERSION_MINOR == 0) .subpx = LV_FONT_SUBPX_NONE, #endif -#if LV_VERSION_CHECK(7, 4, 0) +#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0) .underline_position = -4, .underline_thickness = 2, #endif diff --git a/src/hasp/hasp.cpp b/src/hasp/hasp.cpp index dacb4198..025027a2 100644 --- a/src/hasp/hasp.cpp +++ b/src/hasp/hasp.cpp @@ -85,13 +85,13 @@ lv_style_t style_mbox_bg; /*Black bg. style with opacity*/ lv_obj_t* kb; // lv_font_t * defaultFont; -static lv_font_t* haspFonts[12] = {nullptr}; -uint8_t current_page = 1; +static const lv_font_t* haspFonts[12] = {nullptr}; +uint8_t current_page = 1; /** * Get Font ID */ -lv_font_t* hasp_get_font(uint8_t fontid) +const lv_font_t* hasp_get_font(uint8_t fontid) { if(fontid >= sizeof(haspFonts) / sizeof(haspFonts[0])) { return nullptr; @@ -230,16 +230,18 @@ void haspReconnect() // Shows/hides the the global progress bar and updates the value void haspProgressVal(uint8_t val) { + return; + lv_obj_t* layer = lv_disp_get_layer_sys(NULL); lv_obj_t* bar = hasp_find_obj_from_page_id(255U, 10U); if(layer && bar) { if(val == 255) { if(!lv_obj_get_hidden(bar)) { lv_obj_set_hidden(bar, true); - lv_obj_set_style_local_bg_opa(layer, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_0); + lv_obj_set_style_bg_opa(layer, LV_PART_MAIN | LV_STATE_DEFAULT, LV_OPA_0); - // lv_obj_set_style_local_value_str(bar, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, ""); - // lv_obj_set_value_str_txt(bar, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, NULL); + // lv_obj_set_style_value_str(bar, LV_PART_MAIN| LV_STATE_DEFAULT, ""); + // lv_obj_set_value_str_txt(bar, LV_PART_MAIN| LV_STATE_DEFAULT, NULL); // TODO: call our custom function to free the memory #if defined(ARDUINO_ARCH_ESP32) || defined(ARDUINO_ARCH_ESP8266) @@ -249,7 +251,7 @@ void haspProgressVal(uint8_t val) } else { if(lv_obj_get_hidden(bar)) { lv_obj_set_hidden(bar, false); - lv_obj_set_style_local_bg_opa(layer, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_100); + lv_obj_set_style_bg_opa(layer, LV_PART_MAIN | LV_STATE_DEFAULT, LV_OPA_100); } lv_bar_set_value(bar, val, LV_ANIM_OFF); } @@ -263,7 +265,7 @@ void haspProgressMsg(const char* msg) if(lv_obj_t* bar = hasp_find_obj_from_page_id(255U, 10U)) { char value_str[10]; snprintf_P(value_str, sizeof(value_str), PSTR("value_str")); - hasp_process_obj_attribute(bar, value_str, msg, true); + // hasp_process_obj_attribute(bar, value_str, msg, true); } lv_task_handler(); // needed to let the GUI do its work during long updates @@ -271,7 +273,7 @@ void haspProgressMsg(const char* msg) /* if(bar) { progress_str.reserve(64); progress_str = msg; - lv_obj_set_style_local_value_str(bar, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, progress_str.c_str()); + lv_obj_set_style_value_str(bar, LV_PART_MAIN| LV_STATE_DEFAULT, progress_str.c_str()); // lv_task_handler(); // let the GUI do its work } */ @@ -286,23 +288,24 @@ void haspProgressMsg(const __FlashStringHelper* msg) #endif /*Add a custom apply callback*/ -static void custom_font_apply_cb(lv_theme_t* th, lv_obj_t* obj, lv_theme_style_t name) -{ - /* lv_style_list_t* list; +// static void custom_font_apply_cb(lv_theme_t* th, lv_obj_t* obj, lv_theme_style_t name) +// { +// /* lv_style_list_t* list; - switch(name) { - case LV_THEME_BTN: - list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN); - // _lv_style_list_add_style(list, &my_style); - break; - default: - // nothing - ; - } */ -} +// switch(name) { +// case LV_THEME_BTN: +// list = lv_obj_get_style_list(obj, LV_BTN_PART_MAIN); +// // _lv_style_list_add_style(list, &my_style); +// break; +// default: +// // nothing +// ; +// } */ +// } void hasp_set_theme(uint8_t themeid) { + lv_disp_t* disp = lv_disp_get_default(); lv_theme_t* th = NULL; lv_color_t color_primary = lv_color_hsv_to_rgb(haspThemeHue, 100, 100); lv_color_t color_secondary = lv_color_hsv_to_rgb(haspThemeHue, 100, 100); @@ -322,6 +325,12 @@ void hasp_set_theme(uint8_t themeid) uint32_t material_flags = LV_THEME_MATERIAL_FLAG_LIGHT + LV_THEME_MATERIAL_FLAG_NO_TRANSITION; #endif +#if(LV_USE_THEME_DEFAULT == 1) + // LV_THEME_MATERIAL_FLAG_NO_TRANSITION : disable transitions(state change animations) + // LV_THEME_MATERIAL_FLAG_NO_FOCUS: disable indication of focused state) + uint32_t material_flags = LV_THEME_DEFAULT_DARK; +#endif + switch(themeid) { #if(LV_USE_THEME_EMPTY == 1) case 0: @@ -343,8 +352,7 @@ void hasp_set_theme(uint8_t themeid) #if(LV_USE_THEME_MONO == 1) case 3: - th = lv_theme_mono_init(color_primary, color_secondary, LV_THEME_DEFAULT_FLAGS, haspFonts[0], haspFonts[1], - haspFonts[2], haspFonts[3]); + th = lv_theme_mono_init(disp, true, haspFonts[0]); break; #endif @@ -359,6 +367,15 @@ void hasp_set_theme(uint8_t themeid) break; #endif +#if LV_USE_THEME_DEFAULT == 1 + case 5: // Dark + // material_flags = LV_THEME_DEFAULT_FLAG_DARK; + case 4: // Light + case 9: // Light (old id) + th = lv_theme_default_init(disp, color_primary, color_secondary, false, haspFonts[1]); + break; +#endif + #if LV_USE_THEME_TEMPLATE == 1 case 7: th = lv_theme_template_init(LV_COLOR_PURPLE, LV_COLOR_ORANGE, LV_THEME_DEFAULT_FLAGS, haspFonts[0], @@ -372,7 +389,8 @@ void hasp_set_theme(uint8_t themeid) } if(th) { - lv_theme_set_act(th); + // lv_theme_set_act(th); + lv_disp_set_theme(disp, th); /*Assign the theme to the display*/ LOG_INFO(TAG_HASP, F("Custom theme loaded")); } else { LOG_ERROR(TAG_HASP, F("Theme could not be loaded")); diff --git a/src/hasp/hasp.h b/src/hasp/hasp.h index 68812a1e..fae8fbdd 100644 --- a/src/hasp/hasp.h +++ b/src/hasp/hasp.h @@ -61,7 +61,7 @@ bool haspGetConfig(const JsonObject& settings); bool haspSetConfig(const JsonObject& settings); #endif -lv_font_t* hasp_get_font(uint8_t fontid); +const lv_font_t* hasp_get_font(uint8_t fontid); HASP_ATTRIBUTE_FAST_MEM void hasp_update_sleep_state(); void hasp_get_sleep_state(char* payload); diff --git a/src/hasp/hasp_attribute.cpp b/src/hasp/hasp_attribute.cpp index bd939f4b..6e758c91 100644 --- a/src/hasp/hasp_attribute.cpp +++ b/src/hasp/hasp_attribute.cpp @@ -8,6 +8,8 @@ #include "hasplib.h" #include "hasp_attribute_helper.h" +#if LVGL_VERSION_MAJOR == 7 + LV_FONT_DECLARE(unscii_8_icon); extern const char** btnmatrix_default_map; // memory pointer to lvgl default btnmatrix map @@ -258,7 +260,7 @@ static void hasp_attribute_get_part_state(lv_obj_t* obj, const char* attr_in, ch int len = strlen(attr_in); if(len <= 0 || len >= 32) { attr_out[0] = 0; // empty string - part = LV_OBJ_PART_MAIN; + part = LV_PART_MAIN; state = LV_STATE_DEFAULT; return; } @@ -328,7 +330,7 @@ static void hasp_attribute_get_part_state(lv_obj_t* obj, const char* attr_in, ch break; case LV_HASP_CPICKER: - part = index == 1 ? LV_CPICKER_PART_KNOB : LV_CPICKER_PART_MAIN; + part = index == 1 ? lv_colorwheel_PART_KNOB : lv_colorwheel_PART_MAIN; break; case LV_HASP_ROLLER: @@ -357,7 +359,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at const char* payload, bool update, int32_t& val) { char attr[32]; - uint8_t part = LV_OBJ_PART_MAIN; + uint8_t part = LV_PART_MAIN; uint8_t state = LV_STATE_DEFAULT; int16_t var = atoi(payload); @@ -377,19 +379,19 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at case ATTR_BG_BLEND_MODE: return attribute_bg_blend_mode(obj, part, state, update, (lv_blend_mode_t)var, val); // case ATTR_TEXT_BLEND_MODE: - // return lv_obj_set_style_local_text_blend_mode(obj, part, state, (lv_blend_mode_t)var); + // return lv_obj_set_style_text_blend_mode(obj, part, state, (lv_blend_mode_t)var); // case ATTR_BORDER_BLEND_MODE: - // return lv_obj_set_style_local_border_blend_mode(obj, part, state, (lv_blend_mode_t)var); + // return lv_obj_set_style_border_blend_mode(obj, part, state, (lv_blend_mode_t)var); // case ATTR_OUTLINE_BLEND_MODE: - // return lv_obj_set_style_local_outline_blend_mode(obj, part, state, (lv_blend_mode_t)var); + // return lv_obj_set_style_outline_blend_mode(obj, part, state, (lv_blend_mode_t)var); // case ATTR_SHADOW_BLEND_MODE: - // return lv_obj_set_style_local_shadow_blend_mode(obj, part, state, (lv_blend_mode_t)var); + // return lv_obj_set_style_shadow_blend_mode(obj, part, state, (lv_blend_mode_t)var); // case ATTR_LINE_BLEND_MODE: - // return lv_obj_set_style_local_line_blend_mode(obj, part, state, (lv_blend_mode_t)var); + // return lv_obj_set_style_line_blend_mode(obj, part, state, (lv_blend_mode_t)var); // case ATTR_VALUE_BLEND_MODE: - // return lv_obj_set_style_local_value_blend_mode(obj, part, state, (lv_blend_mode_t)var); + // return lv_obj_set_style_value_blend_mode(obj, part, state, (lv_blend_mode_t)var); // case ATTR_PATTERN_BLEND_MODE: - // return lv_obj_set_style_local_pattern_blend_mode(obj, part, state, (lv_blend_mode_t)var); + // return lv_obj_set_style_pattern_blend_mode(obj, part, state, (lv_blend_mode_t)var); #endif case ATTR_SIZE: @@ -417,7 +419,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at if(update) { lv_color32_t c; if(Parser::haspPayloadToColor(payload, c) && part != 64) - lv_obj_set_style_local_bg_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); + lv_obj_set_style_bg_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); } else { attr_out_color(obj, attr, lv_obj_get_style_bg_color(obj, part)); } @@ -427,8 +429,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at if(update) { lv_color32_t c; if(Parser::haspPayloadToColor(payload, c)) - lv_obj_set_style_local_bg_grad_color(obj, part, state, - lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); + lv_obj_set_style_bg_grad_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); } else { attr_out_color(obj, attr, lv_obj_get_style_bg_grad_color(obj, part)); } @@ -466,8 +467,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at if(update) { lv_color32_t c; if(Parser::haspPayloadToColor(payload, c) && part != 64) - lv_obj_set_style_local_scale_grad_color(obj, part, state, - lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); + lv_obj_set_style_scale_grad_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); } else { attr_out_color(obj, attr, lv_obj_get_style_scale_grad_color(obj, part)); } @@ -477,8 +477,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at if(update) { lv_color32_t c; if(Parser::haspPayloadToColor(payload, c)) - lv_obj_set_style_local_scale_end_color(obj, part, state, - lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); + lv_obj_set_style_scale_end_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); } else { attr_out_color(obj, attr, lv_obj_get_style_scale_end_color(obj, part)); } @@ -505,7 +504,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at if(update) { lv_color32_t c; if(Parser::haspPayloadToColor(payload, c)) - lv_obj_set_style_local_text_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); + lv_obj_set_style_text_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); } else { attr_out_color(obj, attr, lv_obj_get_style_text_color(obj, part)); } @@ -515,8 +514,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at if(update) { lv_color32_t c; if(Parser::haspPayloadToColor(payload, c)) - lv_obj_set_style_local_text_sel_color(obj, part, state, - lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); + lv_obj_set_style_text_sel_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); } else { attr_out_color(obj, attr, lv_obj_get_style_text_sel_color(obj, part)); } @@ -528,14 +526,14 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at LOG_WARNING(TAG_ATTR, "%s %d %x", __FILE__, __LINE__, *font); uint8_t count = 3; if(obj_check_type(obj, LV_HASP_ROLLER)) count = my_roller_get_visible_row_count(obj); - lv_obj_set_style_local_text_font(obj, part, state, font); + lv_obj_set_style_text_font(obj, part, state, font); if(obj_check_type(obj, LV_HASP_ROLLER)) lv_roller_set_visible_row_count(obj, count); - lv_obj_set_style_local_text_font(obj, part, state, font); // again, for roller + lv_obj_set_style_text_font(obj, part, state, font); // again, for roller if(obj_check_type(obj, LV_HASP_DROPDOWN)) { // issue #43 - lv_obj_set_style_local_text_font(obj, LV_DROPDOWN_PART_MAIN, state, font); - lv_obj_set_style_local_text_font(obj, LV_DROPDOWN_PART_LIST, state, font); - lv_obj_set_style_local_text_font(obj, LV_DROPDOWN_PART_SELECTED, state, font); + lv_obj_set_style_text_font(obj, LV_DROPDOWN_PART_MAIN, state, font); + lv_obj_set_style_text_font(obj, LV_DROPDOWN_PART_LIST, state, font); + lv_obj_set_style_text_font(obj, LV_DROPDOWN_PART_SELECTED, state, font); }; } else { @@ -558,8 +556,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at if(update) { lv_color32_t c; if(Parser::haspPayloadToColor(payload, c)) - lv_obj_set_style_local_border_color(obj, part, state, - lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); + lv_obj_set_style_border_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); } else { attr_out_color(obj, attr, lv_obj_get_style_border_color(obj, part)); } @@ -577,8 +574,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at if(update) { lv_color32_t c; if(Parser::haspPayloadToColor(payload, c)) - lv_obj_set_style_local_outline_color(obj, part, state, - lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); + lv_obj_set_style_outline_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); } else { attr_out_color(obj, attr, lv_obj_get_style_outline_color(obj, part)); } @@ -601,8 +597,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at if(update) { lv_color32_t c; if(Parser::haspPayloadToColor(payload, c)) - lv_obj_set_style_local_shadow_color(obj, part, state, - lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); + lv_obj_set_style_shadow_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); } else { attr_out_color(obj, attr, lv_obj_get_style_shadow_color(obj, part)); } @@ -626,7 +621,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at if(update) { lv_color32_t c; if(Parser::haspPayloadToColor(payload, c)) - lv_obj_set_style_local_line_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); + lv_obj_set_style_line_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); } else { attr_out_color(obj, attr, lv_obj_get_style_line_color(obj, part)); } @@ -658,8 +653,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at if(update) { lv_color32_t c; if(Parser::haspPayloadToColor(payload, c)) - lv_obj_set_style_local_value_color(obj, part, state, - lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); + lv_obj_set_style_value_color(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); } else { attr_out_color(obj, attr, lv_obj_get_style_value_color(obj, part)); } @@ -668,7 +662,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at case ATTR_VALUE_FONT: { lv_font_t* font = haspPayloadToFont(payload); if(font) { - lv_obj_set_style_local_value_font(obj, part, state, font); + lv_obj_set_style_value_font(obj, part, state, font); } else { LOG_WARNING(TAG_ATTR, F("Unknown Font ID %s"), attr_p); } @@ -687,8 +681,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at if(update) { lv_color32_t c; if(Parser::haspPayloadToColor(payload, c)) - lv_obj_set_style_local_pattern_recolor(obj, part, state, - lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); + lv_obj_set_style_pattern_recolor(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); } else { attr_out_color(obj, attr, lv_obj_get_style_pattern_recolor(obj, part)); } @@ -696,7 +689,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at } case ATTR_PATTERN_IMAGE: - // return lv_obj_set_style_local_pattern_image(obj, part, state, (constvoid *)var); + // return lv_obj_set_style_pattern_image(obj, part, state, (constvoid *)var); // return; /* Image attributes */ @@ -708,8 +701,7 @@ static hasp_attribute_type_t hasp_local_style_attr(lv_obj_t* obj, const char* at if(update) { lv_color32_t c; if(Parser::haspPayloadToColor(payload, c)) - lv_obj_set_style_local_image_recolor(obj, part, state, - lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); + lv_obj_set_style_image_recolor(obj, part, state, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); } else { attr_out_color(obj, attr, lv_obj_get_style_image_recolor(obj, part)); } @@ -930,6 +922,8 @@ static inline bool do_attribute(T& list, lv_obj_t* obj, uint16_t attr_hash, int3 return false; } +#endif + static hasp_attribute_type_t special_attribute_src(lv_obj_t* obj, const char* payload, char** text, bool update) { if(!obj_check_type(obj, LV_HASP_IMAGE)) return HASP_ATTR_TYPE_NOT_FOUND; @@ -939,10 +933,14 @@ static hasp_attribute_type_t special_attribute_src(lv_obj_t* obj, const char* pa lv_img_set_src(obj, payload); } else { switch(lv_img_src_get_type(obj)) { - case LV_IMG_SRC_FILE: - *text = (char*)lv_img_get_file_name(obj); + case LV_IMG_SRC_FILE: { + *text = (((lv_img_t*)obj)->src_type == LV_IMG_SRC_FILE) ? (char*)lv_img_get_src(obj) : (char*)""; + // *text = (char*)lv_img_get_file_name(obj); + break; + } case LV_IMG_SRC_SYMBOL: *text = (char*)lv_img_get_src(obj); + break; } } return HASP_ATTR_TYPE_STR; @@ -951,20 +949,35 @@ static hasp_attribute_type_t special_attribute_src(lv_obj_t* obj, const char* pa static hasp_attribute_type_t attribute_common_align(lv_obj_t* obj, const char* attr, const char* payload, char** text, bool update) { - lv_label_align_t val; + lv_text_align_t val; if(update) { if(!strcasecmp_P(payload, PSTR("left"))) { - val = LV_LABEL_ALIGN_LEFT; + val = LV_TEXT_ALIGN_LEFT; } else if(!strcasecmp_P(payload, PSTR("right"))) { - val = LV_LABEL_ALIGN_RIGHT; + val = LV_TEXT_ALIGN_RIGHT; } else if(!strcasecmp_P(payload, PSTR("center"))) { - val = LV_LABEL_ALIGN_CENTER; + val = LV_TEXT_ALIGN_CENTER; } else if(!strcasecmp_P(payload, PSTR("auto"))) { - val = LV_LABEL_ALIGN_AUTO; + val = LV_TEXT_ALIGN_AUTO; } else { val = atoi(payload); - if(val > LV_LABEL_ALIGN_AUTO) return HASP_ATTR_TYPE_ALIGN_INVALID; + switch(val) { + case 0: + val = LV_TEXT_ALIGN_LEFT; + break; + case 1: + val = LV_TEXT_ALIGN_CENTER; + break; + case 2: + val = LV_TEXT_ALIGN_RIGHT; + break; + case 3: + val = LV_TEXT_ALIGN_AUTO; + break; + default: + return HASP_ATTR_TYPE_ALIGN_INVALID; + } } } @@ -973,9 +986,9 @@ static hasp_attribute_type_t attribute_common_align(lv_obj_t* obj, const char* a lv_obj_t* label = FindButtonLabel(obj); if(label) { if(update) - lv_label_set_align(label, val); + lv_obj_set_style_text_align(label, val, LV_PART_MAIN); else - val = lv_label_get_align(label); + val = lv_obj_get_style_text_align(label, LV_PART_MAIN); } else { return HASP_ATTR_TYPE_NOT_FOUND; // not found } @@ -983,23 +996,17 @@ static hasp_attribute_type_t attribute_common_align(lv_obj_t* obj, const char* a } case LV_HASP_BTNMATRIX: if(update) - lv_btnmatrix_set_align(obj, val); + lv_obj_set_style_text_align(obj, val, LV_PART_ITEMS); else - val = lv_btnmatrix_get_align(obj); + val = lv_obj_get_style_text_align(obj, LV_PART_ITEMS); break; case LV_HASP_LABEL: - if(update) - lv_label_set_align(obj, val); - else - val = lv_label_get_align(obj); - break; - case LV_HASP_ROLLER: if(update) - lv_roller_set_align(obj, val); + lv_obj_set_style_text_align(obj, val, LV_PART_MAIN); else - val = lv_roller_get_align(obj); + val = lv_obj_get_style_text_align(obj, LV_PART_MAIN); break; default: @@ -1008,22 +1015,24 @@ static hasp_attribute_type_t attribute_common_align(lv_obj_t* obj, const char* a // return values switch(val) { - case LV_LABEL_ALIGN_AUTO: - strcpy_P(*text, PSTR("auto")); + case LV_TEXT_ALIGN_LEFT: + strcpy_P(*text, PSTR("left")); break; - case LV_LABEL_ALIGN_CENTER: + case LV_TEXT_ALIGN_CENTER: strcpy_P(*text, PSTR("center")); break; - case LV_LABEL_ALIGN_RIGHT: + case LV_TEXT_ALIGN_RIGHT: strcpy_P(*text, PSTR("right")); break; default: - strcpy_P(*text, PSTR("left")); + strcpy_P(*text, PSTR("auto")); } return HASP_ATTR_TYPE_STR; } +#if LVGL_VERSION_MAJOR == 7 + static hasp_attribute_type_t attribute_common_mode(lv_obj_t* obj, const char* payload, char** text, int32_t& val, bool update) { @@ -1058,57 +1067,6 @@ static hasp_attribute_type_t attribute_common_mode(lv_obj_t* obj, const char* pa return HASP_ATTR_TYPE_NOT_FOUND; } -static hasp_attribute_type_t attribute_common_text(lv_obj_t* obj, const char* attr, const char* payload, char** text, - bool update) -{ - uint8_t obj_type = obj_get_type(obj); - - hasp_attr_update_char_const_t list[] = { - {LV_HASP_BUTTON, ATTR_TEXT, my_btn_set_text, my_btn_get_text}, - {LV_HASP_LABEL, ATTR_TEXT, my_label_set_text, my_label_get_text}, - {LV_HASP_CHECKBOX, ATTR_TEXT, lv_checkbox_set_text, lv_checkbox_get_text}, - {LV_HASP_TABVIEW, ATTR_TEXT, my_tabview_set_text, my_tabview_get_text}, - {LV_HASP_TAB, ATTR_TEXT, my_tab_set_text, my_tab_get_text}, -#if LV_USE_WIN != 0 - {LV_HASP_WINDOW, ATTR_TEXT, lv_win_set_title, lv_win_get_title}, -#endif - {LV_HASP_MSGBOX, ATTR_TEXT, lv_msgbox_set_text, lv_msgbox_get_text} - }; - - for(int i = 0; i < sizeof(list) / sizeof(list[0]); i++) { - if(obj_type == list[i].obj_type) { - if(update) - list[i].set(obj, payload); - else - *text = (char*)list[i].get(obj); - - return HASP_ATTR_TYPE_STR; - } - } - - // Special cases - // {LV_HASP_DROPDOWN, set_text_not_implemented, my_dropdown_get_text}, - // {LV_HASP_ROLLER, set_text_not_implemented, my_roller_get_text}, - switch(obj_get_type(obj)) { - case LV_HASP_DROPDOWN: { - lv_dropdown_get_selected_str(obj, *text, 128); - if(update) return HASP_ATTR_TYPE_STR_READONLY; - break; - } - - case LV_HASP_ROLLER: { - lv_roller_get_selected_str(obj, *text, 128); - if(update) return HASP_ATTR_TYPE_STR_READONLY; - break; - } - - default: - return HASP_ATTR_TYPE_NOT_FOUND; - } - - return HASP_ATTR_TYPE_STR; -} - static hasp_attribute_type_t specific_options_attribute(lv_obj_t* obj, const char* payload, char** text, bool update) { switch(obj_get_type(obj)) { @@ -1348,7 +1306,7 @@ static hasp_attribute_type_t attribute_common_val(lv_obj_t* obj, int32_t& val, b else lv_obj_clear_state(obj, LV_STATE_CHECKED); } else { - val = lv_obj_get_state(obj, LV_BTN_PART_MAIN) & LV_STATE_CHECKED; + val = lv_obj_get_state(obj) & LV_STATE_CHECKED; } } else { return HASP_ATTR_TYPE_NOT_FOUND; // not checkable @@ -1621,6 +1579,59 @@ static hasp_attribute_type_t attribute_common_method(lv_obj_t* obj, uint16_t att return HASP_ATTR_TYPE_METHOD_OK; } +#endif + +static hasp_attribute_type_t attribute_common_text(lv_obj_t* obj, const char* attr, const char* payload, char** text, + bool update) +{ + uint8_t obj_type = obj_get_type(obj); + + hasp_attr_update_char_const_t list[] = { + // {LV_HASP_BUTTON, ATTR_TEXT, my_btn_set_text, my_btn_get_text}, + {LV_HASP_LABEL, ATTR_TEXT, my_label_set_text, my_label_get_text}, + {LV_HASP_CHECKBOX, ATTR_TEXT, lv_checkbox_set_text, lv_checkbox_get_text} //, + // {LV_HASP_TABVIEW, ATTR_TEXT, my_tabview_set_text, my_tabview_get_text}, + // {LV_HASP_TAB, ATTR_TEXT, my_tab_set_text, my_tab_get_text}, +#if LV_USE_WIN != 0 + // {LV_HASP_WINDOW, ATTR_TEXT, lv_win_set_title, lv_win_get_title}, +#endif + // {LV_HASP_MSGBOX, ATTR_TEXT, lv_msgbox_set_text, lv_msgbox_get_text} + }; + + for(int i = 0; i < sizeof(list) / sizeof(list[0]); i++) { + if(obj_type == list[i].obj_type) { + if(update) + list[i].set(obj, payload); + else + *text = (char*)list[i].get(obj); + + return HASP_ATTR_TYPE_STR; + } + } + + // Special cases + // {LV_HASP_DROPDOWN, set_text_not_implemented, my_dropdown_get_text}, + // {LV_HASP_ROLLER, set_text_not_implemented, my_roller_get_text}, + switch(obj_get_type(obj)) { + case LV_HASP_DROPDOWN: { + lv_dropdown_get_selected_str(obj, *text, 128); + if(update) return HASP_ATTR_TYPE_STR_READONLY; + break; + } + + case LV_HASP_ROLLER: { + lv_roller_get_selected_str(obj, *text, 128); + if(update) return HASP_ATTR_TYPE_STR_READONLY; + break; + } + + default: + return HASP_ATTR_TYPE_NOT_FOUND; + } + + return HASP_ATTR_TYPE_STR; +} + /** * Change or Retrieve the value of the attribute of an object * @param obj lv_obj_t*: the object to get/set the attribute @@ -1632,31 +1643,31 @@ static hasp_attribute_type_t attribute_common_method(lv_obj_t* obj, uint16_t att static hasp_attribute_type_t attribute_common_int(lv_obj_t* obj, uint16_t attr_hash, int32_t& val, bool update) { switch(attr_hash) { - case ATTR_ID: - if(update) - obj->user_data.id = (uint8_t)val; - else - val = obj->user_data.id; - break; // attribute_found + // case ATTR_ID: + // if(update) + // obj->user_data.id = (uint8_t)val; + // else + // val = obj->user_data.id; + // break; // attribute_found - case ATTR_GROUPID: - if(update) - obj->user_data.groupid = (uint8_t)val; - else - val = obj->user_data.groupid; - break; // attribute_found + // case ATTR_GROUPID: + // if(update) + // obj->user_data.groupid = (uint8_t)val; + // else + // val = obj->user_data.groupid; + // break; // attribute_found - case ATTR_TRANSITION: - if(update) - obj->user_data.transitionid = (uint8_t)val; - else - val = obj->user_data.transitionid; - break; // attribute_found + // case ATTR_TRANSITION: + // if(update) + // obj->user_data.transitionid = (uint8_t)val; + // else + // val = obj->user_data.transitionid; + // break; // attribute_found - case ATTR_OBJID: - val = obj->user_data.objid; - if(update && val != obj->user_data.objid) HASP_ATTR_TYPE_INT_READONLY; - break; // attribute_found + // case ATTR_OBJID: + // val = obj->user_data.objid; + // if(update && val != obj->user_data.objid) HASP_ATTR_TYPE_INT_READONLY; + // break; // attribute_found case ATTR_X: if(update) @@ -1677,8 +1688,9 @@ static hasp_attribute_type_t attribute_common_int(lv_obj_t* obj, uint16_t attr_h lv_obj_set_width(obj, val); if(obj_check_type(obj, LV_HASP_CPICKER)) { #if LVGL_VERSION_MAJOR == 7 - lv_cpicker_set_type(obj, lv_obj_get_width(obj) == lv_obj_get_height(obj) ? LV_CPICKER_TYPE_DISC - : LV_CPICKER_TYPE_RECT); + lv_colorwheel_set_type(obj, lv_obj_get_width(obj) == lv_obj_get_height(obj) + ? lv_colorwheel_TYPE_DISC + : lv_colorwheel_TYPE_RECT); #endif } } else { @@ -1691,8 +1703,9 @@ static hasp_attribute_type_t attribute_common_int(lv_obj_t* obj, uint16_t attr_h lv_obj_set_height(obj, val); if(obj_check_type(obj, LV_HASP_CPICKER)) { #if LVGL_VERSION_MAJOR == 7 - lv_cpicker_set_type(obj, lv_obj_get_width(obj) == lv_obj_get_height(obj) ? LV_CPICKER_TYPE_DISC - : LV_CPICKER_TYPE_RECT); + lv_colorwheel_set_type(obj, lv_obj_get_width(obj) == lv_obj_get_height(obj) + ? lv_colorwheel_TYPE_DISC + : lv_colorwheel_TYPE_RECT); #endif } } else { @@ -1702,26 +1715,27 @@ static hasp_attribute_type_t attribute_common_int(lv_obj_t* obj, uint16_t attr_h case ATTR_OPACITY: if(update) - lv_obj_set_style_local_opa_scale(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, val); + lv_obj_set_style_opa(obj, LV_PART_MAIN | LV_STATE_DEFAULT, val); else - val = lv_obj_get_style_opa_scale(obj, LV_OBJ_PART_MAIN); + val = lv_obj_get_style_opa(obj, LV_OBJ_PART_MAIN); break; // attribute_found - case ATTR_EXT_CLICK_H: - if(update) - lv_obj_set_ext_click_area(obj, val, val, lv_obj_get_ext_click_pad_top(obj), - lv_obj_get_ext_click_pad_bottom(obj)); - else - val = lv_obj_get_ext_click_pad_left(obj); - break; // attribute_found + // case ATTR_EXT_CLICK_H: + // if(update) + // lv_obj_set_ext_click_area(obj, val, val, lv_obj_get_ext_click_pad_top(obj), + // lv_obj_get_ext_click_pad_bottom(obj)); + // else + // val = lv_obj_get_ext_click_pad_left(obj); + // break; // attribute_found - case ATTR_EXT_CLICK_V: - if(update) - lv_obj_set_ext_click_area(obj, lv_obj_get_ext_click_pad_left(obj), lv_obj_get_ext_click_pad_right(obj), - val, val); - else - val = lv_obj_get_ext_click_pad_top(obj); - break; // attribute_found + // case ATTR_EXT_CLICK_V: + // if(update) + // lv_obj_set_ext_click_area(obj, lv_obj_get_ext_click_pad_left(obj), + // lv_obj_get_ext_click_pad_right(obj), + // val, val); + // else + // val = lv_obj_get_ext_click_pad_top(obj); + // break; // attribute_found default: return HASP_ATTR_TYPE_NOT_FOUND; // attribute_not found @@ -1769,15 +1783,15 @@ static hasp_attribute_type_t attribute_common_bool(lv_obj_t* obj, uint16_t attr_ else lv_obj_add_state(obj, LV_STATE_DISABLED); else - val = !(lv_obj_get_state(obj, LV_BTN_PART_MAIN) & LV_STATE_DISABLED); + val = !(lv_obj_get_state(obj) & LV_STATE_DISABLED); break; // attribute_found - case ATTR_SWIPE: - if(update) - obj->user_data.swipeid = (!!val) % 16; - else - val = obj->user_data.swipeid; - break; // attribute_found + // case ATTR_SWIPE: + // if(update) + // obj->user_data.swipeid = (!!val) % 16; + // else + // val = obj->user_data.swipeid; + // break; // attribute_found case ATTR_TOGGLE: switch(obj_get_type(obj)) { @@ -1795,7 +1809,7 @@ static hasp_attribute_type_t attribute_common_bool(lv_obj_t* obj, uint16_t attr_ lv_btnmatrix_set_btn_ctrl_all(obj, LV_BTNMATRIX_CTRL_CHECKABLE); } else { lv_btnmatrix_clear_btn_ctrl_all(obj, LV_BTNMATRIX_CTRL_CHECKABLE); - lv_btnmatrix_clear_btn_ctrl_all(obj, LV_BTNMATRIX_CTRL_CHECK_STATE); + lv_btnmatrix_clear_btn_ctrl_all(obj, LV_BTNMATRIX_CTRL_CHECKED); } } else { val = lv_btn_get_checkable(obj); @@ -1926,17 +1940,17 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char case ATTR_MIN: val = strtol(payload, nullptr, DEC); - ret = attribute_common_range(obj, val, update, true, false); + // ret = attribute_common_range(obj, val, update, true, false); break; case ATTR_MAX: val = strtol(payload, nullptr, DEC); - ret = attribute_common_range(obj, val, update, false, true); + // ret = attribute_common_range(obj, val, update, false, true); break; case ATTR_VAL: val = strtol(payload, nullptr, DEC); - ret = attribute_common_val(obj, val, update); + // ret = attribute_common_val(obj, val, update); break; case ATTR_TXT: // TODO: remove @@ -1958,21 +1972,24 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char break; case ATTR_MODE: - ret = attribute_common_mode(obj, payload, &text, val, update); + // ret = attribute_common_mode(obj, payload, &text, val, update); break; case ATTR_OPTIONS: - ret = specific_options_attribute(obj, payload, &text, update); + // ret = specific_options_attribute(obj, payload, &text, update); break; // case ATTR_BTN_POS: case ATTR_ACTION: - if(update) - obj->user_data.actionid = Parser::get_action_id(payload); - else - val = obj->user_data.actionid; - ret = HASP_ATTR_TYPE_INT; + if(obj->user_data) { + lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data; + if(update) + user_data->actionid = Parser::get_action_id(payload); + else + val = user_data->actionid; + ret = HASP_ATTR_TYPE_INT; + } break; // case ATTR_SYMBOL: @@ -1986,7 +2003,7 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char case ATTR_TO_BACK: case ATTR_OPEN: case ATTR_CLOSE: - ret = attribute_common_method(obj, attr_hash, attribute, payload); + // ret = attribute_common_method(obj, attr_hash, attribute, payload); break; case ATTR_COMMENT: @@ -2009,14 +2026,14 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char case ATTR_COUNT: case ATTR_BTN_POS: val = strtol(payload, nullptr, DEC); - ret = specific_int_attribute(obj, attr_hash, val, update); + // ret = specific_int_attribute(obj, attr_hash, val, update); break; case ATTR_OFFSET_X: case ATTR_OFFSET_Y: case ATTR_MAX_HEIGHT: val = strtol(payload, nullptr, DEC); - ret = specific_coord_attribute(obj, attr_hash, val, update); + // ret = specific_coord_attribute(obj, attr_hash, val, update); break; case ATTR_ADJUSTABLE: @@ -2025,19 +2042,19 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char case ATTR_SHOW_SELECTED: case ATTR_Y_INVERT: val = Parser::is_true(payload); - ret = specific_bool_attribute(obj, attr_hash, val, update); + // ret = specific_bool_attribute(obj, attr_hash, val, update); break; case ATTR_NEXT: case ATTR_PREV: case ATTR_BACK: val = strtol(payload, nullptr, DEC); - ret = specific_page_attribute(obj, attr_hash, val, update); + // ret = specific_page_attribute(obj, attr_hash, val, update); break; case ATTR_DIRECTION: val = strtol(payload, nullptr, DEC); - ret = special_attribute_direction(obj, attr_hash, val, update); + // ret = special_attribute_direction(obj, attr_hash, val, update); break; case ATTR_SRC: @@ -2045,7 +2062,7 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char break; default: { - ret = hasp_local_style_attr(obj, attribute, attr_hash, payload, update, val); + // ret = hasp_local_style_attr(obj, attribute, attr_hash, payload, update, val); } } @@ -2054,22 +2071,22 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char case LV_HASP_ARC: val = strtol(payload, nullptr, DEC); - ret = hasp_process_arc_attribute(obj, attr_hash, val, update); + // ret = hasp_process_arc_attribute(obj, attr_hash, val, update); break; case LV_HASP_GAUGE: val = strtol(payload, nullptr, DEC); - ret = hasp_process_gauge_attribute(obj, attr_hash, val, update); + // ret = hasp_process_gauge_attribute(obj, attr_hash, val, update); break; case LV_HASP_LINEMETER: val = strtol(payload, nullptr, DEC); - ret = hasp_process_lmeter_attribute(obj, attr_hash, val, update); + // ret = hasp_process_lmeter_attribute(obj, attr_hash, val, update); break; case LV_HASP_LINE: - if(attr_hash == ATTR_POINTS) - ret = my_line_set_points(obj, payload) ? HASP_ATTR_TYPE_METHOD_OK : HASP_ATTR_TYPE_RANGE_ERROR; + // if(attr_hash == ATTR_POINTS) + // ret = my_line_set_points(obj, payload) ? HASP_ATTR_TYPE_METHOD_OK : HASP_ATTR_TYPE_RANGE_ERROR; break; case LV_HASP_CPICKER: @@ -2077,9 +2094,9 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attribute, const char if(update) { lv_color32_t c; if(Parser::haspPayloadToColor(payload, c)) - lv_cpicker_set_color(obj, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); + lv_colorwheel_set_rgb(obj, lv_color_make(c.ch.red, c.ch.green, c.ch.blue)); } else { - color = lv_cpicker_get_color(obj); + color = lv_colorwheel_get_rgb(obj); } ret = HASP_ATTR_TYPE_COLOR; } diff --git a/src/hasp/hasp_attribute.h b/src/hasp/hasp_attribute.h index 6d6bdadc..87874784 100644 --- a/src/hasp/hasp_attribute.h +++ b/src/hasp/hasp_attribute.h @@ -6,6 +6,19 @@ #include "hasplib.h" +static inline void lv_obj_set_event_cb(lv_obj_t* obj, lv_event_cb_t cb) +{ + lv_obj_add_event_cb(obj, cb, LV_EVENT_ALL, NULL); +} +#define lv_style_int_t lv_coord_t +#define lv_anim_value_t lv_coord_t + +void attr_out_str(lv_obj_t* obj, const char* attribute, const char* data); +void attr_out_int(lv_obj_t* obj, const char* attribute, int32_t val); +void attr_out_color(lv_obj_t* obj, const char* attribute, lv_color_t color); + +#if LVGL_VERSION_MAJOR >= 7 + #ifdef __cplusplus extern "C" { #endif @@ -21,10 +34,6 @@ void hasp_process_obj_attribute(lv_obj_t* obj, const char* attr_p, const char* p bool attribute_set_normalized_value(lv_obj_t* obj, hasp_update_value_t& value); -void attr_out_str(lv_obj_t* obj, const char* attribute, const char* data); -void attr_out_int(lv_obj_t* obj, const char* attribute, int32_t val); -void attr_out_color(lv_obj_t* obj, const char* attribute, lv_color_t color); - #ifdef __cplusplus } /* extern "C" */ #endif @@ -143,45 +152,118 @@ struct hasp_attr_update_char_const_t const char* (*get)(const lv_obj_t*); }; -#define _HASP_ATTRIBUTE_OLD(prop_name, func_name, value_type) \ - static inline void attribute_##func_name(lv_obj_t* obj, uint8_t part, lv_state_t state, bool update, \ - const char* attr, value_type val) \ +#define _HASP_ATTRIBUTE_V7(prop_name, func_name, value_type) \ + static inline hasp_attribute_type_t attribute_##func_name(lv_obj_t* obj, uint8_t part, lv_state_t state, \ + bool update, value_type val, int32_t& res) \ { \ - if(update) { \ - return lv_obj_set_style_local_##func_name(obj, part, state, (value_type)val); \ - } else { \ - value_type temp = lv_obj_get_style_##func_name(obj, part); \ - /*lv_obj_get_style_##func_name(obj, part, state, &temp);*/ \ - return attr_out_int(obj, attr, temp); \ - } \ + if(update) lv_obj_set_style_##func_name(obj, part, state, (value_type)val); \ + res = (int32_t)lv_obj_get_style_##func_name(obj, part); \ + return HASP_ATTR_TYPE_INT; \ } #define _HASP_ATTRIBUTE(prop_name, func_name, value_type) \ static inline hasp_attribute_type_t attribute_##func_name(lv_obj_t* obj, uint8_t part, lv_state_t state, \ bool update, value_type val, int32_t& res) \ { \ - if(update) lv_obj_set_style_local_##func_name(obj, part, state, (value_type)val); \ + if(update) lv_obj_set_style_##func_name(obj, (value_type)val, part); \ res = (int32_t)lv_obj_get_style_##func_name(obj, part); \ return HASP_ATTR_TYPE_INT; \ } -_HASP_ATTRIBUTE(RADIUS, radius, lv_style_int_t) +_HASP_ATTRIBUTE(ALIGN, align, lv_align_t) +_HASP_ATTRIBUTE(ANIM_SPEED, anim_speed, uint32_t) +_HASP_ATTRIBUTE(ANIM_TIME, anim_time, uint32_t) +// _HASP_ATTRIBUTE(ARC_COLOR, arc_color, lv_color_t) +// _HASP_ATTRIBUTE(ARC_COLOR_FILTERED, arc_color_filtered, lv_color_t) +_HASP_ATTRIBUTE(ARC_IMG_SRC, arc_img_src, const void*) +_HASP_ATTRIBUTE(ARC_OPA, arc_opa, lv_opa_t) +_HASP_ATTRIBUTE(ARC_ROUNDED, arc_rounded, lv_coord_t) +_HASP_ATTRIBUTE(ARC_WIDTH, arc_width, lv_coord_t) +_HASP_ATTRIBUTE(BASE_DIR, base_dir, lv_base_dir_t) +// _HASP_ATTRIBUTE(BG_COLOR, bg_color, lv_color_t) +// _HASP_ATTRIBUTE(BG_COLOR_FILTERED, bg_color_filtered, lv_color_t) +// _HASP_ATTRIBUTE(BG_GRAD_COLOR, bg_grad_color, lv_color_t) +// _HASP_ATTRIBUTE(BG_GRAD_COLOR_FILTERED, bg_grad_color_filtered, lv_color_t) +_HASP_ATTRIBUTE(BG_GRAD_DIR, bg_grad_dir, lv_grad_dir_t) +_HASP_ATTRIBUTE(BG_GRAD_STOP, bg_grad_stop, lv_coord_t) +_HASP_ATTRIBUTE(BG_IMG_OPA, bg_img_opa, lv_opa_t) +// _HASP_ATTRIBUTE(BG_IMG_RECOLOR, bg_img_recolor, lv_color_t) +// _HASP_ATTRIBUTE(BG_IMG_RECOLOR_FILTERED, bg_img_recolor_filtered, lv_color_t) +_HASP_ATTRIBUTE(BG_IMG_RECOLOR_OPA, bg_img_recolor_opa, lv_opa_t) +_HASP_ATTRIBUTE(BG_IMG_SRC, bg_img_src, const void*) +_HASP_ATTRIBUTE(BG_IMG_TILED, bg_img_tiled, bool) +_HASP_ATTRIBUTE(BG_MAIN_STOP, bg_main_stop, lv_coord_t) +_HASP_ATTRIBUTE(BG_OPA, bg_opa, lv_opa_t) +_HASP_ATTRIBUTE(BLEND_MODE, blend_mode, lv_blend_mode_t) +// _HASP_ATTRIBUTE(BORDER_COLOR, border_color, lv_color_t) +// _HASP_ATTRIBUTE(BORDER_COLOR_FILTERED, border_color_filtered, lv_color_t) +_HASP_ATTRIBUTE(BORDER_OPA, border_opa, lv_opa_t) +_HASP_ATTRIBUTE(BORDER_POST, border_post, bool) +_HASP_ATTRIBUTE(BORDER_SIDE, border_side, lv_border_side_t) +_HASP_ATTRIBUTE(BORDER_WIDTH, border_width, lv_coord_t) _HASP_ATTRIBUTE(CLIP_CORNER, clip_corner, bool) -_HASP_ATTRIBUTE(SIZE, size, lv_style_int_t) -_HASP_ATTRIBUTE(TRANSFORM_WIDTH, transform_width, lv_style_int_t) -_HASP_ATTRIBUTE(TRANSFORM_HEIGHT, transform_height, lv_style_int_t) -_HASP_ATTRIBUTE(OPA_SCALE, opa_scale, lv_opa_t) -_HASP_ATTRIBUTE(MARGIN_TOP, margin_top, lv_style_int_t) -_HASP_ATTRIBUTE(MARGIN_BOTTOM, margin_bottom, lv_style_int_t) -_HASP_ATTRIBUTE(MARGIN_LEFT, margin_left, lv_style_int_t) -_HASP_ATTRIBUTE(MARGIN_RIGHT, margin_right, lv_style_int_t) -_HASP_ATTRIBUTE(PAD_TOP, pad_top, lv_style_int_t) -_HASP_ATTRIBUTE(PAD_BOTTOM, pad_bottom, lv_style_int_t) -_HASP_ATTRIBUTE(PAD_LEFT, pad_left, lv_style_int_t) -_HASP_ATTRIBUTE(PAD_RIGHT, pad_right, lv_style_int_t) +_HASP_ATTRIBUTE(COLOR_FILTER_DSC, color_filter_dsc, const lv_color_filter_dsc_t*) +_HASP_ATTRIBUTE(COLOR_FILTER_OPA, color_filter_opa, lv_opa_t) +_HASP_ATTRIBUTE(HEIGHT, height, lv_coord_t) +_HASP_ATTRIBUTE(IMG_OPA, img_opa, lv_opa_t) +// _HASP_ATTRIBUTE(IMG_RECOLOR, img_recolor, lv_color_t) +// _HASP_ATTRIBUTE(IMG_RECOLOR_FILTERED, img_recolor_filtered, lv_color_t) +_HASP_ATTRIBUTE(IMG_RECOLOR_OPA, img_recolor_opa, lv_opa_t) +_HASP_ATTRIBUTE(LAYOUT, layout, uint16_t) +// _HASP_ATTRIBUTE(LINE_COLOR, line_color, lv_color_t) +// _HASP_ATTRIBUTE(LINE_COLOR_FILTERED, line_color_filtered, lv_color_t) +_HASP_ATTRIBUTE(LINE_DASH_GAP, line_dash_gap, lv_coord_t) +_HASP_ATTRIBUTE(LINE_DASH_WIDTH, line_dash_width, lv_coord_t) +_HASP_ATTRIBUTE(LINE_OPA, line_opa, lv_opa_t) +_HASP_ATTRIBUTE(LINE_ROUNDED, line_rounded, lv_coord_t) +_HASP_ATTRIBUTE(LINE_WIDTH, line_width, lv_coord_t) +_HASP_ATTRIBUTE(MAX_HEIGHT, max_height, lv_coord_t) +_HASP_ATTRIBUTE(MAX_WIDTH, max_width, lv_coord_t) +_HASP_ATTRIBUTE(MIN_HEIGHT, min_height, lv_coord_t) +_HASP_ATTRIBUTE(MIN_WIDTH, min_width, lv_coord_t) +_HASP_ATTRIBUTE(OPA, opa, lv_opa_t) +// _HASP_ATTRIBUTE(OUTLINE_COLOR, outline_color, lv_color_t) +// _HASP_ATTRIBUTE(OUTLINE_COLOR_FILTERED, outline_color_filtered, lv_color_t) +_HASP_ATTRIBUTE(OUTLINE_OPA, outline_opa, lv_opa_t) +_HASP_ATTRIBUTE(OUTLINE_PAD, outline_pad, lv_coord_t) +_HASP_ATTRIBUTE(OUTLINE_WIDTH, outline_width, lv_coord_t) +_HASP_ATTRIBUTE(PAD_BOTTOM, pad_bottom, lv_coord_t) +_HASP_ATTRIBUTE(PAD_COLUMN, pad_column, lv_coord_t) +_HASP_ATTRIBUTE(PAD_LEFT, pad_left, lv_coord_t) +_HASP_ATTRIBUTE(PAD_RIGHT, pad_right, lv_coord_t) +_HASP_ATTRIBUTE(PAD_ROW, pad_row, lv_coord_t) +_HASP_ATTRIBUTE(PAD_TOP, pad_top, lv_coord_t) +_HASP_ATTRIBUTE(RADIUS, radius, lv_coord_t) +// _HASP_ATTRIBUTE(SHADOW_COLOR, shadow_color, lv_color_t) +// _HASP_ATTRIBUTE(SHADOW_COLOR_FILTERED, shadow_color_filtered, lv_color_t) +_HASP_ATTRIBUTE(SHADOW_OFS_X, shadow_ofs_x, lv_coord_t) +_HASP_ATTRIBUTE(SHADOW_OFS_Y, shadow_ofs_y, lv_coord_t) +_HASP_ATTRIBUTE(SHADOW_OPA, shadow_opa, lv_opa_t) +_HASP_ATTRIBUTE(SHADOW_SPREAD, shadow_spread, lv_coord_t) +_HASP_ATTRIBUTE(SHADOW_WIDTH, shadow_width, lv_coord_t) +_HASP_ATTRIBUTE(TEXT_ALIGN, text_align, lv_text_align_t) +// _HASP_ATTRIBUTE(TEXT_COLOR, text_color, lv_color_t) +// _HASP_ATTRIBUTE(TEXT_COLOR_FILTERED, text_color_filtered, lv_color_t) +_HASP_ATTRIBUTE(TEXT_DECOR, text_decor, lv_text_decor_t) +_HASP_ATTRIBUTE(TEXT_FONT, text_font, const lv_font_t*) +_HASP_ATTRIBUTE(TEXT_LETTER_SPACE, text_letter_space, lv_coord_t) +_HASP_ATTRIBUTE(TEXT_LINE_SPACE, text_line_space, lv_coord_t) +_HASP_ATTRIBUTE(TEXT_OPA, text_opa, lv_opa_t) +_HASP_ATTRIBUTE(TRANSFORM_ANGLE, transform_angle, lv_coord_t) +_HASP_ATTRIBUTE(TRANSFORM_HEIGHT, transform_height, lv_coord_t) +_HASP_ATTRIBUTE(TRANSFORM_WIDTH, transform_width, lv_coord_t) +_HASP_ATTRIBUTE(TRANSFORM_ZOOM, transform_zoom, lv_coord_t) +_HASP_ATTRIBUTE(TRANSITION, transition, const lv_style_transition_dsc_t*) +_HASP_ATTRIBUTE(TRANSLATE_X, translate_x, lv_coord_t) +_HASP_ATTRIBUTE(TRANSLATE_Y, translate_y, lv_coord_t) +_HASP_ATTRIBUTE(WIDTH, width, lv_coord_t) +_HASP_ATTRIBUTE(X, x, lv_coord_t) +_HASP_ATTRIBUTE(Y, y, lv_coord_t) + #if LVGL_VERSION_MAJOR == 7 _HASP_ATTRIBUTE(PAD_INNER, pad_inner, lv_style_int_t) #endif + #if LV_USE_BLEND_MODES _HASP_ATTRIBUTE(BG_BLEND_MODE, bg_blend_mode, lv_blend_mode_t) _HASP_ATTRIBUTE(BORDER_BLEND_MODE, border_blend_mode, lv_blend_mode_t) @@ -193,21 +275,7 @@ _HASP_ATTRIBUTE(TEXT_BLEND_MODE, text_blend_mode, lv_blend_mode_t) _HASP_ATTRIBUTE(LINE_BLEND_MODE, line_blend_mode, lv_blend_mode_t) _HASP_ATTRIBUTE(IMAGE_BLEND_MODE, image_blend_mode, lv_blend_mode_t) #endif -_HASP_ATTRIBUTE(BG_MAIN_STOP, bg_main_stop, lv_style_int_t) -_HASP_ATTRIBUTE(BG_GRAD_STOP, bg_grad_stop, lv_style_int_t) -_HASP_ATTRIBUTE(BG_GRAD_DIR, bg_grad_dir, lv_grad_dir_t) -//_HASP_ATTRIBUTE(BG_COLOR, bg_color, lv_color_t, _color, nonscalar) -//_HASP_ATTRIBUTE(BG_GRAD_COLOR, bg_grad_color, lv_color_t, _color, nonscalar) -_HASP_ATTRIBUTE(BG_OPA, bg_opa, lv_opa_t) -_HASP_ATTRIBUTE(BORDER_WIDTH, border_width, lv_style_int_t) -_HASP_ATTRIBUTE(BORDER_SIDE, border_side, lv_border_side_t) -_HASP_ATTRIBUTE(BORDER_POST, border_post, bool) -//_HASP_ATTRIBUTE(BORDER_COLOR, border_color, lv_color_t, _color, nonscalar) -_HASP_ATTRIBUTE(BORDER_OPA, border_opa, lv_opa_t) -_HASP_ATTRIBUTE(OUTLINE_WIDTH, outline_width, lv_style_int_t) -_HASP_ATTRIBUTE(OUTLINE_PAD, outline_pad, lv_style_int_t) -//_HASP_ATTRIBUTE(OUTLINE_COLOR, outline_color, lv_color_t, _color, nonscalar) -_HASP_ATTRIBUTE(OUTLINE_OPA, outline_opa, lv_opa_t) + #if LV_USE_SHADOW _HASP_ATTRIBUTE(SHADOW_WIDTH, shadow_width, lv_style_int_t) _HASP_ATTRIBUTE(SHADOW_OFS_X, shadow_ofs_x, lv_style_int_t) @@ -216,51 +284,6 @@ _HASP_ATTRIBUTE(SHADOW_SPREAD, shadow_spread, lv_style_int_t) //_HASP_ATTRIBUTE(SHADOW_COLOR, shadow_color, lv_color_t, _color, nonscalar) _HASP_ATTRIBUTE(SHADOW_OPA, shadow_opa, lv_opa_t) #endif -_HASP_ATTRIBUTE(PATTERN_REPEAT, pattern_repeat, bool) -//_HASP_ATTRIBUTE(PATTERN_RECOLOR, pattern_recolor, lv_color_t, _color, nonscalar) -_HASP_ATTRIBUTE(PATTERN_OPA, pattern_opa, lv_opa_t) -_HASP_ATTRIBUTE(PATTERN_RECOLOR_OPA, pattern_recolor_opa, lv_opa_t) -//_HASP_ATTRIBUTE(PATTERN_IMAGE, pattern_image, const void *, _data_ptr, scalar) -_HASP_ATTRIBUTE(VALUE_LETTER_SPACE, value_letter_space, lv_style_int_t) -_HASP_ATTRIBUTE(VALUE_LINE_SPACE, value_line_space, lv_style_int_t) -_HASP_ATTRIBUTE(VALUE_OFS_X, value_ofs_x, lv_style_int_t) -_HASP_ATTRIBUTE(VALUE_OFS_Y, value_ofs_y, lv_style_int_t) -_HASP_ATTRIBUTE(VALUE_ALIGN, value_align, lv_align_t) -//_HASP_ATTRIBUTE(VALUE_COLOR, value_color, lv_color_t, _color, nonscalar) -_HASP_ATTRIBUTE(VALUE_OPA, value_opa, lv_opa_t) -//_HASP_ATTRIBUTE(VALUE_FONT, value_font, const lv_font_t *, _data_ptr, scalar) -//_HASP_ATTRIBUTE(VALUE_STR, value_str, const char *, _data_ptr, scalar) -_HASP_ATTRIBUTE(TEXT_LETTER_SPACE, text_letter_space, lv_style_int_t) -_HASP_ATTRIBUTE(TEXT_LINE_SPACE, text_line_space, lv_style_int_t) -_HASP_ATTRIBUTE(TEXT_DECOR, text_decor, lv_text_decor_t) -//_HASP_ATTRIBUTE(TEXT_COLOR, text_color, lv_color_t, _color, nonscalar) -//_HASP_ATTRIBUTE(TEXT_SEL_COLOR, text_sel_color, lv_color_t, _color, nonscalar) -_HASP_ATTRIBUTE(TEXT_OPA, text_opa, lv_opa_t) -//_HASP_ATTRIBUTE(TEXT_FONT, text_font, const lv_font_t *, _data_ptr, scalar) -_HASP_ATTRIBUTE(LINE_WIDTH, line_width, lv_style_int_t) -_HASP_ATTRIBUTE(LINE_DASH_WIDTH, line_dash_width, lv_style_int_t) -_HASP_ATTRIBUTE(LINE_DASH_GAP, line_dash_gap, lv_style_int_t) -_HASP_ATTRIBUTE(LINE_ROUNDED, line_rounded, bool) -//_HASP_ATTRIBUTE(LINE_COLOR, line_color, lv_color_t, _color, nonscalar) -_HASP_ATTRIBUTE(LINE_OPA, line_opa, lv_opa_t) -//_HASP_ATTRIBUTE(IMAGE_RECOLOR, image_recolor, lv_color_t, _color, nonscalar) -_HASP_ATTRIBUTE(IMAGE_OPA, image_opa, lv_opa_t) -_HASP_ATTRIBUTE(IMAGE_RECOLOR_OPA, image_recolor_opa, lv_opa_t) -_HASP_ATTRIBUTE(TRANSITION_TIME, transition_time, lv_style_int_t) -_HASP_ATTRIBUTE(TRANSITION_DELAY, transition_delay, lv_style_int_t) -_HASP_ATTRIBUTE(TRANSITION_PROP_1, transition_prop_1, lv_style_int_t) -_HASP_ATTRIBUTE(TRANSITION_PROP_2, transition_prop_2, lv_style_int_t) -_HASP_ATTRIBUTE(TRANSITION_PROP_3, transition_prop_3, lv_style_int_t) -_HASP_ATTRIBUTE(TRANSITION_PROP_4, transition_prop_4, lv_style_int_t) -_HASP_ATTRIBUTE(TRANSITION_PROP_5, transition_prop_5, lv_style_int_t) -_HASP_ATTRIBUTE(TRANSITION_PROP_6, transition_prop_6, lv_style_int_t) - -_HASP_ATTRIBUTE(SCALE_WIDTH, scale_width, lv_style_int_t) -_HASP_ATTRIBUTE(SCALE_BORDER_WIDTH, scale_border_width, lv_style_int_t) -_HASP_ATTRIBUTE(SCALE_END_BORDER_WIDTH, scale_end_border_width, lv_style_int_t) -_HASP_ATTRIBUTE(SCALE_END_LINE_WIDTH, scale_end_line_width, lv_style_int_t) -//_HASP_ATTRIBUTE(SCALE_GRAD_COLOR, scale_grad_color, lv_color_t, _color, nonscalar) -//_HASP_ATTRIBUTE(SCALE_END_COLOR, scale_end_color, lv_color_t, _color, nonscalar) /* attribute hashes */ /* Object Part Attributes */ @@ -487,3 +510,5 @@ _HASP_ATTRIBUTE(SCALE_END_LINE_WIDTH, scale_end_line_width, lv_style_int_t) #define ATTR_TEXT_SSID 62981 #endif + +#endif \ No newline at end of file diff --git a/src/hasp/hasp_attribute_helper.h b/src/hasp/hasp_attribute_helper.h index 6a87c3a5..66d6fe80 100644 --- a/src/hasp/hasp_attribute_helper.h +++ b/src/hasp/hasp_attribute_helper.h @@ -3,6 +3,8 @@ #include "hasplib.h" +#if LVGL_VERSION_MAJOR == 7 + const char* my_tabview_get_tab_name(const lv_obj_t* tabview, uint16_t id) { if(id >= lv_tabview_get_tab_count(tabview)) return NULL; @@ -115,19 +117,18 @@ lv_coord_t my_dropdown_get_max_height(lv_obj_t* obj) return lv_dropdown_get_max_height(obj); } +#endif + // OK -lv_obj_t* FindButtonLabel(lv_obj_t* btn) +lv_obj_t* FindButtonLabel(const lv_obj_t* btn) { if(btn) { - lv_obj_t* label = lv_obj_get_child_back(btn, NULL); - if(label) { - if(obj_check_type(label, LV_HASP_LABEL)) { - return label; - } - - } else { - LOG_ERROR(TAG_ATTR, F("FindButtonLabel NULL Pointer encountered")); + for(uint32_t i = 0; i < lv_obj_get_child_cnt(btn); i++) { + lv_obj_t* child = lv_obj_get_child(btn, i); + if(lv_obj_check_type(child, &lv_label_class)) return child; } + + LOG_ERROR(TAG_ATTR, F("FindButtonLabel NULL Pointer encountered")); } else { LOG_WARNING(TAG_ATTR, F("Button not defined")); } @@ -186,30 +187,13 @@ static void my_label_set_text(lv_obj_t* label, const char* text) // OK static const char* my_btn_get_text(const lv_obj_t* obj) { - if(!obj) { - LOG_WARNING(TAG_ATTR, F("Button not defined")); - return NULL; - } - - lv_obj_t* label = lv_obj_get_child_back(obj, NULL); - if(label) { -#if 1 - if(obj_check_type(label, LV_HASP_LABEL)) return lv_label_get_text(label); - -#else - lv_obj_type_t list; - lv_obj_get_type(label, &list); - - if(obj_check_type(list.type[0], LV_HASP_LABEL)) { - text = lv_label_get_text(label); - return true; - } -#endif - - } else { + if(obj) { + const lv_obj_t* label = FindButtonLabel(obj); + if(label) return lv_label_get_text(label); LOG_WARNING(TAG_ATTR, F("my_btn_get_text NULL Pointer encountered")); + } else { + LOG_WARNING(TAG_ATTR, F("Button not defined")); } - return NULL; } @@ -217,11 +201,11 @@ static const char* my_btn_get_text(const lv_obj_t* obj) static inline void my_btn_set_text(lv_obj_t* obj, const char* value) { lv_obj_t* label = FindButtonLabel(obj); - if(label) { - my_label_set_text(label, value); - } + if(label) my_label_set_text(label, value); } +#if LVGL_VERSION_MAJOR == 7 + /** * Set a new value_str for an object. Memory will be allocated to store the text by the object. * @param obj pointer to a object @@ -229,6 +213,8 @@ static inline void my_btn_set_text(lv_obj_t* obj, const char* value) */ void my_obj_set_value_str_text(lv_obj_t* obj, uint8_t part, lv_state_t state, const char* text) { + +#if 0 // LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__); const void* value_str_p = lv_obj_get_style_value_str(obj, part); @@ -236,7 +222,7 @@ void my_obj_set_value_str_text(lv_obj_t* obj, uint8_t part, lv_state_t state, co if(text == NULL || text[0] == 0) { // LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__); - lv_obj_set_style_local_value_str(obj, part, state, NULL); + lv_obj_set_style_value_str(obj, part, state, NULL); lv_mem_free(value_str_p); // LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__); return; @@ -256,12 +242,12 @@ void my_obj_set_value_str_text(lv_obj_t* obj, uint8_t part, lv_state_t state, co // LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__); strncpy((char*)value_str_p, text, len); - lv_obj_set_style_local_value_str(obj, part, state, (char*)value_str_p); + lv_obj_set_style_value_str(obj, part, state, (char*)value_str_p); // LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__); return; } - // lv_obj_set_style_local_value_str(obj, part, state, str_p); + // lv_obj_set_style_value_str(obj, part, state, str_p); if(value_str_p == text) { /*If set its own text then reallocate it (maybe its size changed)*/ @@ -288,10 +274,11 @@ void my_obj_set_value_str_text(lv_obj_t* obj, uint8_t part, lv_state_t state, co value_str_p = lv_mem_alloc(len); LV_ASSERT_MEM(value_str_p); if(value_str_p != NULL) strcpy((char*)value_str_p, text); - lv_obj_set_style_local_value_str(obj, part, state, (char*)value_str_p); + lv_obj_set_style_value_str(obj, part, state, (char*)value_str_p); } // LOG_VERBOSE(TAG_ATTR, F("%s %d"), __FILE__, __LINE__); +#endif } void my_list_set_options(lv_obj_t* obj, const char* payload) @@ -572,7 +559,7 @@ static bool attribute_update_lv_property(lv_obj_t * obj, const char * attr_p, ui if(prop_type < LV_STYLE_ID_COLOR) { if(update) { - _lv_obj_set_style_local_int(obj, part, prop | (state << LV_STYLE_STATE_POS), atoi(payload)) + _lv_obj_set_style_int(obj, part, prop | (state << LV_STYLE_STATE_POS), atoi(payload)) } else { attr_out_str(obj, attr_p, lv_obj_get_style_value_str(obj, part)); } @@ -582,3 +569,4 @@ static bool attribute_update_lv_property(lv_obj_t * obj, const char * attr_p, ui } } #endif +#endif // LVGL_VERSION_MAJOR == 7 diff --git a/src/hasp/hasp_event.cpp b/src/hasp/hasp_event.cpp index e89f51c8..af9d63b4 100644 --- a/src/hasp/hasp_event.cpp +++ b/src/hasp/hasp_event.cpp @@ -27,33 +27,41 @@ #include "hasplib.h" +#if LVGL_VERSION_MAJOR == 7 #include "lv_core/lv_obj.h" // for tabview ext +#else +#include "core/lv_obj.h" // for tabview ext +#endif static lv_style_int_t last_value_sent; static lv_color_t last_color_sent; -void swipe_event_handler(lv_obj_t* obj, lv_event_t event); +void swipe_event_handler(lv_event_t* e); /** * Clean-up allocated memory before an object is deleted * @param obj pointer to an object to clean-up */ -void delete_event_handler(lv_obj_t* obj, lv_event_t event) +void delete_event_handler(lv_event_t* e) { + lv_event_code_t event = lv_event_get_code(e); + + lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e); + if(event != LV_EVENT_DELETE) return; switch(obj_get_type(obj)) { - case LV_HASP_LINE: - line_clear_points(obj); - break; + // case LV_HASP_LINE: + // line_clear_points(obj); + // break; - case LV_HASP_BTNMATRIX: - my_btnmatrix_map_clear(obj); - break; + // case LV_HASP_BTNMATRIX: + // my_btnmatrix_map_clear(obj); + // break; - case LV_HASP_MSGBOX: - my_msgbox_map_clear(obj); - break; + // case LV_HASP_MSGBOX: + // my_msgbox_map_clear(obj); + // break; case LV_HASP_IMAGE: lv_img_cache_invalidate_src(NULL); @@ -67,11 +75,11 @@ void delete_event_handler(lv_obj_t* obj, lv_event_t event) } // TODO: delete value_str data for ALL parts - my_obj_set_value_str_text(obj, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, NULL); + // V8 my_obj_set_value_str_text(obj, LV_PART_MAIN| LV_STATE_DEFAULT, NULL); } /* ============================== Timer Event ============================ */ -void event_timer_calendar(lv_task_t* task) +void event_timer_calendar(lv_timer_t* task) { hasp_task_user_data_t* data = (hasp_task_user_data_t*)task->user_data; lv_obj_t* obj = NULL; @@ -79,7 +87,7 @@ void event_timer_calendar(lv_task_t* task) if(data) obj = hasp_find_obj_from_page_id(data->pageid, data->objid); if(!obj || !data || !obj_check_type(obj, LV_HASP_CALENDER)) { if(data) lv_mem_free(data); // the object that the user_data points to is gone - lv_task_del(task); // the calendar object for this task was deleted + lv_timer_del(task); // the calendar object for this task was deleted LOG_WARNING(TAG_EVENT, "event_timer_calendar could not find the linked object"); return; } @@ -93,13 +101,13 @@ void event_timer_calendar(lv_task_t* task) (void)rslt; // unused if(timeinfo->tm_year < 120) { - lv_task_set_period(task, 60000); // try again in a minute + lv_timer_set_period(task, 60000); // try again in a minute LOG_WARNING(TAG_EVENT, "event_timer_calendar could not sync the clock"); return; } else { uint32_t next_hour = (3600 - (t % 3600)) * 1000; // ms to next top of hour - // lv_task_set_period(task, next_hour + 128); // small offset so all tasks don't run at once - lv_task_set_period(task, data->interval); + // lv_timer_set_period(task, next_hour + 128); // small offset so all tasks don't run at once + lv_timer_set_period(task, data->interval); } date.day = timeinfo->tm_mday; @@ -109,10 +117,10 @@ void event_timer_calendar(lv_task_t* task) LOG_VERBOSE(TAG_EVENT, "event_timer_calendar called with user %d:%d:%d", timeinfo->tm_hour, timeinfo->tm_min, timeinfo->tm_sec); - lv_calendar_set_today_date(obj, &date); + lv_calendar_set_today_date(obj, date.year, date.month, date.day); } -void event_timer_clock(lv_task_t* task) +void event_timer_clock(lv_timer_t* task) { hasp_task_user_data_t* data = (hasp_task_user_data_t*)task->user_data; lv_obj_t* obj; @@ -120,7 +128,7 @@ void event_timer_clock(lv_task_t* task) if(data) obj = hasp_find_obj_from_page_id(data->pageid, data->objid); if(!obj || !data) { if(data) lv_mem_free(data); // the object that the user_data points to is gone - lv_task_del(task); // the calendar object for this task was deleted + lv_timer_del(task); // the calendar object for this task was deleted LOG_WARNING(TAG_EVENT, "event_timer_clock could not find the linked object"); return; } @@ -142,11 +150,11 @@ void event_timer_clock(lv_task_t* task) // timeinfo->tm_sec); lv_label_set_text(obj, buffer); - lv_task_set_period(task, data->interval); + lv_timer_set_period(task, data->interval); } /* ============================== Timer Event ============================ */ -void event_timer_refresh(lv_task_t* task) +void event_timer_refresh(lv_timer_t* task) { lv_obj_t* obj = (lv_obj_t*)task->user_data; printf("event_timer_refresh called with user data\n"); @@ -168,16 +176,19 @@ void event_timer_refresh(lv_task_t* task) * @param event type of event that occured * @param eventid returns the hasp eventid */ -static bool translate_event(lv_obj_t* obj, lv_event_t event, uint8_t& eventid) +static bool translate_event(lv_event_t* e, uint8_t& eventid) { + lv_event_code_t event = lv_event_get_code(e); + lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e); + switch(event) { case LV_EVENT_GESTURE: - swipe_event_handler(obj, event); + swipe_event_handler(e); break; case LV_EVENT_DELETE: LOG_VERBOSE(TAG_EVENT, F(D_OBJECT_DELETED)); - delete_event_handler(obj, event); + delete_event_handler(e); break; case LV_EVENT_PRESSED: @@ -247,7 +258,7 @@ static inline void event_update_group(uint8_t group, lv_obj_t* obj, bool power, dispatch_normalized_group_values(value); } -static void log_event(const char* name, lv_event_t event) +static void log_event(const char* name, lv_event_code_t event) { return; @@ -309,8 +320,11 @@ static void log_event(const char* name, lv_event_t event) * @param obj pointer to a button matrix * @param event type of event that occured */ -void wakeup_event_handler(lv_obj_t* obj, lv_event_t event) +void wakeup_event_handler(lv_event_t* e) { + lv_event_code_t event = lv_event_get_code(e); + lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e); + // log_event("wakeup", event); if(event == LV_EVENT_RELEASED && obj == lv_disp_get_layer_sys(NULL)) { @@ -322,20 +336,23 @@ void wakeup_event_handler(lv_obj_t* obj, lv_event_t event) } } -void swipe_event_handler(lv_obj_t* obj, lv_event_t event) +void swipe_event_handler(lv_event_t* e) { - if(!obj || obj->user_data.swipeid == 0) return; + lv_event_code_t event = lv_event_get_code(e); + lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e); + lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data; + if(!obj || !user_data || user_data->swipeid == 0) return; // no swipe set if(event == LV_EVENT_GESTURE) { - lv_gesture_dir_t dir = lv_indev_get_gesture_dir(lv_indev_get_act()); + lv_dir_t dir = lv_indev_get_gesture_dir(lv_indev_get_act()); switch(dir) { - case LV_GESTURE_DIR_LEFT: + case LV_DIR_LEFT: haspPages.next(LV_SCR_LOAD_ANIM_NONE); break; - case LV_GESTURE_DIR_RIGHT: + case LV_DIR_RIGHT: haspPages.prev(LV_SCR_LOAD_ANIM_NONE); break; - case LV_GESTURE_DIR_BOTTOM: + case LV_DIR_BOTTOM: haspPages.back(LV_SCR_LOAD_ANIM_NONE); break; default: @@ -350,13 +367,16 @@ void swipe_event_handler(lv_obj_t* obj, lv_event_t event) * @param obj pointer to a button object * @param event type of event that occured */ -void generic_event_handler(lv_obj_t* obj, lv_event_t event) +void generic_event_handler(lv_event_t* e) { + lv_event_code_t event = lv_event_get_code(e); + lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e); + log_event("generic", event); switch(event) { case LV_EVENT_GESTURE: - swipe_event_handler(obj, event); + swipe_event_handler(e); return; case LV_EVENT_PRESSED: @@ -394,9 +414,33 @@ void generic_event_handler(lv_obj_t* obj, lv_event_t event) case LV_EVENT_DELETE: LOG_VERBOSE(TAG_EVENT, F(D_OBJECT_DELETED)); - delete_event_handler(obj, event); // free and destroy persistent memory allocated for certain objects + delete_event_handler(e); // free and destroy persistent memory allocated for certain objects return; + case LV_EVENT_COVER_CHECK: /**< Check if the object fully covers an area. The event parameter is + *`lv_cover_check_info_t + *`.*/ + case LV_EVENT_REFR_EXT_DRAW_SIZE: /**< Get the required extra draw area around the object (e.g. for shadow). The + event parameter is `lv_coord_t *` to store the size.*/ + case LV_EVENT_DRAW_MAIN_BEGIN: /**< Starting the main drawing phase*/ + case LV_EVENT_DRAW_MAIN: /**< Perform the main drawing*/ + case LV_EVENT_DRAW_MAIN_END: /**< Finishing the main drawing phase*/ + case LV_EVENT_DRAW_POST_BEGIN: /**< Starting the post draw phase (when all children are drawn)*/ + case LV_EVENT_DRAW_POST: /**< Perform the post draw phase (when all children are drawn)*/ + case LV_EVENT_DRAW_POST_END: /**< Finishing the post draw phase (when all children are drawn)*/ + case LV_EVENT_DRAW_PART_BEGIN: /**< Starting to draw a part. The event parameter is `lv_obj_draw_dsc_t + *`. */ + case LV_EVENT_DRAW_PART_END: /**< Finishing to draw a part. The event parameter is `lv_obj_draw_dsc_t *`. + */ + return; // drawing events + + case LV_EVENT_CHILD_CHANGED: /**< Child was removed/added*/ + case LV_EVENT_SIZE_CHANGED: /**< Object coordinates/size have changed*/ + case LV_EVENT_STYLE_CHANGED: /**< Object's style has changed*/ + case LV_EVENT_LAYOUT_CHANGED: /**< The children position has changed due to a layout recalculation*/ + case LV_EVENT_GET_SELF_SIZE: /**< Get the internal size of a widget*/ + return; // special events + case LV_EVENT_PRESSING: case LV_EVENT_FOCUSED: case LV_EVENT_DEFOCUSED: @@ -411,10 +455,11 @@ void generic_event_handler(lv_obj_t* obj, lv_event_t event) if(last_value_sent == HASP_EVENT_LOST) return; /* If an actionid is attached, perform that action on UP event only */ - if(obj->user_data.actionid) { + lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data; + if(user_data->actionid) { if(last_value_sent == HASP_EVENT_UP || last_value_sent == HASP_EVENT_RELEASE) { - lv_scr_load_anim_t transitionid = (lv_scr_load_anim_t)obj->user_data.transitionid; - switch(obj->user_data.actionid) { + lv_scr_load_anim_t transitionid = (lv_scr_load_anim_t)user_data->transitionid; + switch(user_data->actionid) { case HASP_NUM_PAGE_PREV: haspPages.prev(transitionid); break; @@ -425,7 +470,7 @@ void generic_event_handler(lv_obj_t* obj, lv_event_t event) haspPages.next(transitionid); break; default: - haspPages.set(obj->user_data.actionid, transitionid); + haspPages.set(user_data->actionid, transitionid); } dispatch_current_page(); } @@ -439,8 +484,9 @@ void generic_event_handler(lv_obj_t* obj, lv_event_t event) // Update group objects and gpios on release if(last_value_sent != LV_EVENT_LONG_PRESSED || last_value_sent != LV_EVENT_LONG_PRESSED_REPEAT) { - bool state = Parser::get_event_state(last_value_sent); - event_update_group(obj->user_data.groupid, obj, state, state, HASP_EVENT_OFF, HASP_EVENT_ON); + bool state = Parser::get_event_state(last_value_sent); + lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data; + event_update_group(user_data->groupid, obj, state, state, HASP_EVENT_OFF, HASP_EVENT_ON); } } @@ -449,16 +495,20 @@ void generic_event_handler(lv_obj_t* obj, lv_event_t event) * @param obj pointer to a switch object * @param event type of event that occured */ -void toggle_event_handler(lv_obj_t* obj, lv_event_t event) +void toggle_event_handler(lv_event_t* e) { + lv_event_code_t event = lv_event_get_code(e); + lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e); + log_event("toggle", event); uint8_t hasp_event_id; - if(!translate_event(obj, event, hasp_event_id)) return; + if(!translate_event(e, hasp_event_id)) return; if(hasp_event_id != HASP_EVENT_DOWN && hasp_event_id != HASP_EVENT_UP) return; // only up or down wanted /* Get the new value */ - switch(obj->user_data.objid) { + lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data; + switch(user_data->objid) { case LV_HASP_SWITCH: last_value_sent = lv_switch_get_state(obj); break; @@ -466,12 +516,12 @@ void toggle_event_handler(lv_obj_t* obj, lv_event_t event) /* case LV_HASP_CHECKBOX: // This lvgl value is incorrect, it returns pressed instead of checked // last_value_sent = lv_checkbox_is_checked(obj); - last_value_sent = lv_obj_get_state(obj, LV_BTN_PART_MAIN) & LV_STATE_CHECKED; + last_value_sent = lv_obj_get_state(obj) & LV_STATE_CHECKED; break; */ case LV_HASP_CHECKBOX: case LV_HASP_BUTTON: { - last_value_sent = lv_obj_get_state(obj, LV_BTN_PART_MAIN) & LV_STATE_CHECKED; + last_value_sent = lv_obj_get_state(obj) & LV_STATE_CHECKED; break; } @@ -482,9 +532,8 @@ void toggle_event_handler(lv_obj_t* obj, lv_event_t event) event_object_val_event(obj, hasp_event_id, last_value_sent); // Update group objects and gpios on release - if(obj->user_data.groupid && hasp_event_id == HASP_EVENT_UP) { - event_update_group(obj->user_data.groupid, obj, last_value_sent, last_value_sent, HASP_EVENT_OFF, - HASP_EVENT_ON); + if(user_data->groupid && hasp_event_id == HASP_EVENT_UP) { + event_update_group(user_data->groupid, obj, last_value_sent, last_value_sent, HASP_EVENT_OFF, HASP_EVENT_ON); } } @@ -493,12 +542,15 @@ void toggle_event_handler(lv_obj_t* obj, lv_event_t event) * @param obj pointer to a dropdown list or roller * @param event type of event that occured */ -void selector_event_handler(lv_obj_t* obj, lv_event_t event) +void selector_event_handler(lv_event_t* e) { + lv_event_code_t event = lv_event_get_code(e); + lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e); + log_event("selector", event); uint8_t hasp_event_id; - if(!translate_event(obj, event, hasp_event_id)) return; // Use LV_EVENT_VALUE_CHANGED + if(!translate_event(e, hasp_event_id)) return; // Use LV_EVENT_VALUE_CHANGED /* Get the new value */ char buffer[128]; @@ -507,7 +559,8 @@ void selector_event_handler(lv_obj_t* obj, lv_event_t event) uint16_t max = 0; /* Get the text, val and max properties */ - switch(obj->user_data.objid) { + lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data; + switch(user_data->objid) { case LV_HASP_DROPDOWN: val = lv_dropdown_get_selected(obj); max = lv_dropdown_get_option_cnt(obj) - 1; @@ -521,26 +574,26 @@ void selector_event_handler(lv_obj_t* obj, lv_event_t event) break; case LV_HASP_TABVIEW: { - val = lv_tabview_get_tab_act(obj); - max = lv_tabview_get_tab_count(obj) - 1; + // val = lv_tabview_get_tab_act(obj); + // max = lv_tabview_get_tab_count(obj) - 1; - lv_tabview_ext_t* ext = (lv_tabview_ext_t*)lv_obj_get_ext_attr(obj); - strcpy(buffer, ext->tab_name_ptr[val]); + // lv_tabview_ext_t* ext = (lv_tabview_ext_t*)lv_obj_get_ext_attr(obj); + // strcpy(buffer, ext->tab_name_ptr[val]); break; } - case LV_HASP_TABLE: { - uint16_t row; - uint16_t col; - if(lv_table_get_pressed_cell(obj, &row, &col) != LV_RES_OK) return; // outside any cell + // case LV_HASP_TABLE: { + // uint16_t row; + // uint16_t col; + // // if(lv_table_get_pressed_cell(obj, &row, &col) != LV_RES_OK) return; // outside any cell - const char* txt = lv_table_get_cell_value(obj, row, col); - strncpy(buffer, txt, sizeof(buffer)); + // const char* txt = lv_table_get_cell_value(obj, row, col); + // strncpy(buffer, txt, sizeof(buffer)); - snprintf_P(property, sizeof(property), PSTR("row\":%d,\"col\":%d,\"text"), row, col); - attr_out_str(obj, property, buffer); - return; // done sending - } + // snprintf_P(property, sizeof(property), PSTR("row\":%d,\"col\":%d,\"text"), row, col); + // attr_out_str(obj, property, buffer); + // return; // done sending + // } default: return; // Invalid selector type @@ -550,9 +603,9 @@ void selector_event_handler(lv_obj_t* obj, lv_event_t event) last_value_sent = val; event_object_selection_changed(obj, hasp_event_id, val, buffer); - if(obj->user_data.groupid && max > 0) // max a cannot be 0, its the divider + if(user_data->groupid && max > 0) // max a cannot be 0, its the divider if(hasp_event_id == HASP_EVENT_UP || hasp_event_id == LV_EVENT_VALUE_CHANGED) { - event_update_group(obj->user_data.groupid, obj, !!last_value_sent, last_value_sent, 0, max); + event_update_group(user_data->groupid, obj, !!last_value_sent, last_value_sent, 0, max); } // set the property @@ -565,18 +618,21 @@ void selector_event_handler(lv_obj_t* obj, lv_event_t event) * @param obj pointer to a dropdown list or roller * @param event type of event that occured */ -void btnmatrix_event_handler(lv_obj_t* obj, lv_event_t event) +void btnmatrix_event_handler(lv_event_t* e) { + lv_event_code_t event = lv_event_get_code(e); + lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e); + log_event("btnmatrix", event); uint8_t hasp_event_id; - if(!translate_event(obj, event, hasp_event_id)) return; // Use LV_EVENT_VALUE_CHANGED + if(!translate_event(e, hasp_event_id)) return; // Use LV_EVENT_VALUE_CHANGED /* Get the new value */ char buffer[128]; uint16_t val = 0; - val = lv_btnmatrix_get_active_btn(obj); + // val = lv_btnmatrix_get_active_btn(obj); if(val != LV_BTNMATRIX_BTN_NONE) { const char* txt = lv_btnmatrix_get_btn_text(obj, val); strncpy(buffer, txt, sizeof(buffer)); @@ -591,7 +647,7 @@ void btnmatrix_event_handler(lv_obj_t* obj, lv_event_t event) // if(max > 0) // max a cannot be 0, its the divider // if(hasp_event_id == HASP_EVENT_UP || hasp_event_id == LV_EVENT_VALUE_CHANGED) { - // event_update_group(obj->user_data.groupid, obj, last_value_sent, 0, max); + // event_update_group(user_data->groupid, obj, last_value_sent, 0, max); // } } @@ -600,22 +656,25 @@ void btnmatrix_event_handler(lv_obj_t* obj, lv_event_t event) * @param obj pointer to a dropdown list or roller * @param event type of event that occured */ -void msgbox_event_handler(lv_obj_t* obj, lv_event_t event) +void msgbox_event_handler(lv_event_t* e) { + lv_event_code_t event = lv_event_get_code(e); + lv_obj_t* obj = lv_event_get_current_target(e); + log_event("msgbox", event); uint8_t hasp_event_id; - if(!translate_event(obj, event, hasp_event_id)) return; // Use LV_EVENT_VALUE_CHANGED + if(!translate_event(e, hasp_event_id)) return; // Use LV_EVENT_VALUE_CHANGED /* Get the new value */ char buffer[128]; uint16_t val = 0; - val = lv_msgbox_get_active_btn(obj); + // val = lv_msgbox_get_active_btn(obj); if(val != LV_BTNMATRIX_BTN_NONE) { const char* txt = lv_msgbox_get_active_btn_text(obj); strncpy(buffer, txt, sizeof(buffer)); - if(hasp_event_id == HASP_EVENT_UP || hasp_event_id == HASP_EVENT_RELEASE) lv_msgbox_start_auto_close(obj, 0); + if(hasp_event_id == HASP_EVENT_UP || hasp_event_id == HASP_EVENT_RELEASE) lv_msgbox_close(obj); } else { buffer[0] = 0; // empty string } @@ -624,7 +683,7 @@ void msgbox_event_handler(lv_obj_t* obj, lv_event_t event) last_value_sent = val; event_object_selection_changed(obj, hasp_event_id, val, buffer); - // if(max > 0) event_update_group(obj->user_data.groupid, obj, val, 0, max); + // if(max > 0) event_update_group(user_data->groupid, obj, val, 0, max); } /** @@ -632,28 +691,30 @@ void msgbox_event_handler(lv_obj_t* obj, lv_event_t event) * @param obj pointer to a slider * @param event type of event that occured */ -void slider_event_handler(lv_obj_t* obj, lv_event_t event) +void slider_event_handler(lv_event_t* e) { + lv_event_code_t event = lv_event_get_code(e); + lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e); + log_event("slider", event); uint8_t hasp_event_id; - if(!translate_event(obj, event, hasp_event_id) || event == LV_EVENT_VALUE_CHANGED) return; + if(!translate_event(e, hasp_event_id) || event == LV_EVENT_VALUE_CHANGED) return; /* Get the new value */ int16_t val; int16_t min; int16_t max; - if(obj->user_data.objid == LV_HASP_SLIDER) { + lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data; + if(user_data->objid == LV_HASP_SLIDER) { val = lv_slider_get_value(obj); min = lv_slider_get_min_value(obj); max = lv_slider_get_max_value(obj); - - } else if(obj->user_data.objid == LV_HASP_ARC) { + } else if(user_data->objid == LV_HASP_ARC) { val = lv_arc_get_value(obj); min = lv_arc_get_min_value(obj); max = lv_arc_get_max_value(obj); - } else { return; // not a slider } @@ -663,8 +724,8 @@ void slider_event_handler(lv_obj_t* obj, lv_event_t event) last_value_sent = val; event_object_val_event(obj, hasp_event_id, val); - if(obj->user_data.groupid && (hasp_event_id == HASP_EVENT_CHANGED || hasp_event_id == HASP_EVENT_UP) && min != max) - event_update_group(obj->user_data.groupid, obj, !!val, val, min, max); + if(user_data->groupid && (hasp_event_id == HASP_EVENT_CHANGED || hasp_event_id == HASP_EVENT_UP) && min != max) + event_update_group(user_data->groupid, obj, !!val, val, min, max); } /** @@ -672,12 +733,15 @@ void slider_event_handler(lv_obj_t* obj, lv_event_t event) * @param obj pointer to a color picker * @param event type of event that occured */ -void cpicker_event_handler(lv_obj_t* obj, lv_event_t event) +void cpicker_event_handler(lv_event_t* e) { + lv_event_code_t event = lv_event_get_code(e); + lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e); + log_event("cpicker", event); uint8_t hasp_event_id; - if(!translate_event(obj, event, hasp_event_id) || event == LV_EVENT_VALUE_CHANGED) return; + if(!translate_event(e, hasp_event_id) || event == LV_EVENT_VALUE_CHANGED) return; /* Get the new value */ lv_color_t color = lv_cpicker_get_color(obj); @@ -696,23 +760,26 @@ void cpicker_event_handler(lv_obj_t* obj, lv_event_t event) eventname, c32.ch.red, c32.ch.green, c32.ch.blue, c32.ch.red, c32.ch.green, c32.ch.blue); event_send_object_data(obj, data); - // event_update_group(obj->user_data.groupid, obj, val, min, max); + // event_update_group(user_data->groupid, obj, val, min, max); } -void calendar_event_handler(lv_obj_t* obj, lv_event_t event) +void calendar_event_handler(lv_event_t* e) { + lv_event_code_t event = lv_event_get_code(e); + lv_obj_t* obj = (lv_obj_t*)lv_event_get_target(e); + log_event("calendar", event); uint8_t hasp_event_id; if(event != LV_EVENT_PRESSED && event != LV_EVENT_RELEASED && event != LV_EVENT_VALUE_CHANGED) return; - if(!translate_event(obj, event, hasp_event_id)) return; // Use LV_EVENT_VALUE_CHANGED + if(!translate_event(e, hasp_event_id)) return; // Use LV_EVENT_VALUE_CHANGED /* Get the new value */ lv_calendar_date_t* date; if(hasp_event_id == HASP_EVENT_CHANGED) - date = lv_calendar_get_pressed_date(obj); // pressed date + lv_calendar_get_pressed_date(obj, date); // pressed date else - date = lv_calendar_get_showed_date(obj); // current month + date = (lv_calendar_date_t*)lv_calendar_get_showed_date(obj); // current month if(!date) return; lv_style_int_t val = date->day + date->month * 31; @@ -728,5 +795,5 @@ void calendar_event_handler(lv_obj_t* obj, lv_event_t event) eventname, date->day, date->year, date->month, date->day); event_send_object_data(obj, data); - // event_update_group(obj->user_data.groupid, obj, val, min, max); + // event_update_group(user_data->groupid, obj, val, min, max); } \ No newline at end of file diff --git a/src/hasp/hasp_event.h b/src/hasp/hasp_event.h index 1a2864ab..6ff66c77 100644 --- a/src/hasp/hasp_event.h +++ b/src/hasp/hasp_event.h @@ -11,20 +11,22 @@ #define HASP_NUM_PAGE_BACK (HASP_NUM_PAGES + 2) #define HASP_NUM_PAGE_NEXT (HASP_NUM_PAGES + 3) +#define lv_task_t lv_timer_t + // Timer event Handlers void event_timer_calendar(lv_task_t* task); void event_timer_clock(lv_task_t* task); // Object event Handlers -void delete_event_handler(lv_obj_t* obj, lv_event_t event); -void wakeup_event_handler(lv_obj_t* obj, lv_event_t event); -void generic_event_handler(lv_obj_t* obj, lv_event_t event); -void toggle_event_handler(lv_obj_t* obj, lv_event_t event); -void slider_event_handler(lv_obj_t* obj, lv_event_t event); -void selector_event_handler(lv_obj_t* obj, lv_event_t event); -void btnmatrix_event_handler(lv_obj_t* obj, lv_event_t event); -void msgbox_event_handler(lv_obj_t* obj, lv_event_t event); -void cpicker_event_handler(lv_obj_t* obj, lv_event_t event); -void calendar_event_handler(lv_obj_t* obj, lv_event_t event); +void delete_event_handler(lv_event_t* e); +void wakeup_event_handler(lv_event_t* e); +void generic_event_handler(lv_event_t* e); +void toggle_event_handler(lv_event_t* e); +void slider_event_handler(lv_event_t* e); +void selector_event_handler(lv_event_t* e); +void btnmatrix_event_handler(lv_event_t* e); +void msgbox_event_handler(lv_event_t* e); +void cpicker_event_handler(lv_event_t* e); +void calendar_event_handler(lv_event_t* e); #endif // HASP_EVENT_H \ No newline at end of file diff --git a/src/hasp/hasp_object.cpp b/src/hasp/hasp_object.cpp index 3751a239..461ebd9c 100644 --- a/src/hasp/hasp_object.cpp +++ b/src/hasp/hasp_object.cpp @@ -22,16 +22,34 @@ const char* msgbox_default_map[] = {"OK", ""}; // memory pointer to hasp default // ##################### Object Finders ######################################################## +static inline uint8_t hasp_get_id(const lv_obj_t* obj) +{ + if(!obj || !obj->user_data) return 0; + return ((lv_obj_user_data_t*)obj->user_data)->id; +} + +static inline uint8_t hasp_get_objid(const lv_obj_t* obj) +{ + if(!obj || !obj->user_data) return 0; + return ((lv_obj_user_data_t*)obj->user_data)->objid; +} + +static inline uint8_t hasp_get_groupid(const lv_obj_t* obj) +{ + if(!obj || !obj->user_data) return 0; + return ((lv_obj_user_data_t*)obj->user_data)->groupid; +} + // Return a child object from a parent with a specific objid lv_obj_t* hasp_find_obj_from_parent_id(lv_obj_t* parent, uint8_t objid) { if(objid == 0 || parent == nullptr) return parent; - lv_obj_t* child; - child = lv_obj_get_child(parent, NULL); - while(child) { + for(uint32_t i = 0; i < lv_obj_get_child_cnt(parent); i++) { + lv_obj_t* child = lv_obj_get_child(parent, i); + /* child found, return it */ - if(objid == child->user_data.id) return child; + if(objid == hasp_get_id(child)) return child; /* check grandchildren */ lv_obj_t* grandchild = hasp_find_obj_from_parent_id(child, objid); @@ -39,21 +57,19 @@ lv_obj_t* hasp_find_obj_from_parent_id(lv_obj_t* parent, uint8_t objid) /* check tabs */ if(obj_check_type(child, LV_HASP_TABVIEW)) { - 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.objid && objid == tab->user_data.objid) return tab; /* tab found, return it */ + // 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 && objid == hasp_get_objid(tab)) 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 */ - } + // /* check grandchildren */ + // grandchild = hasp_find_obj_from_parent_id(tab, objid); + // if(grandchild) return grandchild; /* grandchild found, return it */ + // } } - - /* try next sibling */ - child = lv_obj_get_child(parent, child); } + return NULL; } @@ -67,8 +83,8 @@ lv_obj_t* hasp_find_obj_from_page_id(uint8_t pageid, uint8_t objid) bool hasp_find_id_from_obj(const lv_obj_t* obj, uint8_t* pageid, uint8_t* objid) { if(!obj || !haspPages.get_id(obj, pageid)) return false; - if(obj->user_data.id == 0 && obj != haspPages.get_obj(*pageid)) return false; - *objid = obj->user_data.id; + if(hasp_get_id(obj) == 0 && obj != haspPages.get_obj(*pageid)) return false; + *objid = hasp_get_id(obj); return true; } @@ -78,32 +94,28 @@ void hasp_object_tree(const lv_obj_t* parent, uint8_t pageid, uint16_t level) /* Output parent info */ char indent[31]; - memset(indent, 32, 31); + memset(indent, 0x20, 31); if(level < 15) indent[level * 2] = 0; indent[30] = 0; - LOG_VERBOSE(TAG_HASP, F("%s- " HASP_OBJECT_NOTATION ": %s"), indent, pageid, parent->user_data.id, + LOG_VERBOSE(TAG_HASP, F("%s- " HASP_OBJECT_NOTATION ": %s"), indent, pageid, hasp_get_id(parent), obj_get_type_name(parent)); - lv_obj_t* child; - child = lv_obj_get_child(parent, NULL); - while(child) { - /* child found, process it */ + uint32_t i; + for(i = 0; i < lv_obj_get_child_cnt(parent); i++) { + lv_obj_t* child = lv_obj_get_child(parent, i); hasp_object_tree(child, pageid, level + 1); - - /* try next sibling */ - child = lv_obj_get_child(parent, child); } /* check tabs */ if(obj_check_type(parent, LV_HASP_TABVIEW)) { #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(parent, i); - LOG_VERBOSE(TAG_HASP, "Found tab %i", i); - if(tab->user_data.objid) hasp_object_tree(tab, pageid, level + 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(parent, i); + // LOG_VERBOSE(TAG_HASP, "Found tab %i", i); + // if(tab->user_data.objid) hasp_object_tree(tab, pageid, level + 1); + // } #endif } } @@ -126,23 +138,22 @@ void object_set_group_values(lv_obj_t* parent, hasp_update_value_t& value) if(parent == nullptr) return; // Update object if it's in the same group - if(value.group == parent->user_data.groupid && value.obj != parent) { - attribute_set_normalized_value(parent, value); + if(value.group == hasp_get_groupid(parent) && value.obj != parent) { + // attribute_set_normalized_value(parent, value); } /* check tabs */ if(obj_get_type(parent) == LV_HASP_TABVIEW) { - 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(parent, i); - object_set_group_values(tab, value); - } + // 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(parent, i); + // object_set_group_values(tab, value); + // } } else { - lv_obj_t* child; - child = lv_obj_get_child(parent, NULL); - while(child) { + uint32_t i; + for(i = 0; i < lv_obj_get_child_cnt(parent); i++) { + lv_obj_t* child = lv_obj_get_child(parent, i); object_set_group_values(child, value); - child = lv_obj_get_child(parent, child); } } } @@ -205,7 +216,7 @@ static inline int hasp_parse_json_attributes(lv_obj_t* obj, const JsonObject& do return i; } -static void object_add_task(lv_obj_t* obj, uint8_t pageid, uint8_t objid, lv_task_cb_t task_xcb, uint16_t interval) +static void object_add_task(lv_obj_t* obj, uint8_t pageid, uint8_t objid, lv_timer_cb_t task_xcb, uint16_t interval) { hasp_task_user_data_t* user_data = (hasp_task_user_data_t*)lv_mem_alloc(sizeof(hasp_task_user_data_t)); if(!user_data) return; @@ -213,10 +224,29 @@ static void object_add_task(lv_obj_t* obj, uint8_t pageid, uint8_t objid, lv_tas user_data->pageid = pageid; user_data->objid = objid; user_data->interval = interval; - lv_task_t* task = lv_task_create(task_xcb, 25, LV_TASK_PRIO_LOWEST, (void*)user_data); + lv_timer_t* task = lv_timer_create(task_xcb, 25, (void*)user_data); (void)task; // unused } +bool object_set_user_data(lv_obj_t* obj, uint8_t id, uint8_t objid) +{ + if(!obj) return false; + + if(!obj->user_data) obj->user_data = (lv_obj_user_data_t*)lv_mem_alloc(sizeof(lv_obj_user_data_t)); + if(!obj->user_data) return false; + + /* id tag the object */ + lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data; + user_data->id = id; + user_data->objid = objid; + user_data->transitionid = 0; + user_data->actionid = 0; + user_data->groupid = 0; + user_data->swipeid = 0; + + return true; +} + /** * Create a new object according to the json config * @param config Json representation for this object @@ -279,63 +309,70 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id) config.remove(FPSTR(FP_OBJID)); } - switch(sdbm) { - /* ----- Basic Objects ------ */ - case LV_HASP_BTNMATRIX: - case HASP_OBJ_BTNMATRIX: - obj = lv_btnmatrix_create(parent_obj, NULL); - if(obj) { - lv_btnmatrix_set_recolor(obj, true); - lv_obj_set_event_cb(obj, btnmatrix_event_handler); + uint8_t objid = 0; - lv_btnmatrix_ext_t* ext = (lv_btnmatrix_ext_t*)lv_obj_get_ext_attr(obj); - btnmatrix_default_map = ext->map_p; // store the static pointer to the default lvgl btnmap - obj->user_data.objid = LV_HASP_BTNMATRIX; - } - break; + switch(sdbm) { + /* ----- Basic Objects ------ */ + // case LV_HASP_BTNMATRIX: + // case HASP_OBJ_BTNMATRIX: + // objid = LV_HASP_BTNMATRIX; + // obj = lv_btnmatrix_create(parent_obj); + // if(obj) { + // lv_btnmatrix_set_recolor(obj, true); + // lv_obj_set_event_cb(obj, btnmatrix_event_handler); + + // lv_btnmatrix_ext_t* ext = (lv_btnmatrix_ext_t*)lv_obj_get_ext_attr(obj); + // btnmatrix_default_map = ext->map_p; // store the static pointer to the default lvgl btnmap + // // obj->user_data.objid = LV_HASP_BTNMATRIX; + // } + // break; case LV_HASP_TABLE: case HASP_OBJ_TABLE: - obj = lv_table_create(parent_obj, NULL); + objid = LV_HASP_TABLE; + obj = lv_table_create(parent_obj); if(obj) { lv_obj_set_event_cb(obj, selector_event_handler); - obj->user_data.objid = LV_HASP_TABLE; + // obj->user_data.objid = LV_HASP_TABLE; } break; case LV_HASP_BUTTON: case HASP_OBJ_BTN: - obj = lv_btn_create(parent_obj, NULL); + objid = LV_HASP_BUTTON; + obj = lv_btn_create(parent_obj); if(obj) { - lv_obj_t* lbl = lv_label_create(obj, NULL); + lv_obj_t* lbl = lv_label_create(obj); if(lbl) { lv_label_set_text(lbl, ""); lv_label_set_recolor(lbl, true); - lbl->user_data.objid = LV_HASP_LABEL; - lv_obj_align(lbl, NULL, LV_ALIGN_CENTER, 0, 0); + object_set_user_data(lbl, 0, LV_HASP_LABEL); + lv_obj_align(lbl, LV_ALIGN_CENTER, 0, 0); } lv_obj_set_event_cb(obj, generic_event_handler); - obj->user_data.objid = LV_HASP_BUTTON; + // obj->user_data.objid = LV_HASP_BUTTON; } break; case LV_HASP_CHECKBOX: case HASP_OBJ_CHECKBOX: - obj = lv_checkbox_create(parent_obj, NULL); + objid = LV_HASP_CHECKBOX; + obj = lv_checkbox_create(parent_obj); if(obj) { lv_obj_set_event_cb(obj, toggle_event_handler); - obj->user_data.objid = LV_HASP_CHECKBOX; + // obj->user_data.objid = LV_HASP_CHECKBOX; } break; case LV_HASP_LABEL: case HASP_OBJ_LABEL: - obj = lv_label_create(parent_obj, NULL); + objid = LV_HASP_LABEL; + obj = lv_label_create(parent_obj); if(obj) { - lv_label_set_long_mode(obj, LV_LABEL_LONG_CROP); + lv_label_set_long_mode(obj, LV_LABEL_LONG_CLIP); lv_label_set_recolor(obj, true); lv_obj_set_event_cb(obj, generic_event_handler); - obj->user_data.objid = LV_HASP_LABEL; + // obj->user_data.objid = LV_HASP_LABEL; // object_add_task(obj, pageid, id, event_timer_clock, 1000); } @@ -343,52 +380,58 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id) case LV_HASP_IMAGE: case HASP_OBJ_IMG: - obj = lv_img_create(parent_obj, NULL); + objid = LV_HASP_IMAGE; + obj = lv_img_create(parent_obj); if(obj) { lv_obj_set_event_cb(obj, generic_event_handler); - obj->user_data.objid = LV_HASP_IMAGE; + // obj->user_data.objid = LV_HASP_IMAGE; } break; case LV_HASP_ARC: case HASP_OBJ_ARC: - obj = lv_arc_create(parent_obj, NULL); + objid = LV_HASP_ARC; + obj = lv_arc_create(parent_obj); if(obj) { lv_obj_set_event_cb(obj, generic_event_handler); - obj->user_data.objid = LV_HASP_ARC; + // obj->user_data.objid = LV_HASP_ARC; } break; case LV_HASP_CONTAINER: case HASP_OBJ_CONT: - obj = lv_cont_create(parent_obj, NULL); + objid = LV_HASP_CONTAINER; + obj = lv_cont_create(parent_obj); if(obj) { lv_obj_set_event_cb(obj, generic_event_handler); - obj->user_data.objid = LV_HASP_CONTAINER; + // obj->user_data.objid = LV_HASP_CONTAINER; } break; case LV_HASP_OBJECT: case HASP_OBJ_OBJ: - obj = lv_obj_create(parent_obj, NULL); + objid = LV_HASP_OBJECT; + obj = lv_obj_create(parent_obj); if(obj) { lv_obj_set_event_cb(obj, generic_event_handler); - obj->user_data.objid = LV_HASP_OBJECT; + // obj->user_data.objid = LV_HASP_OBJECT; } break; case LV_HASP_PAGE: case HASP_OBJ_PAGE: - obj = lv_page_create(parent_obj, NULL); - if(obj) obj->user_data.objid = LV_HASP_PAGE; + objid = LV_HASP_PAGE; + obj = lv_page_create(parent_obj); + // if(obj) obj->user_data.objid = LV_HASP_PAGE; // No event handler for pages break; #if LV_USE_WIN && LVGL_VERSION_MAJOR == 7 case LV_HASP_WINDOW: case HASP_OBJ_WIN: - obj = lv_win_create(parent_obj, NULL); - if(obj) obj->user_data.objid = LV_HASP_WINDOW; + objid = LV_HASP_WINDOW; + obj = lv_win_create(parent_obj); + // if(obj) obj->user_data.objid = LV_HASP_WINDOW; // No event handler for pages break; @@ -397,65 +440,72 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id) #if LVGL_VERSION_MAJOR == 8 case LV_HASP_LED: case HASP_OBJ_LED: - obj = lv_led_create(parent_obj); + objid = LV_HASP_LED; + obj = lv_led_create(parent_obj); if(obj) { lv_obj_set_event_cb(obj, generic_event_handler); - obj->user_data.objid = LV_HASP_LED; + // obj->user_data.objid = LV_HASP_LED; } break; case LV_HASP_TILEVIEW: case HASP_OBJ_TILEVIEW: - obj = lv_tileview_create(parent_obj); - if(obj) obj->user_data.objid = LV_HASP_TILEVIEW; + objid = LV_HASP_TILEVIEW; + obj = lv_tileview_create(parent_obj); + // if(obj) obj->user_data.objid = LV_HASP_TILEVIEW; // No event handler for tileviews break; case LV_HASP_TABVIEW: case HASP_OBJ_TABVIEW: - obj = lv_tabview_create(parent_obj, LV_DIR_TOP, 100); + objid = LV_HASP_TABVIEW; + obj = lv_tabview_create(parent_obj, LV_DIR_TOP, 100); // No event handler for tabs if(obj) { lv_obj_set_event_cb(obj, selector_event_handler); - obj->user_data.objid = LV_HASP_TABVIEW; + // obj->user_data.objid = LV_HASP_TABVIEW; } break; #else case LV_HASP_LED: case HASP_OBJ_LED: - obj = lv_led_create(parent_obj, NULL); + objid = LV_HASP_LED; + obj = lv_led_create(parent_obj); if(obj) { lv_obj_set_event_cb(obj, generic_event_handler); - obj->user_data.objid = LV_HASP_LED; + // obj->user_data.objid = LV_HASP_LED; } break; case LV_HASP_TILEVIEW: case HASP_OBJ_TILEVIEW: - obj = lv_tileview_create(parent_obj, NULL); - if(obj) obj->user_data.objid = LV_HASP_TILEVIEW; + objid = LV_HASP_TILEVIEW; + obj = lv_tileview_create(parent_obj); + // if(obj) obj->user_data.objid = LV_HASP_TILEVIEW; // No event handler for tileviews break; case LV_HASP_TABVIEW: case HASP_OBJ_TABVIEW: - obj = lv_tabview_create(parent_obj, NULL); + objid = LV_HASP_TABVIEW; + obj = lv_tabview_create(parent_obj); // No event handler for tabs if(obj) { lv_obj_set_event_cb(obj, selector_event_handler); - obj->user_data.objid = LV_HASP_TABVIEW; + // obj->user_data.objid = LV_HASP_TABVIEW; } break; case LV_HASP_TAB: case HASP_OBJ_TAB: + objid = LV_HASP_TAB; if(parent_obj && parent_obj->user_data.objid == LV_HASP_TABVIEW) { obj = lv_tabview_add_tab(parent_obj, "Tab"); if(obj) { lv_obj_set_event_cb(obj, generic_event_handler); - obj->user_data.objid = LV_HASP_TAB; + // obj->user_data.objid = LV_HASP_TAB; } } else { LOG_WARNING(TAG_HASP, F("Parent of a tab must be a tabview object")); @@ -467,19 +517,21 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id) /* ----- Color Objects ------ */ case LV_HASP_CPICKER: case HASP_OBJ_CPICKER: - obj = lv_cpicker_create(parent_obj, NULL); + objid = LV_HASP_CPICKER; + obj = lv_colorwheel_create(parent_obj, true); if(obj) { lv_obj_set_event_cb(obj, cpicker_event_handler); - obj->user_data.objid = LV_HASP_CPICKER; + // obj->user_data.objid = LV_HASP_CPICKER; } break; #if LV_USE_SPINNER != 0 case LV_HASP_SPINNER: case HASP_OBJ_SPINNER: - obj = lv_spinner_create(parent_obj, NULL); + objid = LV_HASP_SPINNER; + obj = lv_spinner_create(parent_obj, 2000, 90); if(obj) { - obj->user_data.objid = LV_HASP_SPINNER; + // obj->user_data.objid = LV_HASP_SPINNER; lv_obj_set_event_cb(obj, generic_event_handler); } break; @@ -488,150 +540,163 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id) /* ----- Range Objects ------ */ case LV_HASP_SLIDER: case HASP_OBJ_SLIDER: - obj = lv_slider_create(parent_obj, NULL); + objid = LV_HASP_SLIDER; + obj = lv_slider_create(parent_obj); if(obj) { lv_slider_set_range(obj, 0, 100); lv_obj_set_event_cb(obj, slider_event_handler); - obj->user_data.objid = LV_HASP_SLIDER; + // obj->user_data.objid = LV_HASP_SLIDER; } // bool knobin = config[F("knobin")].as() | true; // lv_slider_set_knob_in(obj, knobin); break; - case LV_HASP_GAUGE: - case HASP_OBJ_GAUGE: - obj = lv_gauge_create(parent_obj, NULL); - if(obj) { - lv_gauge_set_range(obj, 0, 100); - lv_obj_set_event_cb(obj, generic_event_handler); - obj->user_data.objid = LV_HASP_GAUGE; - } - break; + // case LV_HASP_GAUGE: + // case HASP_OBJ_GAUGE: + // objid = LV_HASP_GAUGE; + // obj = lv_gauge_create(parent_obj); + // if(obj) { + // lv_gauge_set_range(obj, 0, 100); + // lv_obj_set_event_cb(obj, generic_event_handler); + // // obj->user_data.objid = LV_HASP_GAUGE; + // } + // break; case LV_HASP_LINE: case HASP_OBJ_LINE: - obj = lv_line_create(parent_obj, NULL); + objid = LV_HASP_LINE; + obj = lv_line_create(parent_obj); if(obj) { lv_obj_set_event_cb(obj, delete_event_handler); - obj->user_data.objid = LV_HASP_LINE; + // obj->user_data.objid = LV_HASP_LINE; } break; case LV_HASP_BAR: case HASP_OBJ_BAR: - obj = lv_bar_create(parent_obj, NULL); + objid = LV_HASP_BAR; + obj = lv_bar_create(parent_obj); if(obj) { lv_bar_set_range(obj, 0, 100); lv_obj_set_event_cb(obj, generic_event_handler); - obj->user_data.objid = LV_HASP_BAR; + // obj->user_data.objid = LV_HASP_BAR; } break; - case LV_HASP_LINEMETER: - case HASP_OBJ_LMETER: // obsolete - case HASP_OBJ_LINEMETER: - obj = lv_linemeter_create(parent_obj, NULL); - if(obj) { - lv_linemeter_set_range(obj, 0, 100); - lv_obj_set_event_cb(obj, generic_event_handler); - obj->user_data.objid = LV_HASP_LINEMETER; - } - break; + // case LV_HASP_LINEMETER: + // case HASP_OBJ_LMETER: // obsolete + // case HASP_OBJ_LINEMETER: + // objid = LV_HASP_LINEMETER; + // obj = lv_linemeter_create(parent_obj); + // if(obj) { + // lv_linemeter_set_range(obj, 0, 100); + // lv_obj_set_event_cb(obj, generic_event_handler); + // // obj->user_data.objid = LV_HASP_LINEMETER; + // } + // break; case LV_HASP_SPINBOX: case HASP_OBJ_SPINBOX: - obj = lv_spinbox_create(parent_obj, NULL); + objid = LV_HASP_SPINBOX; + obj = lv_spinbox_create(parent_obj); if(obj) { lv_spinbox_set_range(obj, 0, 100); lv_obj_set_event_cb(obj, slider_event_handler); - obj->user_data.objid = LV_HASP_SPINBOX; + // obj->user_data.objid = LV_HASP_SPINBOX; } break; case LV_HASP_LIST: case HASP_OBJ_LIST: - obj = lv_list_create(parent_obj, NULL); + objid = LV_HASP_LIST; + obj = lv_list_create(parent_obj); if(obj) { // Callbacks are set on the individual buttons - obj->user_data.objid = LV_HASP_LIST; + // obj->user_data.objid = LV_HASP_LIST; } break; - case LV_HASP_CHART: - case HASP_OBJ_CHART: - obj = lv_chart_create(parent_obj, NULL); - if(obj) { - lv_chart_set_range(obj, 0, 100); - lv_obj_set_event_cb(obj, generic_event_handler); + // case LV_HASP_CHART: + // case HASP_OBJ_CHART: + // objid = LV_HASP_CHART; + // obj = lv_chart_create(parent_obj); + // if(obj) { + // lv_chart_set_range(obj, 0, 100); + // lv_obj_set_event_cb(obj, generic_event_handler); - lv_chart_add_series(obj, LV_COLOR_RED); - lv_chart_add_series(obj, LV_COLOR_GREEN); - lv_chart_add_series(obj, LV_COLOR_BLUE); + // lv_chart_add_series(obj, LV_COLOR_RED); + // lv_chart_add_series(obj, LV_COLOR_GREEN); + // lv_chart_add_series(obj, LV_COLOR_BLUE); - lv_chart_series_t* ser = my_chart_get_series(obj, 2); - lv_chart_set_next(obj, ser, 10); - lv_chart_set_next(obj, ser, 20); - lv_chart_set_next(obj, ser, 30); - lv_chart_set_next(obj, ser, 40); + // lv_chart_series_t* ser = my_chart_get_series(obj, 2); + // lv_chart_set_next(obj, ser, 10); + // lv_chart_set_next(obj, ser, 20); + // lv_chart_set_next(obj, ser, 30); + // lv_chart_set_next(obj, ser, 40); - obj->user_data.objid = LV_HASP_CHART; - } - break; + // // obj->user_data.objid = LV_HASP_CHART; + // } + // break; /* ----- On/Off Objects ------ */ case LV_HASP_SWITCH: case HASP_OBJ_SWITCH: - obj = lv_switch_create(parent_obj, NULL); + objid = LV_HASP_SWITCH; + obj = lv_switch_create(parent_obj); if(obj) { lv_obj_set_event_cb(obj, toggle_event_handler); - obj->user_data.objid = LV_HASP_SWITCH; + // obj->user_data.objid = LV_HASP_SWITCH; } break; - /* ----- List Object ------- */ + /* ----- Dropdown Object ------- */ case LV_HASP_DROPDOWN: case HASP_OBJ_DROPDOWN: - obj = lv_dropdown_create(parent_obj, NULL); + objid = LV_HASP_DROPDOWN; + obj = lv_dropdown_create(parent_obj); if(obj) { lv_dropdown_set_draw_arrow(obj, true); // lv_dropdown_set_anim_time(obj, 200); lv_obj_set_top(obj, true); - // lv_obj_align(obj, NULL, LV_ALIGN_IN_TOP_MID, 0, 20); + // // lv_obj_align(obj, NULL, LV_ALIGN_IN_TOP_MID, 0, 20); lv_obj_set_event_cb(obj, selector_event_handler); - obj->user_data.objid = LV_HASP_DROPDOWN; + // obj->user_data.objid = LV_HASP_DROPDOWN; } break; case LV_HASP_ROLLER: case HASP_OBJ_ROLLER: - obj = lv_roller_create(parent_obj, NULL); - // lv_obj_align(obj, NULL, LV_ALIGN_IN_TOP_MID, 0, 20); + objid = LV_HASP_ROLLER; + obj = lv_roller_create(parent_obj); + // // lv_obj_align(obj, NULL, LV_ALIGN_IN_TOP_MID, 0, 20); if(obj) { lv_roller_set_auto_fit(obj, false); lv_obj_set_event_cb(obj, selector_event_handler); - obj->user_data.objid = LV_HASP_ROLLER; + // obj->user_data.objid = LV_HASP_ROLLER; } break; - case LV_HASP_MSGBOX: - case HASP_OBJ_MSGBOX: - obj = lv_msgbox_create(parent_obj, NULL); - if(obj) { - lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0); - lv_obj_set_auto_realign(obj, true); - lv_obj_set_event_cb(obj, msgbox_event_handler); - if(msgbox_default_map) lv_msgbox_add_btns(obj, msgbox_default_map); - obj->user_data.objid = LV_HASP_MSGBOX; - } - break; + // case LV_HASP_MSGBOX: + // case HASP_OBJ_MSGBOX: + // objid = LV_HASP_MSGBOX; + // obj = lv_msgbox_create(parent_obj); + // if(obj) { + // // lv_obj_align(obj, NULL, LV_ALIGN_CENTER, 0, 0); + // lv_obj_set_auto_realign(obj, true); + // lv_obj_set_event_cb(obj, msgbox_event_handler); + // if(msgbox_default_map) lv_msgbox_add_btns(obj, msgbox_default_map); + // // obj->user_data.objid = LV_HASP_MSGBOX; + // } + // break; case LV_HASP_CALENDER: case HASP_OBJ_CALENDAR: - obj = lv_calendar_create(parent_obj, NULL); - // lv_obj_align(obj, NULL, LV_ALIGN_IN_TOP_MID, 0, 20); + objid = LV_HASP_CALENDER; + obj = lv_calendar_create(parent_obj); + // // lv_obj_align(obj, NULL, LV_ALIGN_IN_TOP_MID, 0, 20); if(obj) { lv_obj_set_event_cb(obj, calendar_event_handler); - obj->user_data.objid = LV_HASP_CALENDER; + // obj->user_data.objid = LV_HASP_CALENDER; object_add_task(obj, pageid, id, event_timer_calendar, 5000); } @@ -650,16 +715,15 @@ void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id) // Prevent losing press when the press is slid out of the objects. // (E.g. a Button can be released out of it if it was being pressed) - lv_obj_add_protect(obj, LV_PROTECT_PRESS_LOST); - lv_obj_set_gesture_parent(obj, false); + // V8 lv_obj_add_protect(obj, LV_PROTECT_PRESS_LOST); + // V8 lv_obj_set_gesture_parent(obj, false); - /* id tag the object */ - obj->user_data.id = id; + if(!object_set_user_data(obj, id, objid)) return; +#ifdef HASP_DEBUG uint8_t temp; // needed for debug tests (void)temp; -#ifdef HASP_DEBUG /** testing start **/ if(!hasp_find_id_from_obj(obj, &pageid, &temp)) { LOG_ERROR(TAG_HASP, F(D_OBJECT_LOST)); diff --git a/src/hasp/hasp_object.h b/src/hasp/hasp_object.h index 14836bb7..2f4991a6 100644 --- a/src/hasp/hasp_object.h +++ b/src/hasp/hasp_object.h @@ -78,6 +78,7 @@ enum lv_hasp_obj_type_t { }; void hasp_new_object(const JsonObject& config, uint8_t& saved_page_id); +bool object_set_user_data(lv_obj_t* obj, uint8_t id, uint8_t objid); lv_obj_t* hasp_find_obj_from_parent_id(lv_obj_t* parent, uint8_t objid); lv_obj_t* hasp_find_obj_from_page_id(uint8_t pageid, uint8_t objid); @@ -99,10 +100,14 @@ void object_set_normalized_group_values(hasp_update_value_t& value); */ inline const char* obj_get_type_name(const lv_obj_t* obj) { +#if LV_VERSION_CHECK(8, 0, 0) + return "unknown"; +#else lv_obj_type_t list; lv_obj_get_type(obj, &list); const char* objtype = list.type[0]; return objtype + 3; // skip lv_ +#endif } /** * Get the hasp object type of a given LVGL object @@ -112,7 +117,8 @@ inline const char* obj_get_type_name(const lv_obj_t* obj) */ inline lv_hasp_obj_type_t obj_get_type(const lv_obj_t* obj) { - return (lv_hasp_obj_type_t)obj->user_data.objid; + lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data; + return (lv_hasp_obj_type_t)user_data->objid; } /** * Check if an lvgl objecttype name corresponds to a given HASP object ID @@ -124,8 +130,9 @@ inline lv_hasp_obj_type_t obj_get_type(const lv_obj_t* obj) inline bool obj_check_type(const lv_obj_t* obj, lv_hasp_obj_type_t haspobjtype) { #if 1 - if(!obj) return false; - return obj->user_data.objid == (uint8_t)haspobjtype; + if(!obj || !obj->user_data) return false; + lv_obj_user_data_t* user_data = (lv_obj_user_data_t*)obj->user_data; + return user_data->objid == (uint8_t)haspobjtype; #else lv_obj_type_t list; lv_obj_get_type(obj, &list); diff --git a/src/hasp/hasp_page.cpp b/src/hasp/hasp_page.cpp index acc737c6..7efb1db8 100644 --- a/src/hasp/hasp_page.cpp +++ b/src/hasp/hasp_page.cpp @@ -31,9 +31,8 @@ void Page::init(uint8_t start_page) for(int i = 0; i < count(); i++) { lv_obj_t* prev_page_obj = _pages[i]; - - _pages[i] = lv_obj_create(NULL, NULL); - _pages[i]->user_data.objid = LV_HASP_SCREEN; + _pages[i] = lv_obj_create(NULL); + object_set_user_data(_pages[i], 0, LV_HASP_SCREEN); lv_obj_set_event_cb(_pages[i], generic_event_handler); /**< If the `indev` was pressing this object but swiped out while pressing do not search other object.*/ diff --git a/src/hasp/hasp_style.cpp b/src/hasp/hasp_style.cpp index bc4a78f7..5e07157d 100644 --- a/src/hasp/hasp_style.cpp +++ b/src/hasp/hasp_style.cpp @@ -1,6 +1,8 @@ /* MIT License - Copyright (c) 2019-2021 Francis Van Roie For full license information read the LICENSE file in the project folder */ +#if 0 + #include "hasp_attribute.h" /*To see all the hashes*/ static void set_style_attribute(lv_style_t * style, lv_state_t state, int16_t val) @@ -226,4 +228,6 @@ static void set_style_attribute(lv_style_t * style, lv_state_t state, int16_t va lv_style_set_scale_end_color(style, state, color); default:; } -} \ No newline at end of file +} + +#endif \ No newline at end of file diff --git a/src/hasp/lv_theme_hasp.c b/src/hasp/lv_theme_hasp.c index 1366e999..3a629cee 100644 --- a/src/hasp/lv_theme_hasp.c +++ b/src/hasp/lv_theme_hasp.c @@ -1,3 +1,5 @@ +#if 0 + /** * @file lv_theme_hasp.c * @@ -12,7 +14,7 @@ //#if LV_USE_THEME_HASP -#include "src/lv_misc/lv_gc.h" +#include "src/misc/lv_gc.h" #if defined(LV_GC_INCLUDE) #include LV_GC_INCLUDE @@ -199,7 +201,7 @@ typedef struct /********************** * STATIC PROTOTYPES **********************/ -static void theme_apply(lv_theme_t* th, lv_obj_t* obj, lv_theme_style_t name); +static void theme_apply(lv_theme_t* th, lv_obj_t* obj); static void style_init_reset(lv_style_t* style); /********************** @@ -228,206 +230,204 @@ static void basic_init(lv_style_int_t border_width, lv_style_int_t outline_width { // Objects with transparent background, like Checkbox, container style_init_reset(&styles->transparent); - lv_style_set_bg_opa(&styles->transparent, LV_STATE_DEFAULT, LV_OPA_TRANSP); - 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_bg_opa(&styles->transparent, LV_OPA_TRANSP); + lv_style_set_border_opa(&styles->transparent, LV_OPA_TRANSP); + lv_style_set_outline_opa(&styles->transparent, LV_OPA_TRANSP); + lv_style_set_value_color(&styles->transparent, color_scr_text); + lv_style_set_value_font(&styles->transparent, theme.font_subtitle); - if(!NO_FOCUS) lv_style_set_outline_width(&styles->transparent, LV_STATE_DEFAULT, outline_width); + if(!NO_FOCUS) lv_style_set_outline_width(&styles->transparent, outline_width); // Background gradient style_init_reset(&styles->pretty); - lv_style_set_radius(&styles->pretty, LV_STATE_DEFAULT, LV_DPI / 15); + lv_style_set_radius(&styles->pretty, LV_DPI / 15); - lv_style_set_bg_color(&styles->pretty, LV_STATE_DEFAULT, COLOR_SCR); - lv_style_set_bg_grad_color(&styles->pretty, LV_STATE_DEFAULT, COLOR_SCR_GRAD); - lv_style_set_bg_grad_dir(&styles->pretty, LV_STATE_DEFAULT, LV_GRAD_DIR_VER); - lv_style_set_bg_opa(&styles->pretty, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_bg_color(&styles->pretty, COLOR_SCR); + lv_style_set_bg_grad_color(&styles->pretty, COLOR_SCR_GRAD); + lv_style_set_bg_grad_dir(&styles->pretty, LV_GRAD_DIR_VER); + lv_style_set_bg_opa(&styles->pretty, LV_OPA_COVER); - lv_style_set_line_width(&styles->pretty, LV_STATE_DEFAULT, 1); - lv_style_set_line_color(&styles->pretty, LV_STATE_DEFAULT, lv_color_make(0x20, 0x20, 0x20)); + lv_style_set_line_width(&styles->pretty, 1); + lv_style_set_line_color(&styles->pretty, lv_color_make(0x20, 0x20, 0x20)); - lv_style_set_scale_end_line_width(&styles->pretty, LV_STATE_DEFAULT, 1); - lv_style_set_scale_end_color(&styles->pretty, LV_STATE_DEFAULT, theme.color_primary); + lv_style_set_scale_end_line_width(&styles->pretty, 1); + lv_style_set_scale_end_color(&styles->pretty, theme.color_primary); - lv_style_set_text_color(&styles->pretty, LV_STATE_DEFAULT, color_scr_text); - // lv_style_set_text_font(&styles->pretty, LV_STATE_DEFAULT, theme.font_normal); + lv_style_set_text_color(&styles->pretty, color_scr_text); + // lv_style_set_text_font(&styles->pretty, theme.font_normal); - 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_color(&styles->pretty, color_scr_text); + lv_style_set_value_font(&styles->pretty, theme.font_subtitle); - 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); - lv_style_set_border_color(&styles->pretty, LV_STATE_DEFAULT, BORDER_COLOR); - lv_style_set_border_color(&styles->pretty, LV_STATE_EDITED, lv_color_darken(theme.color_secondary, LV_OPA_30)); + lv_style_set_border_opa(&styles->pretty, LV_OPA_30); + lv_style_set_border_width(&styles->pretty, border_width); + lv_style_set_border_color(&styles->pretty, BORDER_COLOR); + lv_style_set_border_color(&styles->pretty, lv_color_darken(theme.color_secondary, LV_OPA_30)); - lv_style_set_outline_width(&styles->pretty, LV_STATE_DEFAULT, outline_width); + lv_style_set_outline_width(&styles->pretty, outline_width); if(!NO_FOCUS) { - lv_style_set_border_color(&styles->pretty, LV_STATE_FOCUSED, theme.color_secondary); - lv_style_set_border_width(&styles->pretty, LV_STATE_FOCUSED, outline_width); + lv_style_set_border_color(&styles->pretty, theme.color_secondary); + lv_style_set_border_width(&styles->pretty, outline_width); } style_init_reset(&styles->screen); lv_style_copy(&styles->screen, &styles->pretty); - lv_style_set_radius(&styles->screen, LV_STATE_DEFAULT, 0); + lv_style_set_radius(&styles->screen, 0); // Primary Colored gradient style_init_reset(&styles->pretty_color); - lv_style_set_radius(&styles->pretty_color, LV_STATE_DEFAULT, LV_DPI / 15); - lv_style_set_bg_color(&styles->pretty_color, LV_STATE_DEFAULT, COLOR_BG); - lv_style_set_bg_grad_color(&styles->pretty_color, LV_STATE_DEFAULT, COLOR_BG_GRAD); - lv_style_set_bg_grad_dir(&styles->pretty_color, LV_STATE_DEFAULT, LV_GRAD_DIR_VER); + lv_style_set_radius(&styles->pretty_color, LV_DPI / 15); + lv_style_set_bg_color(&styles->pretty_color, COLOR_BG); + lv_style_set_bg_grad_color(&styles->pretty_color, COLOR_BG_GRAD); + lv_style_set_bg_grad_dir(&styles->pretty_color, LV_GRAD_DIR_VER); - lv_style_set_bg_opa(&styles->pretty_color, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_line_width(&styles->pretty_color, LV_STATE_DEFAULT, 1); - lv_style_set_scale_end_line_width(&styles->pretty_color, LV_STATE_DEFAULT, 1); - lv_style_set_scale_end_color(&styles->pretty_color, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_text_color(&styles->pretty_color, LV_STATE_DEFAULT, color_scr_text); - lv_style_set_line_color(&styles->pretty_color, LV_STATE_DEFAULT, lv_color_make(0x20, 0x20, 0x20)); - // lv_style_set_text_font(&styles->pretty_color, LV_STATE_DEFAULT, theme.font_normal); + lv_style_set_bg_opa(&styles->pretty_color, LV_OPA_COVER); + lv_style_set_line_width(&styles->pretty_color, 1); + lv_style_set_scale_end_line_width(&styles->pretty_color, 1); + lv_style_set_scale_end_color(&styles->pretty_color, theme.color_primary); + lv_style_set_text_color(&styles->pretty_color, color_scr_text); + lv_style_set_line_color(&styles->pretty_color, lv_color_make(0x20, 0x20, 0x20)); + // lv_style_set_text_font(&styles->pretty_color, theme.font_normal); - lv_style_set_value_font(&styles->pretty_color, LV_STATE_DEFAULT, theme.font_subtitle); - lv_style_set_value_color(&styles->pretty_color, LV_STATE_DEFAULT, color_scr_text); + lv_style_set_value_font(&styles->pretty_color, theme.font_subtitle); + lv_style_set_value_color(&styles->pretty_color, color_scr_text); - 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); - lv_style_set_border_color(&styles->pretty_color, LV_STATE_DEFAULT, BORDER_COLOR); + lv_style_set_border_opa(&styles->pretty_color, LV_OPA_50); + lv_style_set_border_width(&styles->pretty_color, border_width); + lv_style_set_border_color(&styles->pretty_color, BORDER_COLOR); lv_style_set_border_color(&styles->pretty_color, LV_STATE_EDITED, lv_color_darken(theme.color_secondary, LV_OPA_30)); - lv_style_set_outline_width(&styles->pretty_color, LV_STATE_DEFAULT, outline_width); + lv_style_set_outline_width(&styles->pretty_color, outline_width); if(!NO_FOCUS) { - lv_style_set_border_color(&styles->pretty_color, LV_STATE_FOCUSED, theme.color_secondary); - lv_style_set_border_width(&styles->pretty_color, LV_STATE_FOCUSED, outline_width); + lv_style_set_border_color(&styles->pretty_color, theme.color_secondary); + lv_style_set_border_width(&styles->pretty_color, outline_width); } /* style_init_reset(&styles->bg_sec); lv_style_copy(&styles->bg_sec, &styles->pretty_color); - lv_style_set_bg_color(&styles->bg_sec, LV_STATE_DEFAULT, COLOR_BG_SEC); - lv_style_set_bg_grad_color(&styles->bg_sec, LV_STATE_DEFAULT, COLOR_BG_SEC_BORDER); - lv_style_set_bg_grad_dir(&styles->bg_sec, LV_STATE_DEFAULT, LV_GRAD_DIR_VER); + lv_style_set_bg_color(&styles->bg_sec, COLOR_BG_SEC); + lv_style_set_bg_grad_color(&styles->bg_sec, COLOR_BG_SEC_BORDER); + lv_style_set_bg_grad_dir(&styles->bg_sec, LV_GRAD_DIR_VER); - lv_style_set_border_color(&styles->bg_sec, LV_STATE_DEFAULT, COLOR_BG_BORDER); - lv_style_set_text_color(&styles->bg_sec, LV_STATE_DEFAULT, COLOR_BG_SEC_TEXT); - lv_style_set_value_color(&styles->bg_sec, LV_STATE_DEFAULT, COLOR_BG_SEC_TEXT); - lv_style_set_image_recolor(&styles->bg_sec, LV_STATE_DEFAULT, COLOR_BG_SEC_TEXT); - lv_style_set_line_color(&styles->bg_sec, LV_STATE_DEFAULT, COLOR_BG_SEC_TEXT); + lv_style_set_border_color(&styles->bg_sec, COLOR_BG_BORDER); + lv_style_set_text_color(&styles->bg_sec, COLOR_BG_SEC_TEXT); + lv_style_set_value_color(&styles->bg_sec, COLOR_BG_SEC_TEXT); + lv_style_set_image_recolor(&styles->bg_sec, COLOR_BG_SEC_TEXT); + lv_style_set_line_color(&styles->bg_sec, COLOR_BG_SEC_TEXT); */ /* style_init_reset(&styles->bg_click); - lv_style_set_bg_color(&styles->bg_click, LV_STATE_PRESSED, COLOR_BG_PR); - lv_style_set_bg_color(&styles->bg_click, LV_STATE_CHECKED, COLOR_BG_CHK); - lv_style_set_bg_color(&styles->bg_click, LV_STATE_PRESSED | LV_STATE_CHECKED, COLOR_BG_PR_CHK); - lv_style_set_bg_color(&styles->bg_click, LV_STATE_DISABLED, COLOR_BG_DIS); - lv_style_set_border_width(&styles->bg_click, LV_STATE_CHECKED, 0); - lv_style_set_border_color(&styles->bg_click, LV_STATE_FOCUSED | LV_STATE_PRESSED, + lv_style_set_bg_color(&styles->bg_click, COLOR_BG_PR); + lv_style_set_bg_color(&styles->bg_click, COLOR_BG_CHK); + lv_style_set_bg_color(&styles->bg_click, LV_STATE_PRESSED | COLOR_BG_PR_CHK); + lv_style_set_bg_color(&styles->bg_click, COLOR_BG_DIS); + lv_style_set_border_width(&styles->bg_click, 0); + lv_style_set_border_color(&styles->bg_click, LV_STATE_FOCUSED | lv_color_darken(theme.color_primary, LV_OPA_20)); - lv_style_set_border_color(&styles->bg_click, LV_STATE_PRESSED, COLOR_BG_BORDER_PR); - lv_style_set_border_color(&styles->bg_click, LV_STATE_CHECKED, COLOR_BG_BORDER_CHK); - lv_style_set_border_color(&styles->bg_click, LV_STATE_PRESSED | LV_STATE_CHECKED, COLOR_BG_BORDER_CHK_PR); - lv_style_set_border_color(&styles->bg_click, LV_STATE_DISABLED, COLOR_BG_BORDER_DIS); - lv_style_set_text_color(&styles->bg_click, LV_STATE_PRESSED, COLOR_BG_TEXT_PR); - lv_style_set_text_color(&styles->bg_click, LV_STATE_CHECKED, COLOR_BG_TEXT_CHK); - lv_style_set_text_color(&styles->bg_click, LV_STATE_PRESSED | LV_STATE_CHECKED, COLOR_BG_TEXT_CHK_PR); - lv_style_set_text_color(&styles->bg_click, LV_STATE_DISABLED, COLOR_BG_TEXT_DIS); - lv_style_set_image_recolor(&styles->bg_click, LV_STATE_PRESSED, COLOR_BG_TEXT_PR); - lv_style_set_image_recolor(&styles->bg_click, LV_STATE_CHECKED, COLOR_BG_TEXT_CHK); - lv_style_set_image_recolor(&styles->bg_click, LV_STATE_PRESSED | LV_STATE_CHECKED, COLOR_BG_TEXT_CHK_PR); - lv_style_set_image_recolor(&styles->bg_click, LV_STATE_DISABLED, COLOR_BG_TEXT_DIS); - lv_style_set_transition_prop_5(&styles->bg_click, LV_STATE_DEFAULT, LV_STYLE_BG_COLOR);*/ + lv_style_set_border_color(&styles->bg_click, COLOR_BG_BORDER_PR); + lv_style_set_border_color(&styles->bg_click, COLOR_BG_BORDER_CHK); + lv_style_set_border_color(&styles->bg_click, LV_STATE_PRESSED | COLOR_BG_BORDER_CHK_PR); + lv_style_set_border_color(&styles->bg_click, COLOR_BG_BORDER_DIS); + lv_style_set_text_color(&styles->bg_click, COLOR_BG_TEXT_PR); + lv_style_set_text_color(&styles->bg_click, COLOR_BG_TEXT_CHK); + lv_style_set_text_color(&styles->bg_click, LV_STATE_PRESSED | COLOR_BG_TEXT_CHK_PR); + lv_style_set_text_color(&styles->bg_click, COLOR_BG_TEXT_DIS); + lv_style_set_image_recolor(&styles->bg_click, COLOR_BG_TEXT_PR); + lv_style_set_image_recolor(&styles->bg_click, COLOR_BG_TEXT_CHK); + lv_style_set_image_recolor(&styles->bg_click, LV_STATE_PRESSED | COLOR_BG_TEXT_CHK_PR); + lv_style_set_image_recolor(&styles->bg_click, COLOR_BG_TEXT_DIS); + lv_style_set_transition_prop_5(&styles->bg_click, LV_STYLE_BG_COLOR);*/ style_init_reset(&styles->btn); - lv_style_set_radius(&styles->btn, LV_STATE_DEFAULT, LV_DPI / 12); - lv_style_set_bg_opa(&styles->btn, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_style_set_radius(&styles->btn, LV_DPI / 12); + lv_style_set_bg_opa(&styles->btn, LV_OPA_COVER); - lv_style_set_bg_color(&styles->btn, LV_STATE_DEFAULT, COLOR_BTN); - lv_style_set_bg_color(&styles->btn, LV_STATE_PRESSED, COLOR_BTN_PR); + lv_style_set_bg_color(&styles->btn, COLOR_BTN); + lv_style_set_bg_color(&styles->btn, COLOR_BTN_PR); - lv_style_set_bg_grad_color(&styles->btn, LV_STATE_DEFAULT, COLOR_BTN_GRAD); - lv_style_set_bg_grad_color(&styles->btn, LV_STATE_PRESSED, COLOR_BTN_CHK_GRAD); + lv_style_set_bg_grad_color(&styles->btn, COLOR_BTN_GRAD); + lv_style_set_bg_grad_color(&styles->btn, COLOR_BTN_CHK_GRAD); - lv_style_set_bg_grad_dir(&styles->btn, LV_STATE_DEFAULT, LV_GRAD_DIR_VER); - // lv_style_set_bg_color(&styles->btn, LV_STATE_DEFAULT, COLOR_BTN); - // lv_style_set_bg_color(&styles->btn, LV_STATE_PRESSED, COLOR_BTN_PR); + lv_style_set_bg_grad_dir(&styles->btn, LV_GRAD_DIR_VER); + // lv_style_set_bg_color(&styles->btn, COLOR_BTN); + // lv_style_set_bg_color(&styles->btn, COLOR_BTN_PR); - lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED, COLOR_BTN_CHK); - lv_style_set_bg_grad_color(&styles->btn, LV_STATE_CHECKED, COLOR_BTN_CHK_GRAD); - lv_style_set_bg_color(&styles->btn, LV_STATE_CHECKED | LV_STATE_PRESSED, COLOR_BTN_CHK_PR); - lv_style_set_bg_grad_color(&styles->btn, LV_STATE_CHECKED | LV_STATE_PRESSED, COLOR_BTN_CHK_PR_GRAD); + lv_style_set_bg_color(&styles->btn, COLOR_BTN_CHK); + lv_style_set_bg_grad_color(&styles->btn, COLOR_BTN_CHK_GRAD); + lv_style_set_bg_color(&styles->btn, COLOR_BTN_CHK_PR); + lv_style_set_bg_grad_color(&styles->btn, COLOR_BTN_CHK_PR_GRAD); - lv_style_set_bg_color(&styles->btn, LV_STATE_DISABLED, COLOR_BTN); - lv_style_set_bg_color(&styles->btn, LV_STATE_DISABLED | LV_STATE_CHECKED, COLOR_BTN_DIS); + lv_style_set_bg_color(&styles->btn, COLOR_BTN); + lv_style_set_bg_color(&styles->btn, COLOR_BTN_DIS); - lv_style_set_border_color(&styles->btn, LV_STATE_DEFAULT, COLOR_BTN_BORDER); - lv_style_set_border_color(&styles->btn, LV_STATE_CHECKED, COLOR_BTN_BORDER_CHK); - lv_style_set_border_color(&styles->btn, LV_STATE_DISABLED, COLOR_BTN_BORDER_INA); - lv_style_set_border_width(&styles->btn, LV_STATE_DEFAULT, border_width); - lv_style_set_border_opa(&styles->btn, LV_STATE_DEFAULT, LV_OPA_50); - // lv_style_set_border_opa(&styles->btn, LV_STATE_CHECKED, LV_OPA_40); + lv_style_set_border_color(&styles->btn, COLOR_BTN_BORDER); + lv_style_set_border_color(&styles->btn, COLOR_BTN_BORDER_CHK); + lv_style_set_border_color(&styles->btn, COLOR_BTN_BORDER_INA); + lv_style_set_border_width(&styles->btn, border_width); + lv_style_set_border_opa(&styles->btn, LV_OPA_50); + // lv_style_set_border_opa(&styles->btn, LV_OPA_40); - lv_style_set_text_color(&styles->btn, LV_STATE_DEFAULT, COLOR_BG_TEXT); - lv_style_set_text_color(&styles->btn, LV_STATE_PRESSED, COLOR_BG_TEXT_PR); - lv_style_set_text_color(&styles->btn, LV_STATE_CHECKED, COLOR_BG_TEXT_CHK); - lv_style_set_text_color(&styles->btn, LV_STATE_CHECKED | LV_STATE_PRESSED, COLOR_BG_TEXT_CHK_PR); - lv_style_set_text_color(&styles->btn, LV_STATE_DISABLED, COLOR_BG_TEXT_DIS); + lv_style_set_text_color(&styles->btn, COLOR_BG_TEXT); + lv_style_set_text_color(&styles->btn, COLOR_BG_TEXT_PR); + lv_style_set_text_color(&styles->btn, COLOR_BG_TEXT_CHK); + lv_style_set_text_color(&styles->btn, COLOR_BG_TEXT_CHK_PR); + lv_style_set_text_color(&styles->btn, COLOR_BG_TEXT_DIS); - lv_style_set_image_recolor(&styles->btn, LV_STATE_DEFAULT, value_color); - lv_style_set_image_recolor(&styles->btn, LV_STATE_PRESSED, value_color); - lv_style_set_image_recolor(&styles->btn, LV_STATE_PRESSED, LV_COLOR_WHITE); - lv_style_set_image_recolor(&styles->btn, LV_STATE_CHECKED | LV_STATE_PRESSED, LV_COLOR_WHITE); - lv_style_set_image_recolor(&styles->btn, LV_STATE_DISABLED, - IS_LIGHT ? lv_color_hex(0x888888) : lv_color_hex(0x888888)); + lv_style_set_image_recolor(&styles->btn, value_color); + lv_style_set_image_recolor(&styles->btn, value_color); + lv_style_set_image_recolor(&styles->btn, LV_COLOR_WHITE); + lv_style_set_image_recolor(&styles->btn, LV_COLOR_WHITE); + lv_style_set_image_recolor(&styles->btn, IS_LIGHT ? lv_color_hex(0x888888) : lv_color_hex(0x888888)); - lv_style_set_value_color(&styles->btn, LV_STATE_DEFAULT, value_color); - lv_style_set_value_color(&styles->btn, LV_STATE_PRESSED, value_color); - lv_style_set_value_color(&styles->btn, LV_STATE_CHECKED, LV_COLOR_WHITE); - lv_style_set_value_color(&styles->btn, LV_STATE_CHECKED | LV_STATE_PRESSED, LV_COLOR_WHITE); - lv_style_set_value_color(&styles->btn, LV_STATE_DISABLED, - IS_LIGHT ? lv_color_hex(0x888888) : lv_color_hex(0x888888)); + lv_style_set_value_color(&styles->btn, value_color); + lv_style_set_value_color(&styles->btn, value_color); + lv_style_set_value_color(&styles->btn, LV_COLOR_WHITE); + lv_style_set_value_color(&styles->btn, LV_COLOR_WHITE); + lv_style_set_value_color(&styles->btn, IS_LIGHT ? lv_color_hex(0x888888) : lv_color_hex(0x888888)); - lv_style_set_pad_hor(&styles->btn, LV_STATE_DEFAULT, HASP_DPX(40)); - lv_style_set_pad_ver(&styles->btn, LV_STATE_DEFAULT, HASP_DPX(15)); - lv_style_set_pad_inner(&styles->btn, LV_STATE_DEFAULT, HASP_DPX(20)); + lv_style_set_pad_hor(&styles->btn, HASP_DPX(40)); + lv_style_set_pad_ver(&styles->btn, HASP_DPX(15)); + lv_style_set_pad_inner(&styles->btn, HASP_DPX(20)); - lv_style_set_outline_width(&styles->btn, LV_STATE_DEFAULT, outline_width); + lv_style_set_outline_width(&styles->btn, outline_width); if(!NO_FOCUS) { - lv_style_set_outline_opa(&styles->btn, LV_STATE_DEFAULT, LV_OPA_0); - lv_style_set_outline_opa(&styles->btn, LV_STATE_FOCUSED, LV_OPA_50); - lv_style_set_outline_color(&styles->btn, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_outline_color(&styles->btn, LV_STATE_EDITED, theme.color_secondary); + lv_style_set_outline_opa(&styles->btn, LV_OPA_0); + lv_style_set_outline_opa(&styles->btn, LV_OPA_50); + lv_style_set_outline_color(&styles->btn, theme.color_primary); + lv_style_set_outline_color(&styles->btn, theme.color_secondary); } - lv_style_set_transition_time(&styles->btn, LV_STATE_DEFAULT, TRANSITION_TIME); - lv_style_set_transition_prop_4(&styles->btn, LV_STATE_DEFAULT, LV_STYLE_BORDER_OPA); - lv_style_set_transition_prop_5(&styles->btn, LV_STATE_DEFAULT, LV_STYLE_BG_COLOR); - lv_style_set_transition_prop_6(&styles->btn, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA); - lv_style_set_transition_delay(&styles->btn, LV_STATE_DEFAULT, TRANSITION_TIME); - lv_style_set_transition_delay(&styles->btn, LV_STATE_PRESSED, 0); + lv_style_set_transition_time(&styles->btn, TRANSITION_TIME); + lv_style_set_transition_prop_4(&styles->btn, LV_STYLE_BORDER_OPA); + lv_style_set_transition_prop_5(&styles->btn, LV_STYLE_BG_COLOR); + lv_style_set_transition_prop_6(&styles->btn, LV_STYLE_OUTLINE_OPA); + lv_style_set_transition_delay(&styles->btn, TRANSITION_TIME); + lv_style_set_transition_delay(&styles->btn, 0); style_init_reset(&styles->pad_inner); - lv_style_set_pad_inner(&styles->pad_inner, LV_STATE_DEFAULT, + lv_style_set_pad_inner(&styles->pad_inner, lv_disp_get_size_category(NULL) <= LV_DISP_MEDIUM_LIMIT ? HASP_DPX(20) : HASP_DPX(40)); style_init_reset(&styles->pad_small); lv_style_int_t pad_small_value = lv_disp_get_size_category(NULL) <= LV_DISP_MEDIUM_LIMIT ? HASP_DPX(10) : HASP_DPX(20); - lv_style_set_pad_all(&styles->pad_small, LV_STATE_DEFAULT, pad_small_value); - lv_style_set_pad_inner(&styles->pad_small, LV_STATE_DEFAULT, pad_small_value); + lv_style_set_pad_all(&styles->pad_small, pad_small_value); + lv_style_set_pad_inner(&styles->pad_small, pad_small_value); #if LV_USE_DROPDOWN || LV_USE_ROLLER style_init_reset(&styles->line_space); - lv_style_set_text_line_space(&styles->line_space, LV_STATE_DEFAULT, HASP_DPX(20)); - lv_style_set_clip_corner(&styles->line_space, LV_STATE_DEFAULT, true); + lv_style_set_text_line_space(&styles->line_space, HASP_DPX(20)); + lv_style_set_clip_corner(&styles->line_space, true); style_init_reset(&styles->selected); - lv_style_set_radius(&styles->selected, LV_STATE_DEFAULT, 0); - lv_style_set_text_color(&styles->selected, LV_STATE_DEFAULT, IS_LIGHT ? LV_COLOR_WHITE : LV_COLOR_WHITE); - lv_style_set_bg_color(&styles->selected, LV_STATE_PRESSED, COLOR_BG_PR); - lv_style_set_text_color(&styles->selected, LV_STATE_PRESSED, COLOR_BG_TEXT_PR); + lv_style_set_radius(&styles->selected, 0); + lv_style_set_text_color(&styles->selected, IS_LIGHT ? LV_COLOR_WHITE : LV_COLOR_WHITE); + lv_style_set_bg_color(&styles->selected, COLOR_BG_PR); + lv_style_set_text_color(&styles->selected, COLOR_BG_TEXT_PR); #endif } @@ -456,23 +456,23 @@ static void bar_init(void) { #if LV_USE_BAR /* style_init_reset(&styles->bar_bg); - lv_style_set_radius(&styles->bar_bg, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_bg_opa(&styles->bar_bg, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&styles->bar_bg, LV_STATE_DEFAULT, COLOR_BG_SEC); - lv_style_set_value_color(&styles->bar_bg, LV_STATE_DEFAULT, value_color); - lv_style_set_outline_color(&styles->bar_bg, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_outline_color(&styles->bar_bg, LV_STATE_EDITED, theme.color_secondary); - lv_style_set_outline_opa(&styles->bar_bg, LV_STATE_DEFAULT, LV_OPA_TRANSP); - lv_style_set_outline_width(&styles->bar_bg, LV_STATE_DEFAULT, outline_width); - lv_style_set_transition_time(&styles->bar_bg, LV_STATE_DEFAULT, TRANSITION_TIME); - lv_style_set_transition_prop_6(&styles->bar_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA); + lv_style_set_radius(&styles->bar_bg, LV_RADIUS_CIRCLE); + lv_style_set_bg_opa(&styles->bar_bg, LV_OPA_COVER); + lv_style_set_bg_color(&styles->bar_bg, COLOR_BG_SEC); + lv_style_set_value_color(&styles->bar_bg, value_color); + lv_style_set_outline_color(&styles->bar_bg, theme.color_primary); + lv_style_set_outline_color(&styles->bar_bg, theme.color_secondary); + lv_style_set_outline_opa(&styles->bar_bg, LV_OPA_TRANSP); + lv_style_set_outline_width(&styles->bar_bg, outline_width); + lv_style_set_transition_time(&styles->bar_bg, TRANSITION_TIME); + lv_style_set_transition_prop_6(&styles->bar_bg, LV_STYLE_OUTLINE_OPA); style_init_reset(&styles->bar_indic); - lv_style_set_bg_opa(&styles->bar_indic, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_radius(&styles->bar_indic, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_bg_color(&styles->bar_indic, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_bg_color(&styles->bar_indic, LV_STATE_DISABLED, lv_color_hex3(0x888)); - lv_style_set_value_color(&styles->bar_indic, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0x41404f) : + lv_style_set_bg_opa(&styles->bar_indic, LV_OPA_COVER); + lv_style_set_radius(&styles->bar_indic, LV_RADIUS_CIRCLE); + lv_style_set_bg_color(&styles->bar_indic, theme.color_primary); + lv_style_set_bg_color(&styles->bar_indic, lv_color_hex3(0x888)); + lv_style_set_value_color(&styles->bar_indic, IS_LIGHT ? lv_color_hex(0x41404f) : LV_COLOR_WHITE);*/ #endif } @@ -495,16 +495,16 @@ static void led_init(void) { #if LV_USE_LED != 0 style_init_reset(&styles->led); - lv_style_set_bg_opa(&styles->led, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&styles->led, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_border_width(&styles->led, LV_STATE_DEFAULT, 2); - lv_style_set_border_opa(&styles->led, LV_STATE_DEFAULT, LV_OPA_50); - lv_style_set_border_color(&styles->led, LV_STATE_DEFAULT, lv_color_lighten(theme.color_primary, LV_OPA_30)); - lv_style_set_radius(&styles->led, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_shadow_width(&styles->led, LV_STATE_DEFAULT, HASP_DPX(15)); - lv_style_set_shadow_color(&styles->led, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_shadow_spread(&styles->led, LV_STATE_DEFAULT, HASP_DPX(5)); - lv_style_set_margin_all(&styles->led, LV_STATE_DEFAULT, HASP_DPX(5)); + lv_style_set_bg_opa(&styles->led, LV_OPA_COVER); + lv_style_set_bg_color(&styles->led, theme.color_primary); + lv_style_set_border_width(&styles->led, 2); + lv_style_set_border_opa(&styles->led, LV_OPA_50); + lv_style_set_border_color(&styles->led, lv_color_lighten(theme.color_primary, LV_OPA_30)); + lv_style_set_radius(&styles->led, LV_RADIUS_CIRCLE); + lv_style_set_shadow_width(&styles->led, HASP_DPX(15)); + lv_style_set_shadow_color(&styles->led, theme.color_primary); + lv_style_set_shadow_spread(&styles->led, HASP_DPX(5)); + lv_style_set_margin_all(&styles->led, HASP_DPX(5)); #endif } @@ -512,15 +512,15 @@ static void slider_init(void) { #if LV_USE_SLIDER != 0 style_init_reset(&styles->slider_knob); - lv_style_set_bg_opa(&styles->slider_knob, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&styles->slider_knob, LV_STATE_DEFAULT, IS_LIGHT ? LV_COLOR_GRAY: LV_COLOR_WHITE); - // lv_style_set_value_color(&styles->slider_knob, LV_STATE_DEFAULT, + lv_style_set_bg_opa(&styles->slider_knob, LV_OPA_COVER); + lv_style_set_bg_color(&styles->slider_knob, IS_LIGHT ? LV_COLOR_GRAY : LV_COLOR_WHITE); + // lv_style_set_value_color(&styles->slider_knob, // value_color); - // lv_style_set_radius(&styles->slider_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_pad_all(&styles->slider_knob, LV_STATE_DEFAULT, HASP_DPX(7)); + // lv_style_set_radius(&styles->slider_knob, LV_RADIUS_CIRCLE); + lv_style_set_pad_all(&styles->slider_knob, HASP_DPX(7)); style_init_reset(&styles->slider_bg); - lv_style_set_margin_all(&styles->slider_bg, LV_STATE_DEFAULT, HASP_DPX(10)); + lv_style_set_margin_all(&styles->slider_bg, HASP_DPX(10)); #endif } @@ -529,12 +529,12 @@ static void switch_init(void) { #if LV_USE_SWITCH != 0 style_init_reset(&styles->sw_knob); - lv_style_set_bg_opa(&styles->sw_knob, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&styles->sw_knob, LV_STATE_DEFAULT, IS_LIGHT ? LV_COLOR_GRAY: LV_COLOR_WHITE); - // lv_style_set_bg_opa(&styles->sw_knob, LV_STATE_DEFAULT, LV_OPA_COVER); - // lv_style_set_bg_color(&styles->sw_knob, LV_STATE_DEFAULT, LV_COLOR_WHITE); - // lv_style_set_radius(&styles->sw_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_pad_all(&styles->sw_knob, LV_STATE_DEFAULT, HASP_DPX(2)); + lv_style_set_bg_opa(&styles->sw_knob, LV_OPA_COVER); + lv_style_set_bg_color(&styles->sw_knob, IS_LIGHT ? LV_COLOR_GRAY : LV_COLOR_WHITE); + // lv_style_set_bg_opa(&styles->sw_knob, LV_OPA_COVER); + // lv_style_set_bg_color(&styles->sw_knob, LV_COLOR_WHITE); + // lv_style_set_radius(&styles->sw_knob, LV_RADIUS_CIRCLE); + lv_style_set_pad_all(&styles->sw_knob, HASP_DPX(2)); #endif } @@ -542,17 +542,17 @@ static void linemeter_init(void) { #if LV_USE_LINEMETER != 0 style_init_reset(&styles->lmeter); - lv_style_set_radius(&styles->lmeter, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_pad_hor(&styles->lmeter, LV_STATE_DEFAULT, HASP_DPX(20)); - lv_style_set_pad_top(&styles->lmeter, LV_STATE_DEFAULT, HASP_DPX(20)); - lv_style_set_pad_inner(&styles->lmeter, LV_STATE_DEFAULT, HASP_DPX(30)); - lv_style_set_scale_width(&styles->lmeter, LV_STATE_DEFAULT, HASP_DPX(25)); + lv_style_set_radius(&styles->lmeter, LV_RADIUS_CIRCLE); + lv_style_set_pad_hor(&styles->lmeter, HASP_DPX(20)); + lv_style_set_pad_top(&styles->lmeter, HASP_DPX(20)); + lv_style_set_pad_inner(&styles->lmeter, HASP_DPX(30)); + lv_style_set_scale_width(&styles->lmeter, HASP_DPX(25)); - lv_style_set_line_color(&styles->lmeter, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_scale_grad_color(&styles->lmeter, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_scale_end_color(&styles->lmeter, LV_STATE_DEFAULT, lv_color_hex3(0x888)); - lv_style_set_line_width(&styles->lmeter, LV_STATE_DEFAULT, HASP_DPX(10)); - lv_style_set_scale_end_line_width(&styles->lmeter, LV_STATE_DEFAULT, HASP_DPX(7)); + lv_style_set_line_color(&styles->lmeter, theme.color_primary); + lv_style_set_scale_grad_color(&styles->lmeter, theme.color_primary); + lv_style_set_scale_end_color(&styles->lmeter, lv_color_hex3(0x888)); + lv_style_set_line_width(&styles->lmeter, HASP_DPX(10)); + lv_style_set_scale_end_line_width(&styles->lmeter, HASP_DPX(7)); #endif } @@ -560,36 +560,35 @@ static void gauge_init(void) { #if LV_USE_GAUGE != 0 style_init_reset(&styles->gauge_main); - lv_style_set_line_color(&styles->gauge_main, LV_STATE_DEFAULT, lv_color_hex3(0x888)); - lv_style_set_scale_grad_color(&styles->gauge_main, LV_STATE_DEFAULT, lv_color_hex3(0x888)); - lv_style_set_scale_end_color(&styles->gauge_main, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_line_width(&styles->gauge_main, LV_STATE_DEFAULT, HASP_DPX(2)); // normal scale minor thick width - lv_style_set_scale_end_line_width(&styles->gauge_main, LV_STATE_DEFAULT, + lv_style_set_line_color(&styles->gauge_main, lv_color_hex3(0x888)); + lv_style_set_scale_grad_color(&styles->gauge_main, lv_color_hex3(0x888)); + lv_style_set_scale_end_color(&styles->gauge_main, theme.color_primary); + lv_style_set_line_width(&styles->gauge_main, HASP_DPX(2)); // normal scale minor thick width + lv_style_set_scale_end_line_width(&styles->gauge_main, HASP_DPX(2)); // strong scale minor tick width - lv_style_set_scale_end_border_width(&styles->gauge_main, LV_STATE_DEFAULT, HASP_DPX(3)); - lv_style_set_pad_hor(&styles->gauge_main, LV_STATE_DEFAULT, HASP_DPX(20)); // left margin - lv_style_set_pad_top(&styles->gauge_main, LV_STATE_DEFAULT, HASP_DPX(20)); // top margin - lv_style_set_pad_inner(&styles->gauge_main, LV_STATE_DEFAULT, HASP_DPX(15)); // position of the labels - lv_style_set_scale_width(&styles->gauge_main, LV_STATE_DEFAULT, HASP_DPX(10)); // minor thick length - lv_style_set_radius(&styles->gauge_main, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + lv_style_set_scale_end_border_width(&styles->gauge_main, HASP_DPX(3)); + lv_style_set_pad_hor(&styles->gauge_main, HASP_DPX(20)); // left margin + lv_style_set_pad_top(&styles->gauge_main, HASP_DPX(20)); // top margin + lv_style_set_pad_inner(&styles->gauge_main, HASP_DPX(15)); // position of the labels + lv_style_set_scale_width(&styles->gauge_main, HASP_DPX(10)); // minor thick length + lv_style_set_radius(&styles->gauge_main, LV_RADIUS_CIRCLE); style_init_reset(&styles->gauge_strong); - lv_style_set_line_color(&styles->gauge_strong, LV_STATE_DEFAULT, lv_color_hex3(0x888)); - lv_style_set_scale_grad_color(&styles->gauge_strong, LV_STATE_DEFAULT, lv_color_hex3(0x888)); - lv_style_set_scale_end_color(&styles->gauge_strong, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_line_width(&styles->gauge_strong, LV_STATE_DEFAULT, HASP_DPX(8)); // strong scale arc width - lv_style_set_scale_end_line_width(&styles->gauge_strong, LV_STATE_DEFAULT, HASP_DPX(8)); - lv_style_set_scale_width(&styles->gauge_strong, LV_STATE_DEFAULT, HASP_DPX(20)); // major thick length + lv_style_set_line_color(&styles->gauge_strong, lv_color_hex3(0x888)); + lv_style_set_scale_grad_color(&styles->gauge_strong, lv_color_hex3(0x888)); + lv_style_set_scale_end_color(&styles->gauge_strong, theme.color_primary); + lv_style_set_line_width(&styles->gauge_strong, HASP_DPX(8)); // strong scale arc width + lv_style_set_scale_end_line_width(&styles->gauge_strong, HASP_DPX(8)); + lv_style_set_scale_width(&styles->gauge_strong, HASP_DPX(20)); // major thick length style_init_reset(&styles->gauge_needle); - lv_style_set_line_color(&styles->gauge_needle, LV_STATE_DEFAULT, - IS_LIGHT ? lv_color_hex(0x464b5b) : LV_COLOR_WHITE); - lv_style_set_line_width(&styles->gauge_needle, LV_STATE_DEFAULT, HASP_DPX(8)); - lv_style_set_bg_opa(&styles->gauge_needle, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&styles->gauge_needle, LV_STATE_DEFAULT, IS_LIGHT ? lv_color_hex(0x464b5b) : LV_COLOR_WHITE); - lv_style_set_radius(&styles->gauge_needle, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_size(&styles->gauge_needle, LV_STATE_DEFAULT, HASP_DPX(30)); - lv_style_set_pad_inner(&styles->gauge_needle, LV_STATE_DEFAULT, HASP_DPX(10)); + lv_style_set_line_color(&styles->gauge_needle, IS_LIGHT ? lv_color_hex(0x464b5b) : LV_COLOR_WHITE); + lv_style_set_line_width(&styles->gauge_needle, HASP_DPX(8)); + lv_style_set_bg_opa(&styles->gauge_needle, LV_OPA_COVER); + lv_style_set_bg_color(&styles->gauge_needle, IS_LIGHT ? lv_color_hex(0x464b5b) : LV_COLOR_WHITE); + lv_style_set_radius(&styles->gauge_needle, LV_RADIUS_CIRCLE); + lv_style_set_size(&styles->gauge_needle, HASP_DPX(30)); + lv_style_set_pad_inner(&styles->gauge_needle, HASP_DPX(10)); #endif } @@ -597,28 +596,28 @@ static void arc_init(void) { #if LV_USE_ARC != 0 style_init_reset(&styles->arc_indic); - lv_style_set_line_color(&styles->arc_indic, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_line_width(&styles->arc_indic, LV_STATE_DEFAULT, HASP_DPX(25)); - lv_style_set_line_rounded(&styles->arc_indic, LV_STATE_DEFAULT, true); + lv_style_set_line_color(&styles->arc_indic, theme.color_primary); + lv_style_set_line_width(&styles->arc_indic, HASP_DPX(25)); + lv_style_set_line_rounded(&styles->arc_indic, true); style_init_reset(&styles->arc_bg); - lv_style_set_line_color(&styles->arc_bg, LV_STATE_DEFAULT, lv_color_mix(BORDER_COLOR, COLOR_SCR_GRAD, 128)); - lv_style_set_line_width(&styles->arc_bg, LV_STATE_DEFAULT, HASP_DPX(25)); - lv_style_set_line_rounded(&styles->arc_bg, LV_STATE_DEFAULT, true); - lv_style_set_radius(&styles->arc_bg, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_border_width(&styles->arc_bg, LV_STATE_DEFAULT, HASP_DPX(25)); + lv_style_set_line_color(&styles->arc_bg, lv_color_mix(BORDER_COLOR, COLOR_SCR_GRAD, 128)); + lv_style_set_line_width(&styles->arc_bg, HASP_DPX(25)); + lv_style_set_line_rounded(&styles->arc_bg, true); + lv_style_set_radius(&styles->arc_bg, LV_RADIUS_CIRCLE); + lv_style_set_border_width(&styles->arc_bg, HASP_DPX(25)); /* - lv_style_set_border_opa(&styles->pretty_color, LV_STATE_DEFAULT, LV_OPA_TRANSP); - lv_style_set_border_opa(&styles->pretty_color, LV_STATE_FOCUSED, LV_OPA_30); - lv_style_set_border_width(&styles->pretty_color, LV_STATE_DEFAULT, LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1); - lv_style_set_border_width(&styles->pretty_color, LV_STATE_FOCUSED, LV_DPI / 50 >= 1 ? LV_DPI / 25 : 2); - lv_style_set_pad_all(&styles->pretty_color, LV_STATE_DEFAULT, LV_DPI / 50 >= 1 ? LV_DPI / 25 : 2); + lv_style_set_border_opa(&styles->pretty_color, LV_OPA_TRANSP); + lv_style_set_border_opa(&styles->pretty_color, LV_OPA_30); + lv_style_set_border_width(&styles->pretty_color, LV_DPI / 50 >= 1 ? LV_DPI / 50 : 1); + lv_style_set_border_width(&styles->pretty_color, LV_DPI / 50 >= 1 ? LV_DPI / 25 : 2); + lv_style_set_pad_all(&styles->pretty_color, LV_DPI / 50 >= 1 ? LV_DPI / 25 : 2); */ style_init_reset(&styles->arc_knob); - lv_style_set_bg_opa(&styles->arc_knob, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&styles->arc_knob, LV_STATE_DEFAULT, IS_LIGHT ? LV_COLOR_GRAY : LV_COLOR_WHITE); - lv_style_set_radius(&styles->arc_knob, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_pad_all(&styles->arc_knob, LV_STATE_DEFAULT, HASP_DPX(1)); + lv_style_set_bg_opa(&styles->arc_knob, LV_OPA_COVER); + lv_style_set_bg_color(&styles->arc_knob, IS_LIGHT ? LV_COLOR_GRAY : LV_COLOR_WHITE); + lv_style_set_radius(&styles->arc_knob, LV_RADIUS_CIRCLE); + lv_style_set_pad_all(&styles->arc_knob, HASP_DPX(1)); #endif } @@ -633,19 +632,19 @@ static void chart_init(void) { #if LV_USE_CHART style_init_reset(&styles->chart_bg); - lv_style_set_text_color(&styles->chart_bg, LV_STATE_DEFAULT, IS_LIGHT ? COLOR_BG_TEXT_DIS : lv_color_hex(0xa1adbd)); + lv_style_set_text_color(&styles->chart_bg, IS_LIGHT ? COLOR_BG_TEXT_DIS : lv_color_hex(0xa1adbd)); style_init_reset(&styles->chart_series_bg); - lv_style_set_line_width(&styles->chart_series_bg, LV_STATE_DEFAULT, HASP_DPX(1)); - lv_style_set_line_dash_width(&styles->chart_series_bg, LV_STATE_DEFAULT, HASP_DPX(10)); - lv_style_set_line_dash_gap(&styles->chart_series_bg, LV_STATE_DEFAULT, HASP_DPX(10)); - lv_style_set_line_color(&styles->chart_series_bg, LV_STATE_DEFAULT, COLOR_BG_BORDER); + lv_style_set_line_width(&styles->chart_series_bg, HASP_DPX(1)); + lv_style_set_line_dash_width(&styles->chart_series_bg, HASP_DPX(10)); + lv_style_set_line_dash_gap(&styles->chart_series_bg, HASP_DPX(10)); + lv_style_set_line_color(&styles->chart_series_bg, COLOR_BG_BORDER); style_init_reset(&styles->chart_series); - lv_style_set_line_width(&styles->chart_series, LV_STATE_DEFAULT, HASP_DPX(3)); - lv_style_set_size(&styles->chart_series, LV_STATE_DEFAULT, HASP_DPX(4)); - lv_style_set_pad_inner(&styles->chart_series, LV_STATE_DEFAULT, HASP_DPX(2)); /*Space between columns*/ - lv_style_set_radius(&styles->chart_series, LV_STATE_DEFAULT, HASP_DPX(1)); + lv_style_set_line_width(&styles->chart_series, HASP_DPX(3)); + lv_style_set_size(&styles->chart_series, HASP_DPX(4)); + lv_style_set_pad_inner(&styles->chart_series, HASP_DPX(2)); /*Space between columns*/ + lv_style_set_radius(&styles->chart_series, HASP_DPX(1)); #endif } @@ -654,23 +653,22 @@ static void calendar_init(lv_style_int_t pad_def, lv_color_t value_color) { #if LV_USE_CALENDAR style_init_reset(&styles->calendar_date_nums); - lv_style_set_radius(&styles->calendar_date_nums, LV_STATE_DEFAULT, HASP_DPX(4)); - lv_style_set_text_color(&styles->calendar_date_nums, LV_STATE_CHECKED, value_color); - lv_style_set_text_color(&styles->calendar_date_nums, LV_STATE_DISABLED, LV_COLOR_GRAY); - lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_CHECKED, IS_LIGHT ? LV_OPA_20 : LV_OPA_40); - lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_PRESSED, LV_OPA_20); - lv_style_set_bg_opa(&styles->calendar_date_nums, LV_STATE_FOCUSED, LV_OPA_COVER); - lv_style_set_text_color(&styles->calendar_date_nums, LV_STATE_FOCUSED, LV_COLOR_WHITE); - lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_FOCUSED, theme.color_primary); - lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_DEFAULT, - IS_LIGHT ? lv_color_hex(0x666666) : LV_COLOR_WHITE); - lv_style_set_bg_color(&styles->calendar_date_nums, LV_STATE_CHECKED, theme.color_primary); - lv_style_set_border_width(&styles->calendar_date_nums, LV_STATE_CHECKED, 2); - lv_style_set_border_side(&styles->calendar_date_nums, LV_STATE_CHECKED, LV_BORDER_SIDE_LEFT); - lv_style_set_border_color(&styles->calendar_date_nums, LV_STATE_CHECKED, theme.color_primary); - lv_style_set_pad_inner(&styles->calendar_date_nums, LV_STATE_DEFAULT, HASP_DPX(3)); - lv_style_set_pad_hor(&styles->calendar_date_nums, LV_STATE_DEFAULT, pad_def); - lv_style_set_pad_bottom(&styles->calendar_date_nums, LV_STATE_DEFAULT, pad_def); + lv_style_set_radius(&styles->calendar_date_nums, HASP_DPX(4)); + lv_style_set_text_color(&styles->calendar_date_nums, value_color); + lv_style_set_text_color(&styles->calendar_date_nums, LV_COLOR_GRAY); + lv_style_set_bg_opa(&styles->calendar_date_nums, IS_LIGHT ? LV_OPA_20 : LV_OPA_40); + lv_style_set_bg_opa(&styles->calendar_date_nums, LV_OPA_20); + lv_style_set_bg_opa(&styles->calendar_date_nums, LV_OPA_COVER); + lv_style_set_text_color(&styles->calendar_date_nums, LV_COLOR_WHITE); + lv_style_set_bg_color(&styles->calendar_date_nums, theme.color_primary); + lv_style_set_bg_color(&styles->calendar_date_nums, IS_LIGHT ? lv_color_hex(0x666666) : LV_COLOR_WHITE); + lv_style_set_bg_color(&styles->calendar_date_nums, theme.color_primary); + lv_style_set_border_width(&styles->calendar_date_nums, 2); + lv_style_set_border_side(&styles->calendar_date_nums, LV_BORDER_SIDE_LEFT); + lv_style_set_border_color(&styles->calendar_date_nums, theme.color_primary); + lv_style_set_pad_inner(&styles->calendar_date_nums, HASP_DPX(3)); + lv_style_set_pad_hor(&styles->calendar_date_nums, pad_def); + lv_style_set_pad_bottom(&styles->calendar_date_nums, pad_def); #endif } @@ -678,21 +676,21 @@ static void cpicker_init(void) { #if LV_USE_CPICKER style_init_reset(&styles->cpicker_bg); - lv_style_set_scale_width(&styles->cpicker_bg, LV_STATE_DEFAULT, HASP_DPX(30)); - lv_style_set_bg_opa(&styles->cpicker_bg, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&styles->cpicker_bg, LV_STATE_DEFAULT, COLOR_SCR); - lv_style_set_pad_inner(&styles->cpicker_bg, LV_STATE_DEFAULT, HASP_DPX(20)); - lv_style_set_radius(&styles->cpicker_bg, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + lv_style_set_scale_width(&styles->cpicker_bg, HASP_DPX(30)); + lv_style_set_bg_opa(&styles->cpicker_bg, LV_OPA_COVER); + lv_style_set_bg_color(&styles->cpicker_bg, COLOR_SCR); + lv_style_set_pad_inner(&styles->cpicker_bg, HASP_DPX(20)); + lv_style_set_radius(&styles->cpicker_bg, LV_RADIUS_CIRCLE); style_init_reset(&styles->cpicker_indic); - lv_style_set_radius(&styles->cpicker_indic, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_bg_color(&styles->cpicker_indic, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_style_set_bg_opa(&styles->cpicker_indic, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_border_width(&styles->cpicker_indic, LV_STATE_DEFAULT, 2); - lv_style_set_border_color(&styles->cpicker_indic, LV_STATE_DEFAULT, LV_COLOR_GRAY); - lv_style_set_border_color(&styles->cpicker_indic, LV_STATE_FOCUSED, theme.color_primary); - lv_style_set_border_color(&styles->cpicker_indic, LV_STATE_EDITED, theme.color_secondary); - lv_style_set_pad_all(&styles->cpicker_indic, LV_STATE_DEFAULT, HASP_DPX(13)); + lv_style_set_radius(&styles->cpicker_indic, LV_RADIUS_CIRCLE); + lv_style_set_bg_color(&styles->cpicker_indic, LV_COLOR_WHITE); + lv_style_set_bg_opa(&styles->cpicker_indic, LV_OPA_COVER); + lv_style_set_border_width(&styles->cpicker_indic, 2); + lv_style_set_border_color(&styles->cpicker_indic, LV_COLOR_GRAY); + lv_style_set_border_color(&styles->cpicker_indic, theme.color_primary); + lv_style_set_border_color(&styles->cpicker_indic, theme.color_secondary); + lv_style_set_pad_all(&styles->cpicker_indic, HASP_DPX(13)); #endif } @@ -700,41 +698,41 @@ static void checkbox_init(void) { #if LV_USE_CHECKBOX != 0 /* style_init_reset(&styles->cb_bg); - lv_style_set_radius(&styles->cb_bg, LV_STATE_DEFAULT, HASP_DPX(4)); - lv_style_set_pad_inner(&styles->cb_bg, LV_STATE_DEFAULT, HASP_DPX(10)); - lv_style_set_outline_color(&styles->cb_bg, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_outline_opa(&styles->cb_bg, LV_STATE_DEFAULT, LV_OPA_TRANSP); - lv_style_set_outline_opa(&styles->cb_bg, LV_STATE_FOCUSED, LV_OPA_50); - lv_style_set_outline_width(&styles->cb_bg, LV_STATE_DEFAULT, outline_width); - lv_style_set_outline_pad(&styles->cb_bg, LV_STATE_DEFAULT, HASP_DPX(10)); - lv_style_set_transition_time(&styles->cb_bg, LV_STATE_DEFAULT, TRANSITION_TIME); - lv_style_set_transition_prop_6(&styles->cb_bg, LV_STATE_DEFAULT, LV_STYLE_OUTLINE_OPA); + lv_style_set_radius(&styles->cb_bg, HASP_DPX(4)); + lv_style_set_pad_inner(&styles->cb_bg, HASP_DPX(10)); + lv_style_set_outline_color(&styles->cb_bg, theme.color_primary); + lv_style_set_outline_opa(&styles->cb_bg, LV_OPA_TRANSP); + lv_style_set_outline_opa(&styles->cb_bg, LV_OPA_50); + lv_style_set_outline_width(&styles->cb_bg, outline_width); + lv_style_set_outline_pad(&styles->cb_bg, HASP_DPX(10)); + lv_style_set_transition_time(&styles->cb_bg, TRANSITION_TIME); + lv_style_set_transition_prop_6(&styles->cb_bg, LV_STYLE_OUTLINE_OPA); */ style_init_reset(&styles->cb_bullet); - lv_style_set_outline_opa(&styles->cb_bullet, LV_STATE_FOCUSED, LV_OPA_TRANSP); - lv_style_set_radius(&styles->cb_bullet, LV_STATE_DEFAULT, HASP_DPX(4)); - lv_style_set_pattern_image(&styles->cb_bullet, LV_STATE_CHECKED, LV_SYMBOL_OK); - lv_style_set_pattern_recolor(&styles->cb_bullet, LV_STATE_CHECKED, LV_COLOR_WHITE); - lv_style_set_pattern_opa(&styles->cb_bullet, LV_STATE_DEFAULT, LV_OPA_TRANSP); - lv_style_set_pattern_opa(&styles->cb_bullet, LV_STATE_CHECKED, LV_OPA_COVER); - lv_style_set_transition_prop_3(&styles->cb_bullet, LV_STATE_DEFAULT, LV_STYLE_PATTERN_OPA); - lv_style_set_text_font(&styles->cb_bullet, LV_STATE_CHECKED, theme.font_small); - lv_style_set_pad_all(&styles->cb_bullet, LV_STATE_DEFAULT, HASP_DPX(3)); + lv_style_set_outline_opa(&styles->cb_bullet, LV_OPA_TRANSP); + lv_style_set_radius(&styles->cb_bullet, HASP_DPX(4)); + lv_style_set_pattern_image(&styles->cb_bullet, LV_SYMBOL_OK); + lv_style_set_pattern_recolor(&styles->cb_bullet, LV_COLOR_WHITE); + lv_style_set_pattern_opa(&styles->cb_bullet, LV_OPA_TRANSP); + lv_style_set_pattern_opa(&styles->cb_bullet, LV_OPA_COVER); + lv_style_set_transition_prop_3(&styles->cb_bullet, LV_STYLE_PATTERN_OPA); + lv_style_set_text_font(&styles->cb_bullet, theme.font_small); + lv_style_set_pad_all(&styles->cb_bullet, HASP_DPX(3)); - lv_style_set_bg_color(&styles->cb_bullet, LV_STATE_PRESSED, COLOR_BTN_PR); - lv_style_set_bg_grad_color(&styles->cb_bullet, LV_STATE_PRESSED, COLOR_BTN_CHK_GRAD); - lv_style_set_text_color(&styles->cb_bullet, LV_STATE_PRESSED, COLOR_BG_TEXT_PR); + lv_style_set_bg_color(&styles->cb_bullet, COLOR_BTN_PR); + lv_style_set_bg_grad_color(&styles->cb_bullet, COLOR_BTN_CHK_GRAD); + lv_style_set_text_color(&styles->cb_bullet, COLOR_BG_TEXT_PR); - lv_style_set_bg_color(&styles->cb_bullet, LV_STATE_CHECKED, COLOR_BTN); - lv_style_set_bg_grad_color(&styles->cb_bullet, LV_STATE_CHECKED, COLOR_BTN_GRAD); - lv_style_set_bg_color(&styles->cb_bullet, LV_STATE_CHECKED | LV_STATE_PRESSED, COLOR_BTN_CHK_PR); - lv_style_set_bg_grad_color(&styles->cb_bullet, LV_STATE_CHECKED | LV_STATE_PRESSED, COLOR_BTN_CHK_PR_GRAD); + lv_style_set_bg_color(&styles->cb_bullet, COLOR_BTN); + lv_style_set_bg_grad_color(&styles->cb_bullet, COLOR_BTN_GRAD); + lv_style_set_bg_color(&styles->cb_bullet, COLOR_BTN_CHK_PR); + lv_style_set_bg_grad_color(&styles->cb_bullet, COLOR_BTN_CHK_PR_GRAD); - lv_style_set_bg_color(&styles->cb_bullet, LV_STATE_DISABLED, COLOR_BTN); - lv_style_set_bg_color(&styles->cb_bullet, LV_STATE_DISABLED | LV_STATE_CHECKED, COLOR_BTN_DIS); + lv_style_set_bg_color(&styles->cb_bullet, COLOR_BTN); + lv_style_set_bg_color(&styles->cb_bullet, COLOR_BTN_DIS); - lv_style_set_border_color(&styles->cb_bullet, LV_STATE_CHECKED, COLOR_BTN_BORDER_CHK); - lv_style_set_border_color(&styles->cb_bullet, LV_STATE_DISABLED, COLOR_BTN_BORDER_INA); + lv_style_set_border_color(&styles->cb_bullet, COLOR_BTN_BORDER_CHK); + lv_style_set_border_color(&styles->cb_bullet, COLOR_BTN_BORDER_INA); #endif } @@ -745,13 +743,13 @@ static void keyboard_init(void) { #if LV_USE_KEYBOARD style_init_reset(&styles->kb_bg); - lv_style_set_radius(&styles->kb_bg, LV_STATE_DEFAULT, 0); - lv_style_set_border_width(&styles->kb_bg, LV_STATE_DEFAULT, HASP_DPX(4)); - lv_style_set_border_side(&styles->kb_bg, LV_STATE_DEFAULT, LV_BORDER_SIDE_TOP); - lv_style_set_border_color(&styles->kb_bg, LV_STATE_DEFAULT, IS_LIGHT ? COLOR_BG_TEXT : LV_COLOR_BLACK); - lv_style_set_border_color(&styles->kb_bg, LV_STATE_EDITED, theme.color_secondary); - lv_style_set_pad_all(&styles->kb_bg, LV_STATE_DEFAULT, HASP_DPX(5)); - lv_style_set_pad_inner(&styles->kb_bg, LV_STATE_DEFAULT, HASP_DPX(3)); + lv_style_set_radius(&styles->kb_bg, 0); + lv_style_set_border_width(&styles->kb_bg, HASP_DPX(4)); + lv_style_set_border_side(&styles->kb_bg, LV_BORDER_SIDE_TOP); + lv_style_set_border_color(&styles->kb_bg, IS_LIGHT ? COLOR_BG_TEXT : LV_COLOR_BLACK); + lv_style_set_border_color(&styles->kb_bg, theme.color_secondary); + lv_style_set_pad_all(&styles->kb_bg, HASP_DPX(5)); + lv_style_set_pad_inner(&styles->kb_bg, HASP_DPX(3)); #endif } @@ -759,8 +757,8 @@ static void msgbox_init(void) { #if LV_USE_MSGBOX style_init_reset(&styles->mbox_bg); - lv_style_set_shadow_width(&styles->mbox_bg, LV_STATE_DEFAULT, HASP_DPX(50)); - lv_style_set_shadow_color(&styles->mbox_bg, LV_STATE_DEFAULT, IS_LIGHT ? LV_COLOR_SILVER : lv_color_hex3(0x777)); + lv_style_set_shadow_width(&styles->mbox_bg, HASP_DPX(50)); + lv_style_set_shadow_color(&styles->mbox_bg, IS_LIGHT ? LV_COLOR_SILVER : lv_color_hex3(0x777)); #endif } @@ -769,17 +767,17 @@ static void page_init(lv_style_int_t dpx7) { #if LV_USE_PAGE style_init_reset(&styles->sb); - lv_style_set_bg_opa(&styles->sb, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&styles->sb, LV_STATE_DEFAULT, SCROLLBAR_COLOR); - lv_style_set_radius(&styles->sb, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_style_set_size(&styles->sb, LV_STATE_DEFAULT, dpx7); - lv_style_set_pad_right(&styles->sb, LV_STATE_DEFAULT, dpx7); - lv_style_set_pad_bottom(&styles->sb, LV_STATE_DEFAULT, dpx7); + lv_style_set_bg_opa(&styles->sb, LV_OPA_COVER); + lv_style_set_bg_color(&styles->sb, SCROLLBAR_COLOR); + lv_style_set_radius(&styles->sb, LV_RADIUS_CIRCLE); + lv_style_set_size(&styles->sb, dpx7); + lv_style_set_pad_right(&styles->sb, dpx7); + lv_style_set_pad_bottom(&styles->sb, dpx7); #if LV_USE_ANIMATION style_init_reset(&styles->edge_flash); - lv_style_set_bg_opa(&styles->edge_flash, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&styles->edge_flash, LV_STATE_DEFAULT, lv_color_hex3(0x888)); + lv_style_set_bg_opa(&styles->edge_flash, LV_OPA_COVER); + lv_style_set_bg_color(&styles->edge_flash, lv_color_hex3(0x888)); #endif #endif } @@ -788,14 +786,13 @@ static void textarea_init(lv_style_int_t border_width) { #if LV_USE_TEXTAREA style_init_reset(&styles->ta_cursor); - lv_style_set_border_color(&styles->ta_cursor, LV_STATE_DEFAULT, COLOR_BG_SEC_TEXT); - lv_style_set_border_width(&styles->ta_cursor, LV_STATE_DEFAULT, border_width); - lv_style_set_pad_left(&styles->ta_cursor, LV_STATE_DEFAULT, HASP_DPX(1)); - lv_style_set_border_side(&styles->ta_cursor, LV_STATE_DEFAULT, LV_BORDER_SIDE_LEFT); + lv_style_set_border_color(&styles->ta_cursor, COLOR_BG_SEC_TEXT); + lv_style_set_border_width(&styles->ta_cursor, border_width); + lv_style_set_pad_left(&styles->ta_cursor, HASP_DPX(1)); + lv_style_set_border_side(&styles->ta_cursor, LV_BORDER_SIDE_LEFT); style_init_reset(&styles->ta_placeholder); - lv_style_set_text_color(&styles->ta_placeholder, LV_STATE_DEFAULT, - IS_LIGHT ? COLOR_BG_TEXT_DIS : lv_color_hex(0xa1adbd)); + lv_style_set_text_color(&styles->ta_placeholder, IS_LIGHT ? COLOR_BG_TEXT_DIS : lv_color_hex(0xa1adbd)); #endif } @@ -804,10 +801,10 @@ static void spinbox_init(void) #if LV_USE_SPINBOX style_init_reset(&styles->spinbox_cursor); - lv_style_set_bg_opa(&styles->spinbox_cursor, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&styles->spinbox_cursor, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_text_color(&styles->spinbox_cursor, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_style_set_pad_ver(&styles->spinbox_cursor, LV_STATE_DEFAULT, HASP_DPX(100)); + lv_style_set_bg_opa(&styles->spinbox_cursor, LV_OPA_COVER); + lv_style_set_bg_color(&styles->spinbox_cursor, theme.color_primary); + lv_style_set_text_color(&styles->spinbox_cursor, LV_COLOR_WHITE); + lv_style_set_pad_ver(&styles->spinbox_cursor, HASP_DPX(100)); #endif } @@ -816,51 +813,51 @@ static void list_init(lv_style_int_t pad_def, lv_style_int_t border_width) { #if LV_USE_LIST != 0 /* style_init_reset(&styles->list_bg); - lv_style_set_clip_corner(&styles->list_bg, LV_STATE_DEFAULT, true); - lv_style_set_pad_left(&styles->list_bg, LV_STATE_DEFAULT, 0); - lv_style_set_pad_right(&styles->list_bg, LV_STATE_DEFAULT, 0); - lv_style_set_pad_top(&styles->list_bg, LV_STATE_DEFAULT, 0); - lv_style_set_pad_bottom(&styles->list_bg, LV_STATE_DEFAULT, 0); - lv_style_set_pad_inner(&styles->list_bg, LV_STATE_DEFAULT, 0); + lv_style_set_clip_corner(&styles->list_bg, true); + lv_style_set_pad_left(&styles->list_bg, 0); + lv_style_set_pad_right(&styles->list_bg, 0); + lv_style_set_pad_top(&styles->list_bg, 0); + lv_style_set_pad_bottom(&styles->list_bg, 0); + lv_style_set_pad_inner(&styles->list_bg, 0); */ style_init_reset(&styles->list_btn); - lv_style_set_bg_opa(&styles->list_btn, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&styles->list_btn, LV_STATE_DEFAULT, COLOR_BG); - lv_style_set_bg_color(&styles->list_btn, LV_STATE_PRESSED, COLOR_BG_PR); - lv_style_set_bg_color(&styles->list_btn, LV_STATE_DISABLED, COLOR_BG_DIS); - lv_style_set_bg_color(&styles->list_btn, LV_STATE_CHECKED, COLOR_BG_CHK); - lv_style_set_bg_color(&styles->list_btn, LV_STATE_CHECKED | LV_STATE_PRESSED, COLOR_BG_PR_CHK); + lv_style_set_bg_opa(&styles->list_btn, LV_OPA_COVER); + lv_style_set_bg_color(&styles->list_btn, COLOR_BG); + lv_style_set_bg_color(&styles->list_btn, COLOR_BG_PR); + lv_style_set_bg_color(&styles->list_btn, COLOR_BG_DIS); + lv_style_set_bg_color(&styles->list_btn, COLOR_BG_CHK); + lv_style_set_bg_color(&styles->list_btn, COLOR_BG_PR_CHK); - lv_style_set_text_color(&styles->list_btn, LV_STATE_DEFAULT, COLOR_BG_TEXT); - lv_style_set_text_color(&styles->list_btn, LV_STATE_CHECKED, COLOR_BG_TEXT_CHK); - lv_style_set_text_color(&styles->list_btn, LV_STATE_DISABLED, COLOR_BG_TEXT_DIS); + lv_style_set_text_color(&styles->list_btn, COLOR_BG_TEXT); + lv_style_set_text_color(&styles->list_btn, COLOR_BG_TEXT_CHK); + lv_style_set_text_color(&styles->list_btn, COLOR_BG_TEXT_DIS); - lv_style_set_image_recolor(&styles->list_btn, LV_STATE_DEFAULT, COLOR_BG_TEXT); - lv_style_set_image_recolor(&styles->list_btn, LV_STATE_CHECKED, COLOR_BG_TEXT_CHK); - lv_style_set_image_recolor(&styles->list_btn, LV_STATE_DISABLED, COLOR_BG_TEXT_DIS); + lv_style_set_image_recolor(&styles->list_btn, COLOR_BG_TEXT); + lv_style_set_image_recolor(&styles->list_btn, COLOR_BG_TEXT_CHK); + lv_style_set_image_recolor(&styles->list_btn, COLOR_BG_TEXT_DIS); - lv_style_set_border_side(&styles->list_btn, LV_STATE_DEFAULT, LV_BORDER_SIDE_BOTTOM); - lv_style_set_border_color(&styles->list_btn, LV_STATE_DEFAULT, COLOR_BG_BORDER); - lv_style_set_border_color(&styles->list_btn, LV_STATE_FOCUSED, theme.color_primary); - lv_style_set_border_width(&styles->list_btn, LV_STATE_DEFAULT, border_width); + lv_style_set_border_side(&styles->list_btn, LV_BORDER_SIDE_BOTTOM); + lv_style_set_border_color(&styles->list_btn, COLOR_BG_BORDER); + lv_style_set_border_color(&styles->list_btn, theme.color_primary); + lv_style_set_border_width(&styles->list_btn, border_width); - lv_style_set_outline_color(&styles->list_btn, LV_STATE_FOCUSED, theme.color_secondary); - // lv_style_set_outline_width(&styles->list_btn, LV_STATE_FOCUSED, outline_width); - lv_style_set_outline_pad(&styles->list_btn, LV_STATE_FOCUSED, -border_width); + lv_style_set_outline_color(&styles->list_btn, theme.color_secondary); + // lv_style_set_outline_width(&styles->list_btn, outline_width); + lv_style_set_outline_pad(&styles->list_btn, -border_width); - lv_style_set_pad_all(&styles->list_btn, LV_STATE_DEFAULT, pad_def); - lv_style_set_pad_inner(&styles->list_btn, LV_STATE_DEFAULT, pad_def); + lv_style_set_pad_all(&styles->list_btn, pad_def); + lv_style_set_pad_inner(&styles->list_btn, pad_def); - lv_style_set_transform_width(&styles->list_btn, LV_STATE_DEFAULT, -pad_def); - lv_style_set_transform_width(&styles->list_btn, LV_STATE_PRESSED, -border_width); - lv_style_set_transform_width(&styles->list_btn, LV_STATE_CHECKED, -border_width); - lv_style_set_transform_width(&styles->list_btn, LV_STATE_DISABLED, -border_width); - lv_style_set_transform_width(&styles->list_btn, LV_STATE_FOCUSED, -border_width); + lv_style_set_transform_width(&styles->list_btn, -pad_def); + lv_style_set_transform_width(&styles->list_btn, -border_width); + lv_style_set_transform_width(&styles->list_btn, -border_width); + lv_style_set_transform_width(&styles->list_btn, -border_width); + lv_style_set_transform_width(&styles->list_btn, -border_width); - lv_style_set_transition_time(&styles->list_btn, LV_STATE_DEFAULT, TRANSITION_TIME); - lv_style_set_transition_prop_6(&styles->list_btn, LV_STATE_DEFAULT, LV_STYLE_BG_COLOR); - lv_style_set_transition_prop_5(&styles->list_btn, LV_STATE_DEFAULT, LV_STYLE_TRANSFORM_WIDTH); + lv_style_set_transition_time(&styles->list_btn, TRANSITION_TIME); + lv_style_set_transition_prop_6(&styles->list_btn, LV_STYLE_BG_COLOR); + lv_style_set_transition_prop_5(&styles->list_btn, LV_STYLE_TRANSFORM_WIDTH); #endif } @@ -869,17 +866,17 @@ static void ddlist_init(void) #if LV_USE_DROPDOWN != 0 /* style_init_reset(&styles->ddlist_page); - lv_style_set_text_line_space(&styles->ddlist_page, LV_STATE_DEFAULT, HASP_DPX(20)); - lv_style_set_clip_corner(&styles->ddlist_page, LV_STATE_DEFAULT, true); + lv_style_set_text_line_space(&styles->ddlist_page, HASP_DPX(20)); + lv_style_set_clip_corner(&styles->ddlist_page, true); style_init_reset(&styles->ddlist_sel); - lv_style_set_radius(&styles->ddlist_sel, LV_STATE_DEFAULT, 0); - // lv_style_set_bg_opa(&styles->ddlist_sel, LV_STATE_DEFAULT, LV_OPA_COVER); - // lv_style_set_bg_color(&styles->ddlist_sel, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_text_color(&styles->ddlist_sel, LV_STATE_DEFAULT, + lv_style_set_radius(&styles->ddlist_sel, 0); + // lv_style_set_bg_opa(&styles->ddlist_sel, LV_OPA_COVER); + // lv_style_set_bg_color(&styles->ddlist_sel, theme.color_primary); + lv_style_set_text_color(&styles->ddlist_sel, IS_LIGHT ?LV_COLOR_WHITE :LV_COLOR_WHITE); - lv_style_set_bg_color(&styles->ddlist_sel, LV_STATE_PRESSED, COLOR_BG_PR); - lv_style_set_text_color(&styles->ddlist_sel, LV_STATE_PRESSED, COLOR_BG_TEXT_PR); + lv_style_set_bg_color(&styles->ddlist_sel, COLOR_BG_PR); + lv_style_set_text_color(&styles->ddlist_sel, COLOR_BG_TEXT_PR); */ #endif } @@ -888,12 +885,12 @@ static void roller_init(void) { #if LV_USE_ROLLER != 0 /* style_init_reset(&styles->roller_bg); - lv_style_set_text_line_space(&styles->roller_bg, LV_STATE_DEFAULT, HASP_DPX(25)); + lv_style_set_text_line_space(&styles->roller_bg, HASP_DPX(25)); style_init_reset(&styles->roller_sel); - lv_style_set_bg_opa(&styles->roller_sel, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&styles->roller_sel, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_text_color(&styles->roller_sel, LV_STATE_DEFAULT, LV_COLOR_WHITE);*/ + lv_style_set_bg_opa(&styles->roller_sel, LV_OPA_COVER); + lv_style_set_bg_color(&styles->roller_sel, theme.color_primary); + lv_style_set_text_color(&styles->roller_sel, LV_COLOR_WHITE);*/ #endif } @@ -913,10 +910,10 @@ static void table_init(lv_style_int_t pad_def) { #if LV_USE_TABLE != 0 style_init_reset(&styles->table_cell); - lv_style_set_border_color(&styles->table_cell, LV_STATE_DEFAULT, COLOR_BG_BORDER); - lv_style_set_border_width(&styles->table_cell, LV_STATE_DEFAULT, 1); - lv_style_set_border_side(&styles->table_cell, LV_STATE_DEFAULT, LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_BOTTOM); - lv_style_set_pad_all(&styles->table_cell, LV_STATE_DEFAULT, pad_def); + lv_style_set_border_color(&styles->table_cell, COLOR_BG_BORDER); + lv_style_set_border_width(&styles->table_cell, 1); + lv_style_set_border_side(&styles->table_cell, LV_BORDER_SIDE_TOP | LV_BORDER_SIDE_BOTTOM); + lv_style_set_pad_all(&styles->table_cell, pad_def); #endif } @@ -930,31 +927,31 @@ static void tabview_win_shared_init(lv_style_int_t pad_def, lv_style_int_t dpx7, { #if LV_USE_TABVIEW || LV_USE_WIN style_init_reset(&styles->tabview_btns_bg); - lv_style_set_bg_opa(&styles->tabview_btns_bg, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&styles->tabview_btns_bg, LV_STATE_DEFAULT, COLOR_SCR_GRAD); - lv_style_set_text_color(&styles->tabview_btns_bg, LV_STATE_DEFAULT, color_scr_text); - lv_style_set_image_recolor(&styles->tabview_btns_bg, LV_STATE_DEFAULT, lv_color_hex(0x979a9f)); - lv_style_set_pad_top(&styles->tabview_btns_bg, LV_STATE_DEFAULT, dpx7); - lv_style_set_pad_hor(&styles->tabview_btns_bg, LV_STATE_DEFAULT, dpx7); + lv_style_set_bg_opa(&styles->tabview_btns_bg, LV_OPA_COVER); + lv_style_set_bg_color(&styles->tabview_btns_bg, COLOR_SCR_GRAD); + lv_style_set_text_color(&styles->tabview_btns_bg, color_scr_text); + lv_style_set_image_recolor(&styles->tabview_btns_bg, lv_color_hex(0x979a9f)); + lv_style_set_pad_top(&styles->tabview_btns_bg, dpx7); + lv_style_set_pad_hor(&styles->tabview_btns_bg, dpx7); style_init_reset(&styles->tabview_btns); - lv_style_set_bg_opa(&styles->tabview_btns, LV_STATE_PRESSED, LV_OPA_50); - lv_style_set_bg_color(&styles->tabview_btns, LV_STATE_PRESSED, lv_color_hex3(0x888)); - lv_style_set_text_color(&styles->tabview_btns, LV_STATE_CHECKED, color_scr_text); - lv_style_set_pad_ver(&styles->tabview_btns, LV_STATE_DEFAULT, HASP_DPX(20)); - lv_style_set_text_color(&styles->tabview_btns, LV_STATE_FOCUSED, theme.color_primary); - lv_style_set_text_color(&styles->tabview_btns, LV_STATE_EDITED, theme.color_secondary); + lv_style_set_bg_opa(&styles->tabview_btns, LV_OPA_50); + lv_style_set_bg_color(&styles->tabview_btns, lv_color_hex3(0x888)); + lv_style_set_text_color(&styles->tabview_btns, color_scr_text); + lv_style_set_pad_ver(&styles->tabview_btns, HASP_DPX(20)); + lv_style_set_text_color(&styles->tabview_btns, theme.color_primary); + lv_style_set_text_color(&styles->tabview_btns, theme.color_secondary); style_init_reset(&styles->tabview_indic); - lv_style_set_bg_opa(&styles->tabview_indic, LV_STATE_DEFAULT, LV_OPA_COVER); - lv_style_set_bg_color(&styles->tabview_indic, LV_STATE_DEFAULT, theme.color_primary); - lv_style_set_bg_color(&styles->tabview_indic, LV_STATE_EDITED, theme.color_secondary); - lv_style_set_size(&styles->tabview_indic, LV_STATE_DEFAULT, HASP_DPX(5)); - lv_style_set_radius(&styles->tabview_indic, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + lv_style_set_bg_opa(&styles->tabview_indic, LV_OPA_COVER); + lv_style_set_bg_color(&styles->tabview_indic, theme.color_primary); + lv_style_set_bg_color(&styles->tabview_indic, theme.color_secondary); + lv_style_set_size(&styles->tabview_indic, HASP_DPX(5)); + lv_style_set_radius(&styles->tabview_indic, LV_RADIUS_CIRCLE); style_init_reset(&styles->tabview_page_scrl); - lv_style_set_pad_all(&styles->tabview_page_scrl, LV_STATE_DEFAULT, pad_def); - lv_style_set_pad_inner(&styles->tabview_page_scrl, LV_STATE_DEFAULT, pad_def); + lv_style_set_pad_all(&styles->tabview_page_scrl, pad_def); + lv_style_set_pad_inner(&styles->tabview_page_scrl, pad_def); #endif } @@ -1044,7 +1041,7 @@ lv_theme_t* lv_theme_hasp_init(lv_color_t color_primary, lv_color_t color_second return &theme; } -static void theme_apply(lv_theme_t* th, lv_obj_t* obj, lv_theme_style_t name) +static void theme_apply(lv_theme_t* th, lv_obj_t* obj) { LV_UNUSED(th); @@ -1506,3 +1503,5 @@ static void style_init_reset(lv_style_t* style) } //#endif + +#endif \ No newline at end of file diff --git a/src/hasp_debug.cpp b/src/hasp_debug.cpp index dd51f515..03a23ff0 100644 --- a/src/hasp_debug.cpp +++ b/src/hasp_debug.cpp @@ -138,39 +138,10 @@ void debugStop() /* ===== Special Event Processors ===== */ -void debugLvglLogEvent(lv_log_level_t level, const char* file, uint32_t line, const char* funcname, const char* descr) +void debugLvglLogEvent(const char* line) { #if LV_USE_LOG != 0 - /* used for duplicate detection */ - static const char* last_funcname; - static uint32_t lastDbgLine; - // static uint32_t lastDbgFreeMem; - - /* Reduce the number of repeated debug message */ - if(line == lastDbgLine && funcname == last_funcname) return; - - // lv_mem_monitor_t mem_mon; - // lv_mem_monitor(&mem_mon); - - /* Reduce the number of repeated debug message */ - // if(line != lastDbgLine || mem_mon.free_biggest_size != lastDbgFreeMem) { - switch(level) { - case LV_LOG_LEVEL_TRACE: - LOG_VERBOSE(TAG_LVGL, descr); - break; - case LV_LOG_LEVEL_WARN: - LOG_WARNING(TAG_LVGL, descr); - break; - case LV_LOG_LEVEL_ERROR: - LOG_ERROR(TAG_LVGL, descr); - break; - default: - LOG_TRACE(TAG_LVGL, descr); - } - last_funcname = funcname; - lastDbgLine = line; - // lastDbgFreeMem = mem_mon.free_biggest_size; - //} + LOG_VERBOSE(TAG_LVGL, line); #endif } diff --git a/src/hasp_debug.h b/src/hasp_debug.h index 275ec663..358b5a87 100644 --- a/src/hasp_debug.h +++ b/src/hasp_debug.h @@ -134,7 +134,7 @@ extern "C" { #endif // Functions used by ANDROID, WINDOWS and POSSIX -void debugLvglLogEvent(lv_log_level_t level, const char* file, uint32_t line, const char* funcname, const char* descr); +void debugLvglLogEvent(const char* line); IRAM_ATTR void debugLoop(void); void debugEverySecond(void); void debugStart(void); diff --git a/src/hasp_gui.cpp b/src/hasp_gui.cpp index dc2adf24..744c2e04 100644 --- a/src/hasp_gui.cpp +++ b/src/hasp_gui.cpp @@ -6,7 +6,7 @@ #include "lv_drv_conf.h" // Filesystem Driver -#include "lv_misc/lv_fs.h" +#include "misc/lv_fs.h" #include "lv_fs_if.h" // Device Drivers @@ -188,8 +188,8 @@ void guiSetup() static lv_disp_drv_t disp_drv; lv_disp_drv_init(&disp_drv); - disp_drv.buffer = &disp_buf; - disp_drv.flush_cb = gui_flush_cb; + disp_drv.buffer = &disp_buf; + disp_drv->flush_cb = gui_flush_cb; if(gui_settings.rotation % 2) { disp_drv.hor_res = tft_height; @@ -206,7 +206,7 @@ void guiSetup() static lv_disp_drv_t disp_drv; lv_disp_drv_init(&disp_drv); - disp_drv.buffer = &disp_buf; + disp_drv.draw_buf = &disp_buf; disp_drv.flush_cb = gui_flush_cb; disp_drv.hor_res = tft_width; @@ -220,7 +220,7 @@ void guiSetup() static lv_disp_drv_t disp_drv; lv_disp_drv_init(&disp_drv); - disp_drv.buffer = &disp_buf; + disp_drv.draw_buf = &disp_buf; disp_drv.flush_cb = gui_flush_cb; disp_drv.hor_res = tft_height; @@ -234,7 +234,7 @@ void guiSetup() static lv_disp_drv_t disp_drv; lv_disp_drv_init(&disp_drv); - disp_drv.buffer = &disp_buf; + disp_drv.draw_buf = &disp_buf; disp_drv.flush_cb = gui_flush_cb; disp_drv.hor_res = tft_width; @@ -301,8 +301,8 @@ void guiSetup() #else indev_drv.read_cb = touch_read; #endif - lv_indev_t* mouse_indev = lv_indev_drv_register(&indev_drv); - mouse_indev->driver.type = LV_INDEV_TYPE_POINTER; + lv_indev_t* mouse_indev = lv_indev_drv_register(&indev_drv); + mouse_indev->driver->type = LV_INDEV_TYPE_POINTER; /*Set a cursor for the mouse*/ if(gui_settings.show_pointer) { @@ -316,14 +316,14 @@ void guiSetup() #if defined(ARDUINO_ARCH_ESP32) LV_IMG_DECLARE(mouse_cursor_icon); /*Declare the image file.*/ - cursor = lv_img_create(mouse_layer, NULL); /*Create an image object for the cursor */ + cursor = lv_img_create(mouse_layer); /*Create an image object for the cursor */ lv_img_set_src(cursor, &mouse_cursor_icon); /*Set the image source*/ #else - cursor = lv_obj_create(mouse_layer, NULL); // show cursor object on every page + cursor = lv_obj_create(mouse_layer); // show cursor object on every page lv_obj_set_size(cursor, 9, 9); - lv_obj_set_style_local_radius(cursor, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); - lv_obj_set_style_local_bg_color(cursor, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_RED); - lv_obj_set_style_local_bg_opa(cursor, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_COVER); + lv_obj_set_style_local_radius(cursor, LV_OBJ_PART_MAIN | LV_STATE_DEFAULT, LV_RADIUS_CIRCLE); + lv_obj_set_style_local_bg_color(cursor, LV_OBJ_PART_MAIN | LV_STATE_DEFAULT, LV_COLOR_RED); + lv_obj_set_style_bg_opa(cursor, LV_OBJ_PART_MAIN | LV_STATE_DEFAULT, LV_OPA_COVER); #endif lv_indev_set_cursor(mouse_indev, cursor); /*Connect the image object to the driver*/ } @@ -336,19 +336,21 @@ void guiSetup() /* Initialize Global progress bar*/ lv_obj_user_data_t udata = (lv_obj_user_data_t){10, 0, 10}; - lv_obj_t* bar = lv_bar_create(lv_layer_sys(), NULL); - lv_obj_set_user_data(bar, udata); + lv_obj_t* bar = lv_bar_create(lv_layer_sys()); + lv_obj_set_user_data(bar, (void*)&udata); lv_obj_set_hidden(bar, true); lv_bar_set_range(bar, 0, 100); lv_bar_set_value(bar, 10, LV_ANIM_OFF); lv_obj_set_size(bar, 200, 15); - lv_obj_align(bar, lv_layer_sys(), LV_ALIGN_CENTER, 0, -10); - lv_obj_set_style_local_value_color(bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, LV_COLOR_WHITE); - lv_obj_set_style_local_value_align(bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, LV_ALIGN_CENTER); - lv_obj_set_style_local_value_ofs_y(bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, 20); - lv_obj_set_style_local_value_font(bar, LV_BAR_PART_BG, LV_STATE_DEFAULT, LV_FONT_DEFAULT); - lv_obj_set_style_local_bg_color(lv_layer_sys(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_COLOR_BLACK); - lv_obj_set_style_local_bg_opa(lv_layer_sys(), LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, LV_OPA_0); + // lv_obj_align(bar, lv_layer_sys(), LV_ALIGN_CENTER, 0, -10); +#if 0 + lv_obj_set_style_value_color(bar, LV_PART_MAIN | LV_STATE_DEFAULT, LV_COLOR_WHITE); + lv_obj_set_style_value_align(bar, LV_PART_MAIN | LV_STATE_DEFAULT, LV_ALIGN_CENTER); + lv_obj_set_style_local_value_ofs_y(bar, LV_PART_MAIN | LV_STATE_DEFAULT, 20); + lv_obj_set_style_local_value_font(bar, LV_PART_MAIN | LV_STATE_DEFAULT, LV_FONT_DEFAULT); + lv_obj_set_style_local_bg_color(lv_layer_sys(), LV_PART_MAIN | LV_STATE_DEFAULT, LV_COLOR_BLACK); + lv_obj_set_style_bg_opa(lv_layer_sys(), LV_PART_MAIN | LV_STATE_DEFAULT, LV_OPA_0); +#endif // guiStart(); // Ticker LOG_INFO(TAG_LVGL, F(D_SERVICE_STARTED)); @@ -567,7 +569,7 @@ static void gui_get_bitmap_header(uint8_t* buffer, size_t bufsize) lv_obj_t* scr = lv_disp_get_scr_act(NULL); // file size - guiSetBmpHeader(&buffer[2], 122 + disp->driver.hor_res * disp->driver.ver_res * buffer[28] / 8); + guiSetBmpHeader(&buffer[2], 122 + disp->driver->hor_res * disp->driver->ver_res * buffer[28] / 8); // horizontal resolution guiSetBmpHeader(&buffer[18], lv_obj_get_width(scr)); // guiSetBmpHeader(&buffer[18], disp->driver.hor_res); @@ -640,13 +642,13 @@ void guiTakeScreenshot(const char* pFileName) /* Refresh screen to screenshot callback */ lv_disp_t* disp = lv_disp_get_default(); - void (*flush_cb)(struct _disp_drv_t * disp_drv, const lv_area_t* area, lv_color_t* color_p); - flush_cb = disp->driver.flush_cb; /* store callback */ - disp->driver.flush_cb = gui_screenshot_to_file; + void (*flush_cb)(struct _lv_disp_drv_t * disp_drv, const lv_area_t* area, lv_color_t* color_p); + flush_cb = disp->driver->flush_cb; /* store callback */ + disp->driver->flush_cb = gui_screenshot_to_file; lv_obj_invalidate(lv_scr_act()); - lv_refr_now(NULL); /* Will call our disp_drv.disp_flush function */ - disp->driver.flush_cb = flush_cb; /* restore callback */ + lv_refr_now(NULL); /* Will call our disp_drv.disp_flush function */ + disp->driver->flush_cb = flush_cb; /* restore callback */ LOG_VERBOSE(TAG_GUI, F("Bitmap data flushed to %s"), pFileName); @@ -692,12 +694,12 @@ void guiTakeScreenshot() /* Refresh screen to screenshot callback */ lv_disp_t* disp = lv_disp_get_default(); - void (*flush_cb)(struct _disp_drv_t * disp_drv, const lv_area_t* area, lv_color_t* color_p); - flush_cb = disp->driver.flush_cb; /* store callback */ - disp->driver.flush_cb = gui_screenshot_to_http; + void (*flush_cb)(struct _lv_disp_drv_t * disp_drv, const lv_area_t* area, lv_color_t* color_p); + flush_cb = disp->driver->flush_cb; /* store callback */ + disp->driver->flush_cb = gui_screenshot_to_http; lv_obj_invalidate(lv_scr_act()); - lv_refr_now(NULL); /* Will call our disp_drv.disp_flush function */ - disp->driver.flush_cb = flush_cb; /* restore callback */ + lv_refr_now(NULL); /* Will call our disp_drv.disp_flush function */ + disp->driver->flush_cb = flush_cb; /* restore callback */ LOG_VERBOSE(TAG_GUI, F("Bitmap data flushed to webclient")); } else { diff --git a/src/hasp_oobe.cpp b/src/hasp_oobe.cpp index d7bb2a38..325f9a2c 100644 --- a/src/hasp_oobe.cpp +++ b/src/hasp_oobe.cpp @@ -31,26 +31,32 @@ static void oobeSetPage(uint8_t pageid) lv_obj_invalidate(lv_disp_get_layer_sys(NULL)); } -void gotoPage1_cb(lv_obj_t* event_kb, lv_event_t event) +void gotoPage1_cb(lv_event_t* e) { + lv_event_code_t event = lv_event_get_code(e); + if(event == LV_EVENT_RELEASED) { lv_obj_set_click(lv_disp_get_layer_sys(NULL), false); oobeSetPage(1); } } -static void peek_password_cb(lv_obj_t* obj, lv_event_t event) +static void peek_password_cb(lv_event_t* e) { + lv_event_code_t event = lv_event_get_code(e); + if(event == LV_EVENT_VALUE_CHANGED) { - lv_obj_set_style_local_value_str(obj, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, - lv_btn_get_state(obj) ? LV_SYMBOL_EYE_OPEN : LV_SYMBOL_EYE_CLOSE); - lv_textarea_set_pwd_mode(pwd_ta, !lv_btn_get_state(obj)); + // lv_obj_set_style_value_str(obj, LV_PART_MAIN | LV_STATE_DEFAULT, + // lv_btn_get_state(obj) ? LV_SYMBOL_EYE_OPEN : LV_SYMBOL_EYE_CLOSE); + // lv_textarea_set_password_mode(pwd_ta, !lv_btn_get_state(obj)); } } -static void kb_event_cb(lv_obj_t* event_kb, lv_event_t event) +static void kb_event_cb(lv_event_t* e) { - if(event == LV_EVENT_APPLY) { + lv_event_code_t event = lv_event_get_code(e); + + if(event == LV_EVENT_READY) { // LV_EVENT_APPLY StaticJsonDocument<256> settings; char ssid[64] = ""; char pass[64] = ""; @@ -80,20 +86,26 @@ static void kb_event_cb(lv_obj_t* event_kb, lv_event_t event) lv_obj_set_click(lv_disp_get_layer_sys(NULL), true); } else { /* prevent double presses, swipes and ghost press on tiny keyboard */ - if(event == LV_EVENT_RELEASED) lv_keyboard_def_event_cb(event_kb, LV_EVENT_VALUE_CHANGED); + // if(event == LV_EVENT_RELEASED) lv_keyboard_def_event_cb(event_kb, LV_EVENT_VALUE_CHANGED); + if(event == LV_EVENT_RELEASED) lv_keyboard_def_event_cb(e); /* Just call the regular event handler */ // lv_kb_def_event_cb(event_kb, event); } } -static void ta_event_cb(lv_obj_t* ta, lv_event_t event) +static void ta_event_cb(lv_event_t* e) { + lv_event_code_t event = lv_event_get_code(e); + lv_obj_t* obj = lv_event_get_target(e); + lv_obj_t* ta = (lv_obj_t*)lv_event_get_user_data(e); + if(event == LV_EVENT_CLICKED) { /* Focus on the clicked text area */ if(oobekb != NULL) lv_keyboard_set_textarea(oobekb, ta); } else if(event == LV_EVENT_INSERT) { - const char* str = (const char*)lv_event_get_data(); + const char* str = lv_btnmatrix_get_btn_text(obj, lv_btnmatrix_get_selected_btn(obj)); + if(str[0] == '\n') { lv_obj_t* obj; @@ -115,12 +127,12 @@ static void ta_event_cb(lv_obj_t* ta, lv_event_t event) static void oobeSetupQR(const char* ssid, const char* pass) { lv_disp_t* disp = lv_disp_get_default(); - oobepage[0] = lv_obj_create(NULL, NULL); + oobepage[0] = lv_obj_create(NULL); char buffer[128]; - lv_obj_t* container = lv_cont_create(oobepage[0], NULL); + lv_obj_t* container = lv_cont_create(oobepage[0]); lv_obj_set_pos(container, 5, 5); - // lv_obj_set_style_local_bg_opa(container, LV_ARC_PART_BG, LV_STATE_DEFAULT, 0); - // lv_obj_set_style_local_border_opa(container, LV_ARC_PART_BG, LV_STATE_DEFAULT, 0); + // lv_obj_set_style_bg_opa(container, LV_ARC_PART_BG, LV_STATE_DEFAULT, 0); + // lv_obj_set_style_border_opa(container, LV_ARC_PART_BG, LV_STATE_DEFAULT, 0); #if HASP_USE_QRCODE > 0 snprintf_P(buffer, sizeof(buffer), PSTR("WIFI:S:%s;T:WPA;P:%s;;"), ssid, pass); @@ -128,37 +140,37 @@ static void oobeSetupQR(const char* ssid, const char* pass) lv_obj_t* qr = lv_qrcode_create(oobepage[0], 120, LV_COLOR_BLACK, LV_COLOR_WHITE); lv_qrcode_update(qr, buffer, strlen(buffer)); - lv_obj_t* qrlabel = lv_label_create(oobepage[0], NULL); + lv_obj_t* qrlabel = lv_label_create(oobepage[0]); snprintf_P(buffer, sizeof(buffer), PSTR(D_OOBE_SCAN_TO_CONNECT)); lv_label_set_text(qrlabel, buffer); - if(disp->driver.hor_res <= disp->driver.ver_res) { - lv_obj_align(qr, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -5); - lv_obj_set_size(container, disp->driver.hor_res - 10, disp->driver.ver_res - 10 - 125); - lv_obj_align(qrlabel, container, LV_ALIGN_IN_BOTTOM_MID, 0, 0); + if(disp->driver->hor_res <= disp->driver->ver_res) { + // lv_obj_align(qr, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, -5); + lv_obj_set_size(container, disp->driver->hor_res - 10, disp->driver->ver_res - 10 - 125); + // lv_obj_align(qrlabel, container, LV_ALIGN_IN_BOTTOM_MID, 0, 0); } else { - lv_obj_align(qr, NULL, LV_ALIGN_IN_RIGHT_MID, -5, 0); - lv_obj_set_size(container, disp->driver.hor_res - 10 - 125, disp->driver.ver_res - 10); - lv_obj_align(qrlabel, qr, LV_ALIGN_OUT_BOTTOM_MID, 0, 5); + // lv_obj_align(qr, NULL, LV_ALIGN_IN_RIGHT_MID, -5, 0); + lv_obj_set_size(container, disp->driver->hor_res - 10 - 125, disp->driver->ver_res - 10); + // lv_obj_align(qrlabel, qr, LV_ALIGN_OUT_BOTTOM_MID, 0, 5); } #else - lv_obj_set_size(container, disp->driver.hor_res, disp->driver.ver_res); + lv_obj_set_size(container, disp->driver->hor_res, disp->driver->ver_res); #endif - lv_obj_t* aplabel = lv_label_create(container, NULL); + lv_obj_t* aplabel = lv_label_create(container); snprintf_P(buffer, sizeof(buffer), PSTR(D_OOBE_MSG)); lv_label_set_text(aplabel, buffer); - lv_label_set_long_mode(aplabel, LV_LABEL_LONG_BREAK); + lv_label_set_long_mode(aplabel, LV_LABEL_LONG_WRAP); lv_obj_set_width(aplabel, lv_obj_get_width(container)); - lv_label_set_align(aplabel, LV_LABEL_ALIGN_CENTER); + lv_obj_set_align(aplabel, LV_TEXT_ALIGN_CENTER); - lv_obj_align(aplabel, container, LV_ALIGN_IN_TOP_MID, 0, 0); + // lv_obj_align(aplabel, container, LV_ALIGN_IN_TOP_MID, 0, 0); - lv_obj_t* panel = lv_cont_create(container, NULL); - lv_obj_align(panel, aplabel, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); + lv_obj_t* panel = lv_cont_create(container); + // lv_obj_align(panel, aplabel, LV_ALIGN_OUT_BOTTOM_MID, 0, 10); lv_cont_set_fit(panel, LV_FIT_TIGHT); @@ -168,17 +180,17 @@ static void oobeSetupQR(const char* ssid, const char* pass) txt.reserve(64); txt = String(LV_SYMBOL_WIFI) + " " + String(ssid); - lv_obj_t* network = lv_label_create(panel, NULL); + lv_obj_t* network = lv_label_create(panel); lv_label_set_text(network, txt.c_str()); - lv_obj_t* password = lv_label_create(panel, NULL); + lv_obj_t* password = lv_label_create(panel); txt = String(F(LV_SYMBOL_KEY)) + " " + String(pass); lv_label_set_text(password, txt.c_str()); } static void oobeSetupSsid(void) { - lv_font_t* defaultfont; + const lv_font_t* defaultfont; // #if defined(ARDUINO_ARCH_ESP32) // defaultfont = &lv_font_montserrat_12; // #else @@ -190,7 +202,7 @@ static void oobeSetupSsid(void) lv_obj_user_data_t udata = {0, 0, 0}; lv_disp_t* disp = lv_disp_get_default(); - if(disp->driver.hor_res <= disp->driver.ver_res) { + if(disp->driver->hor_res <= disp->driver->ver_res) { leftmargin = 0; topmargin = -35; voffset = 12; @@ -202,54 +214,54 @@ static void oobeSetupSsid(void) labelpos = LV_ALIGN_OUT_LEFT_MID; } - oobepage[1] = lv_obj_create(NULL, NULL); + oobepage[1] = lv_obj_create(NULL); char buffer[32]; /* Create the password box */ - pwd_ta = lv_textarea_create(oobepage[1], NULL); - lv_obj_set_style_local_text_font(pwd_ta, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, defaultfont); + pwd_ta = lv_textarea_create(oobepage[1]); + lv_obj_set_style_text_font(pwd_ta, defaultfont, LV_PART_MAIN | LV_STATE_DEFAULT); lv_textarea_set_text(pwd_ta, ""); lv_textarea_set_max_length(pwd_ta, 32); - lv_textarea_set_pwd_mode(pwd_ta, true); + lv_textarea_set_password_mode(pwd_ta, true); lv_textarea_set_one_line(pwd_ta, true); lv_textarea_set_cursor_hidden(pwd_ta, true); udata.id = 20; - lv_obj_set_user_data(pwd_ta, udata); - lv_obj_set_width(pwd_ta, disp->driver.hor_res - leftmargin - 20 - lv_obj_get_height(pwd_ta)); + lv_obj_set_user_data(pwd_ta, (lv_obj_user_data_t*)&udata); + lv_obj_set_width(pwd_ta, disp->driver->hor_res - leftmargin - 20 - lv_obj_get_height(pwd_ta)); lv_obj_set_event_cb(pwd_ta, ta_event_cb); - lv_obj_align(pwd_ta, NULL, LV_ALIGN_CENTER, leftmargin / 2 - lv_obj_get_height(pwd_ta) / 2, topmargin - voffset); + // lv_obj_align(pwd_ta, NULL, LV_ALIGN_CENTER, leftmargin / 2 - lv_obj_get_height(pwd_ta) / 2, topmargin - voffset); - lv_obj_t* pwd_icon = lv_btn_create(oobepage[1], NULL); + lv_obj_t* pwd_icon = lv_btn_create(oobepage[1]); lv_obj_set_size(pwd_icon, lv_obj_get_height(pwd_ta), lv_obj_get_height(pwd_ta)); lv_obj_set_pos(pwd_icon, lv_obj_get_x(pwd_ta) + lv_obj_get_width(pwd_ta), lv_obj_get_y(pwd_ta)); - lv_obj_set_style_local_value_str(pwd_icon, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, LV_SYMBOL_EYE_CLOSE); - lv_obj_set_style_local_radius(pwd_icon, LV_BTN_PART_MAIN, LV_STATE_DEFAULT, - lv_obj_get_style_radius(pwd_ta, LV_TEXTAREA_PART_BG)); + lv_obj_set_style_value_str(pwd_icon, LV_PART_MAIN | LV_STATE_DEFAULT, LV_SYMBOL_EYE_CLOSE); + lv_obj_set_style_radius(pwd_icon, lv_obj_get_style_radius(pwd_ta, LV_TEXTAREA_PART_BG), + LV_PART_MAIN | LV_STATE_DEFAULT); lv_obj_set_event_cb(pwd_icon, peek_password_cb); lv_btn_set_checkable(pwd_icon, true); /* Create the one-line mode text area */ - lv_obj_t* oneline_ta = lv_textarea_create(oobepage[1], pwd_ta); + lv_obj_t* oneline_ta = lv_textarea_create(oobepage[1]); // pwd_ta - lv_obj_set_style_local_text_font(oneline_ta, LV_OBJ_PART_MAIN, LV_STATE_DEFAULT, defaultfont); + lv_obj_set_style_text_font(oneline_ta, defaultfont, LV_OBJ_PART_MAIN | LV_STATE_DEFAULT); - lv_textarea_set_pwd_mode(oneline_ta, false); + lv_textarea_set_password_mode(oneline_ta, false); udata.id = 10; - lv_obj_set_user_data(oneline_ta, udata); - lv_obj_align(oneline_ta, pwd_ta, LV_ALIGN_OUT_TOP_MID, 0, topmargin); + lv_obj_set_user_data(oneline_ta, (lv_obj_user_data_t*)&udata); + // lv_obj_align(oneline_ta, pwd_ta, LV_ALIGN_OUT_TOP_MID, 0, topmargin); /* Create a label and position it above the text box */ - lv_obj_t* pwd_label = lv_label_create(oobepage[1], NULL); + lv_obj_t* pwd_label = lv_label_create(oobepage[1]); snprintf_P(buffer, sizeof(buffer), PSTR(D_PASSWORD)); lv_label_set_text(pwd_label, buffer); - lv_obj_align(pwd_label, pwd_ta, labelpos, 0, 0); + // lv_obj_align(pwd_label, pwd_ta, labelpos, 0, 0); /* Create a label and position it above the text box */ - lv_obj_t* oneline_label = lv_label_create(oobepage[1], NULL); + lv_obj_t* oneline_label = lv_label_create(oobepage[1]); snprintf_P(buffer, sizeof(buffer), PSTR(D_SSID)); lv_label_set_text(oneline_label, buffer); - lv_obj_align(oneline_label, oneline_ta, labelpos, 0, 0); + // lv_obj_align(oneline_label, oneline_ta, labelpos, 0, 0); /* Create a keyboard and make it fill the width of the above text areas */ #if LVGL_VERSION_MAJOR == 8 @@ -258,16 +270,16 @@ static void oobeSetupSsid(void) oobekb = lv_keyboard_create(oobepage[1], NULL); #endif - lv_obj_set_style_local_pad_inner(oobekb, LV_BTNMATRIX_PART_BG, LV_STATE_DEFAULT, 0); - lv_obj_set_style_local_border_width(oobekb, LV_BTNMATRIX_PART_BG, LV_STATE_DEFAULT, 0); - lv_obj_set_style_local_border_width(oobekb, LV_BTNMATRIX_PART_BTN, LV_STATE_DEFAULT, 1); - lv_obj_set_style_local_radius(oobekb, LV_BTNMATRIX_PART_BTN, LV_STATE_DEFAULT, 0); + // lv_obj_set_style_pad_inner(oobekb, LV_BTNMATRIX_PART_BG, LV_STATE_DEFAULT, 0); + // lv_obj_set_style_border_width(oobekb, LV_BTNMATRIX_PART_BG, LV_STATE_DEFAULT, 0); + // lv_obj_set_style_border_width(oobekb, LV_BTNMATRIX_PART_BTN, LV_STATE_DEFAULT, 1); + // lv_obj_set_style_radius(oobekb, LV_BTNMATRIX_PART_BTN, LV_STATE_DEFAULT, 0); - lv_obj_set_style_local_text_font(oobekb, LV_KEYBOARD_PART_BG, LV_STATE_DEFAULT, defaultfont); - lv_obj_set_style_local_radius(oobekb, LV_KEYBOARD_PART_BG, LV_STATE_DEFAULT, 0); - lv_obj_set_style_local_border_color(oobekb, LV_KEYBOARD_PART_BTN, LV_STATE_DEFAULT, LV_COLOR_SILVER); - lv_obj_set_style_local_border_color(oobekb, LV_KEYBOARD_PART_BTN, LV_STATE_PRESSED, LV_COLOR_PURPLE); - lv_obj_set_style_local_bg_color(oobekb, LV_KEYBOARD_PART_BTN, LV_BTN_STATE_PRESSED, LV_COLOR_PURPLE); + // lv_obj_set_style_text_font(oobekb, LV_KEYBOARD_PART_BG, LV_STATE_DEFAULT, defaultfont); + // lv_obj_set_style_radius(oobekb, LV_KEYBOARD_PART_BG, LV_STATE_DEFAULT, 0); + // lv_obj_set_style_border_color(oobekb, LV_KEYBOARD_PART_BTN, LV_STATE_DEFAULT, LV_COLOR_SILVER); + // lv_obj_set_style_border_color(oobekb, LV_KEYBOARD_PART_BTN, LV_STATE_PRESSED, LV_COLOR_PURPLE); + // lv_obj_set_style_bg_color(oobekb, LV_KEYBOARD_PART_BTN, LV_BTN_STATE_PRESSED, LV_COLOR_PURPLE); lv_obj_set_event_cb(oobekb, kb_event_cb); /* Setting a custom event handler stops the keyboard from closing automatically */ @@ -279,8 +291,10 @@ static void oobeSetupSsid(void) lv_keyboard_set_cursor_manage(oobekb, true); /* Automatically show/hide cursors on text areas */ } -static void oobe_calibrate_cb(lv_obj_t* ta, lv_event_t event) +static void oobe_calibrate_cb(lv_event_t* e) { + lv_event_code_t event = lv_event_get_code(e); + if(event == LV_EVENT_CLICKED) { if(oobeAutoCalibrate) { haspDevice.set_backlight_level(255); diff --git a/src/main_arduino.cpp b/src/main_arduino.cpp index 20576d43..187ef6b9 100644 --- a/src/main_arduino.cpp +++ b/src/main_arduino.cpp @@ -34,7 +34,8 @@ uint8_t statLoopCounter = 0; // measures the average looptime void setup() { - // hal_setup(); + lv_init(); // needed first for mem_monitor in debug + // hal_setup(); haspDevice.init(); diff --git a/src/sys/net/hasp_wifi.cpp b/src/sys/net/hasp_wifi.cpp index 4fec8cfa..73796036 100644 --- a/src/sys/net/hasp_wifi.cpp +++ b/src/sys/net/hasp_wifi.cpp @@ -67,11 +67,13 @@ static void wifiConnected(IPAddress ipaddress) #endif LOG_TRACE(TAG_WIFI, F(D_NETWORK_IP_ADDRESS_RECEIVED), wifiIpAddress); +#if 0 lv_obj_t* msgbox = lv_msgbox_create(lv_layer_sys(), NULL); lv_msgbox_set_text_fmt(msgbox, wifiIpAddress); lv_msgbox_start_auto_close(msgbox, 4000); lv_msgbox_set_anim_time(msgbox, 0); lv_obj_move_background(msgbox); +#endif LOG_VERBOSE(TAG_WIFI, F("Connected = %s"), WiFi.status() == WL_CONNECTED ? PSTR(D_NETWORK_ONLINE) : PSTR(D_NETWORK_OFFLINE)); diff --git a/src/sys/svc/hasp_http.cpp b/src/sys/svc/hasp_http.cpp index cf034d44..56916275 100644 --- a/src/sys/svc/hasp_http.cpp +++ b/src/sys/svc/hasp_http.cpp @@ -131,9 +131,9 @@ const char HTTP_CSS[] PROGMEM = // const char HTTP_SCRIPT[] PROGMEM = ""; -const char HTTP_HEADER_END[] PROGMEM = - "
"; -const char HTTP_FOOTER[] PROGMEM = "

" D_MANUFACTURER " "; +const char HTTP_HEADER_END[] PROGMEM = "
"; +const char HTTP_FOOTER[] PROGMEM = + ""; //////////////////////////////////////////////////////////////////////////////////////////////////// @@ -274,7 +274,7 @@ void webSendPage(const char* nodename, uint32_t httpdatalength, bool gohome = fa uint32_t contentLength = strlen(haspDevice.get_version()); // version length contentLength += sizeof(HTTP_DOCTYPE) - 1; contentLength += sizeof(HTTP_HEADER) - 1 - 2 + strlen(nodename); // -2 for %s - // contentLength += sizeof(HTTP_SCRIPT) - 1; + // contentLength += sizeof(HTTP_SCRIPT) - 1; contentLength += sizeof(HTTP_STYLE) - 1; // contentLength += sizeof(HASP_STYLE) - 1; if(gohome) contentLength += sizeof(HTTP_META_GO_BACK) - 1; @@ -298,14 +298,14 @@ void webSendPage(const char* nodename, uint32_t httpdatalength, bool gohome = fa } #if defined(STM32F4xx) - // webServer.sendContent(HTTP_SCRIPT); // 131 - webServer.sendContent(HTTP_STYLE); // 487 + // webServer.sendContent(HTTP_SCRIPT); // 131 + webServer.sendContent(HTTP_STYLE); // 487 // webServer.sendContent(HASP_STYLE); // 145 if(gohome) webServer.sendContent(HTTP_META_GO_BACK); // 47 webServer.sendContent(HTTP_HEADER_END); // 80 #else - // webServer.sendContent_P(HTTP_SCRIPT); // 131 - webServer.sendContent_P(HTTP_STYLE); // 487 + // webServer.sendContent_P(HTTP_SCRIPT); // 131 + webServer.sendContent_P(HTTP_STYLE); // 487 // webServer.sendContent_P(HASP_STYLE); // 145 if(gohome) webServer.sendContent_P(HTTP_META_GO_BACK); // 47 webServer.sendContent_P(HTTP_HEADER_END); // 80 @@ -440,7 +440,7 @@ void webHandleScreenshot() if(webServer.hasArg(F("q"))) { lv_disp_t* disp = lv_disp_get_default(); - webServer.setContentLength(122 + disp->driver.hor_res * disp->driver.ver_res * sizeof(lv_color_t)); + webServer.setContentLength(122 + disp->driver->hor_res * disp->driver->ver_res * sizeof(lv_color_t)); webServer.send_P(200, PSTR("image/bmp"), ""); guiTakeScreenshot(); webServer.client().stop(); @@ -1979,7 +1979,7 @@ void webHandleHaspConfig() #if LV_USE_THEME_MONO == 1 httpMessage += getOption(3, F("Mono"), themeid == 3); #endif -#if LV_USE_THEME_MATERIAL == 1 +#if LV_USE_THEME_MATERIAL == 1 || LV_USE_THEME_DEFAULT == 1 httpMessage += getOption(5, F("Material Dark"), themeid == 5); httpMessage += getOption(4, F("Material Light"), themeid == 4); #endif diff --git a/src/sys/svc/hasp_http_async.cpp b/src/sys/svc/hasp_http_async.cpp index 1f010cfa..4fe59b40 100644 --- a/src/sys/svc/hasp_http_async.cpp +++ b/src/sys/svc/hasp_http_async.cpp @@ -1945,7 +1945,7 @@ void webHandleHaspConfig(AsyncWebServerRequest* request) #if LV_USE_THEME_MONO == 1 httpMessage += getOption(3, F("Mono"), themeid == 3); #endif -#if LV_USE_THEME_MATERIAL == 1 +#if LV_USE_THEME_MATERIAL == 1 || LV_USE_THEME_DEFAULT == 1 httpMessage += getOption(5, F("Material Dark"), themeid == 5); httpMessage += getOption(4, F("Material Light"), themeid == 4); #endif diff --git a/tools/hasp_font_create.py b/tools/hasp_font_create.py index 30ca785c..596a84fb 100644 --- a/tools/hasp_font_create.py +++ b/tools/hasp_font_create.py @@ -69,6 +69,10 @@ for (item, data) in fonts.items(): contents[13] = contents[13].replace(" 1", " 0 // default to off") contents.insert(0, "/* clang-format off */\n") # Add c-lang directive + for line in contents: + if (line =="#if LV_VERSION_CHECK(7, 4, 0)"): + line = "#if LV_VERSION_CHECK(7, 4, 0) || LV_VERSION_CHECK(8, 0, 0)" + with open(output, "w", encoding="utf8") as f: contents = "".join(contents) f.write(contents)