From 822c6e702ea6a62573ae1ae485a52d771c85c0e0 Mon Sep 17 00:00:00 2001 From: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Date: Wed, 5 Apr 2023 22:46:36 +0200 Subject: [PATCH] ESP32 LVGL library from v8.3.5 to v8.3.6 (no functional change) (#18342) * ESP32 LVGL library from v8.3.5 to v8.3.6 (no functional change) * Add changelog --- CHANGELOG.md | 1 + lib/libesp32_lvgl/lvgl/library.json | 10 +++---- lib/libesp32_lvgl/lvgl/library.properties | 2 +- lib/libesp32_lvgl/lvgl/lv_conf_template.h | 4 +-- lib/libesp32_lvgl/lvgl/lvgl.h | 2 +- lib/libesp32_lvgl/lvgl/src/core/lv_group.c | 1 + .../src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c | 28 ++++++++++++++++-- .../lvgl/src/extra/libs/fsdrv/lv_fs_posix.c | 6 ++-- .../lvgl/src/extra/libs/gif/gifdec.c | 26 ++++++++++++++--- .../lvgl/src/extra/libs/gif/gifdec.h | 2 +- .../lvgl/src/extra/libs/gif/lv_gif.c | 17 +++++------ .../lvgl/src/extra/others/msg/lv_msg.c | 21 ++++++++++++-- .../lvgl/src/extra/others/msg/lv_msg.h | 10 +++++++ lib/libesp32_lvgl/lvgl/src/lv_conf_internal.h | 2 +- lib/libesp32_lvgl/lvgl/src/widgets/lv_arc.c | 29 ++++++++++++++++++- lib/libesp32_lvgl/lvgl/src/widgets/lv_bar.c | 2 ++ lib/libesp32_lvgl/lvgl/src/widgets/lv_img.c | 13 ++++----- .../lvgl/src/widgets/lv_slider.c | 8 +++-- 18 files changed, 142 insertions(+), 42 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b4206cf7..6e23a3fc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ All notable changes to this project will be documented in this file. ### Breaking Changed ### Changed +- ESP32 LVGL library from v8.3.5 to v8.3.6 (no functional change) ### Fixed - ESP32 ``Upload``, ``Upgrade``, ``WebGetConfig``, ``WebQuery`` and ``WebSend`` random HTTP(S) connection timeout set to 5 sec (commit 542eca3) diff --git a/lib/libesp32_lvgl/lvgl/library.json b/lib/libesp32_lvgl/lvgl/library.json index 9f9ade2c9..928d7beed 100644 --- a/lib/libesp32_lvgl/lvgl/library.json +++ b/lib/libesp32_lvgl/lvgl/library.json @@ -1,6 +1,6 @@ { "name": "lvgl", - "version": "8.3.5", + "version": "8.3.6", "keywords": "graphics, gui, embedded, tft, lvgl", "description": "Graphics library to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint. It offers anti-aliasing, opacity, and animations using only one frame buffer.", "repository": { @@ -8,13 +8,11 @@ "url": "https://github.com/lvgl/lvgl.git" }, "build": { - "includeDir": "." + "includeDir": ".", + "flags": [ "-I$PROJECT_DIR/tasmota/lvgl_berry" ] }, "license": "MIT", "homepage": "https://lvgl.io", "frameworks": "arduino", - "platforms": "espressif32", - "build": { - "flags": [ "-I$PROJECT_DIR/tasmota/lvgl_berry" ] - } + "platforms": "espressif32" } diff --git a/lib/libesp32_lvgl/lvgl/library.properties b/lib/libesp32_lvgl/lvgl/library.properties index ae036fdbe..19de5008b 100644 --- a/lib/libesp32_lvgl/lvgl/library.properties +++ b/lib/libesp32_lvgl/lvgl/library.properties @@ -1,5 +1,5 @@ name=lvgl -version=8.3.5 +version=8.3.6 author=kisvegabor maintainer=kisvegabor,embeddedt,pete-pjb sentence=Full-featured Graphics Library for Embedded Systems diff --git a/lib/libesp32_lvgl/lvgl/lv_conf_template.h b/lib/libesp32_lvgl/lvgl/lv_conf_template.h index c5b67a34e..f36af2a28 100644 --- a/lib/libesp32_lvgl/lvgl/lv_conf_template.h +++ b/lib/libesp32_lvgl/lvgl/lv_conf_template.h @@ -1,6 +1,6 @@ /** * @file lv_conf.h - * Configuration file for v8.3.5 + * Configuration file for v8.3.6 */ /* @@ -183,7 +183,7 @@ #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"*/ + e.g. "stm32f7xx.h" or "stm32f4xx.h"*/ #define LV_GPU_DMA2D_CMSIS_INCLUDE #endif diff --git a/lib/libesp32_lvgl/lvgl/lvgl.h b/lib/libesp32_lvgl/lvgl/lvgl.h index 76f22761b..6eedc7f23 100644 --- a/lib/libesp32_lvgl/lvgl/lvgl.h +++ b/lib/libesp32_lvgl/lvgl/lvgl.h @@ -15,7 +15,7 @@ extern "C" { ***************************/ #define LVGL_VERSION_MAJOR 8 #define LVGL_VERSION_MINOR 3 -#define LVGL_VERSION_PATCH 5 +#define LVGL_VERSION_PATCH 6 #define LVGL_VERSION_INFO "" /********************* diff --git a/lib/libesp32_lvgl/lvgl/src/core/lv_group.c b/lib/libesp32_lvgl/lvgl/src/core/lv_group.c index 2c4fa93e9..63fde71a0 100644 --- a/lib/libesp32_lvgl/lvgl/src/core/lv_group.c +++ b/lib/libesp32_lvgl/lvgl/src/core/lv_group.c @@ -92,6 +92,7 @@ void lv_group_del(lv_group_t * group) indev = lv_indev_get_next(indev); } + if(default_group == group) default_group = NULL; _lv_ll_clear(&(group->obj_ll)); _lv_ll_remove(&LV_GC_ROOT(_lv_group_ll), group); lv_mem_free(group); diff --git a/lib/libesp32_lvgl/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c b/lib/libesp32_lvgl/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c index b1ae6552a..908909df8 100644 --- a/lib/libesp32_lvgl/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c +++ b/lib/libesp32_lvgl/lvgl/src/draw/stm32_dma2d/lv_gpu_stm32_dma2d.c @@ -343,7 +343,9 @@ LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_blend_fill(const lv_color_t * de DMA2D->CR = 0x3UL << DMA2D_CR_MODE_Pos; // Register-to-memory (no FG nor BG, only output stage active) DMA2D->OPFCCR = LvglColorFormat; +#if defined(DMA2D_OPFCCR_RBS_Pos) DMA2D->OPFCCR |= (RBS_BIT << DMA2D_OPFCCR_RBS_Pos); +#endif DMA2D->OMAR = (uint32_t)(dest_buf + (dest_stride * draw_area->y1) + draw_area->x1); DMA2D->OOR = dest_stride - draw_width; // out buffer offset // Note: unlike FGCOLR and BGCOLR, OCOLR bits must match DMA2D_OUTPUT_COLOR, alpha can be specified @@ -370,14 +372,18 @@ LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_blend_fill(const lv_color_t * de DMA2D->FGCOLR = lv_color_to32(color) & 0x00ffffff; // swap FGCOLR R/B bits if FGPFCCR.RBS (RBS_BIT) bit is set DMA2D->BGPFCCR = LvglColorFormat; +#if defined(DMA2D_BGPFCCR_RBS_Pos) DMA2D->BGPFCCR |= (RBS_BIT << DMA2D_BGPFCCR_RBS_Pos); +#endif DMA2D->BGMAR = (uint32_t)(dest_buf + (dest_stride * draw_area->y1) + draw_area->x1); DMA2D->BGOR = dest_stride - draw_width; DMA2D->BGCOLR = 0; // used in A4 and A8 modes only _lv_gpu_stm32_dma2d_clean_cache(DMA2D->BGMAR, DMA2D->BGOR, draw_width, draw_height, sizeof(lv_color_t)); DMA2D->OPFCCR = LvglColorFormat; +#if defined(DMA2D_OPFCCR_RBS_Pos) DMA2D->OPFCCR |= (RBS_BIT << DMA2D_OPFCCR_RBS_Pos); +#endif DMA2D->OMAR = DMA2D->BGMAR; DMA2D->OOR = DMA2D->BGOR; DMA2D->OCOLR = 0; @@ -454,15 +460,18 @@ LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_blend_map(const lv_color_t * des DMA2D->FGPFCCR |= (0x1UL << DMA2D_FGPFCCR_AM_Pos); } } - +#if defined(DMA2D_FGPFCCR_RBS_Pos) DMA2D->FGPFCCR |= (RBS_BIT << DMA2D_FGPFCCR_RBS_Pos); +#endif DMA2D->FGMAR = ((uint32_t)src_buf) + srcBpp * ((src_stride * src_offset->y) + src_offset->x); DMA2D->FGOR = src_stride - draw_width; DMA2D->FGCOLR = 0; // used in A4 and A8 modes only _lv_gpu_stm32_dma2d_clean_cache(DMA2D->FGMAR, DMA2D->FGOR, draw_width, draw_height, srcBpp); DMA2D->OPFCCR = LvglColorFormat; +#if defined(DMA2D_OPFCCR_RBS_Pos) DMA2D->OPFCCR |= (RBS_BIT << DMA2D_OPFCCR_RBS_Pos); +#endif DMA2D->OMAR = (uint32_t)(dest_buf + (dest_stride * draw_area->y1) + draw_area->x1); DMA2D->OOR = dest_stride - draw_width; DMA2D->OCOLR = 0; @@ -470,7 +479,9 @@ LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_blend_map(const lv_color_t * des if(opa != 0xff || bitmapHasOpacity) { // use background (BG*) registers DMA2D->BGPFCCR = LvglColorFormat; +#if defined(DMA2D_BGPFCCR_RBS_Pos) DMA2D->BGPFCCR |= (RBS_BIT << DMA2D_BGPFCCR_RBS_Pos); +#endif DMA2D->BGMAR = DMA2D->OMAR; DMA2D->BGOR = DMA2D->OOR; DMA2D->BGCOLR = 0; // used in A4 and A8 modes only @@ -514,14 +525,18 @@ LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_blend_paint(const lv_color_t * d _lv_gpu_stm32_dma2d_clean_cache(DMA2D->FGMAR, DMA2D->FGOR, draw_width, draw_height, sizeof(lv_opa_t)); DMA2D->BGPFCCR = LvglColorFormat; +#if defined(DMA2D_BGPFCCR_RBS_Pos) DMA2D->BGPFCCR |= (RBS_BIT << DMA2D_BGPFCCR_RBS_Pos); +#endif DMA2D->BGMAR = (uint32_t)(dest_buf + (dest_stride * draw_area->y1) + draw_area->x1); DMA2D->BGOR = dest_stride - draw_width; DMA2D->BGCOLR = 0; // used in A4 and A8 modes only _lv_gpu_stm32_dma2d_clean_cache(DMA2D->BGMAR, DMA2D->BGOR, draw_width, draw_height, sizeof(lv_color_t)); DMA2D->OPFCCR = LvglColorFormat; +#if defined(DMA2D_OPFCCR_RBS_Pos) DMA2D->OPFCCR |= (RBS_BIT << DMA2D_OPFCCR_RBS_Pos); +#endif DMA2D->OMAR = DMA2D->BGMAR; DMA2D->OOR = DMA2D->BGOR; DMA2D->OCOLR = 0; @@ -547,7 +562,9 @@ LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_copy_buffer(const lv_color_t * d DMA2D->CR = 0x0UL; // Memory-to-memory (FG fetch only) DMA2D->FGPFCCR = LvglColorFormat; +#if defined(DMA2D_FGPFCCR_RBS_Pos) DMA2D->FGPFCCR |= (RBS_BIT << DMA2D_FGPFCCR_RBS_Pos); +#endif DMA2D->FGMAR = (uint32_t)(src_buf + (src_stride * src_offset->y) + src_offset->x); DMA2D->FGOR = src_stride - draw_width; DMA2D->FGCOLR = 0; // used in A4 and A8 modes only @@ -556,7 +573,9 @@ LV_STM32_DMA2D_STATIC void _lv_draw_stm32_dma2d_copy_buffer(const lv_color_t * d // Note BG* registers do not need to be set up since BG is not used DMA2D->OPFCCR = LvglColorFormat; +#if defined(DMA2D_OPFCCR_RBS_Pos) DMA2D->OPFCCR |= (RBS_BIT << DMA2D_OPFCCR_RBS_Pos); +#endif DMA2D->OMAR = (uint32_t)(dest_buf + (dest_stride * draw_area->y1) + draw_area->x1); DMA2D->OOR = dest_stride - draw_width; DMA2D->OCOLR = 0; @@ -615,6 +634,7 @@ LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_await_dma_transfer_finish(lv_disp LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_invalidate_cache(uint32_t address, lv_coord_t offset, lv_coord_t width, lv_coord_t height, uint8_t pixel_size) { +#if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) if(((SCB->CCR) & SCB_CCR_DC_Msk) == 0) return; // L1 data cache is disabled uint16_t stride = pixel_size * (width + offset); // in bytes uint16_t ll = pixel_size * width; // line length in bytes @@ -640,11 +660,13 @@ LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_invalidate_cache(uint32_t address __DSB(); __ISB(); +#endif } LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_clean_cache(uint32_t address, lv_coord_t offset, lv_coord_t width, lv_coord_t height, uint8_t pixel_size) { +#if defined (__DCACHE_PRESENT) && (__DCACHE_PRESENT == 1U) if(((SCB->CCR) & SCB_CCR_DC_Msk) == 0) return; // L1 data cache is disabled uint16_t stride = pixel_size * (width + offset); // in bytes uint16_t ll = pixel_size * width; // line length in bytes @@ -669,6 +691,7 @@ LV_STM32_DMA2D_STATIC void _lv_gpu_stm32_dma2d_clean_cache(uint32_t address, lv_ __DSB(); __ISB(); +#endif } // initialize µs timer @@ -679,8 +702,9 @@ LV_STM32_DMA2D_STATIC bool _lv_gpu_stm32_dwt_init(void) // enable TRC CoreDebug->DEMCR |= CoreDebug_DEMCR_TRCENA_Msk; +#if defined(__CORTEX_M) && (__CORTEX_M == 7U) DWT->LAR = 0xC5ACCE55; - +#endif // disable clock cycle counter DWT->CTRL &= ~DWT_CTRL_CYCCNTENA_Msk; // enable clock cycle counter diff --git a/lib/libesp32_lvgl/lvgl/src/extra/libs/fsdrv/lv_fs_posix.c b/lib/libesp32_lvgl/lvgl/src/extra/libs/fsdrv/lv_fs_posix.c index f988daeeb..e656288d3 100644 --- a/lib/libesp32_lvgl/lvgl/src/extra/libs/fsdrv/lv_fs_posix.c +++ b/lib/libesp32_lvgl/lvgl/src/extra/libs/fsdrv/lv_fs_posix.c @@ -104,15 +104,15 @@ static void * fs_open(lv_fs_drv_t * drv, const char * path, lv_fs_mode_t mode) LV_UNUSED(drv); uint32_t flags = 0; - if(mode == LV_FS_MODE_WR) flags = O_WRONLY; + if(mode == LV_FS_MODE_WR) flags = O_WRONLY | O_CREAT; else if(mode == LV_FS_MODE_RD) flags = O_RDONLY; - else if(mode == (LV_FS_MODE_WR | LV_FS_MODE_RD)) flags = O_RDWR; + else if(mode == (LV_FS_MODE_WR | LV_FS_MODE_RD)) flags = O_RDWR | O_CREAT; /*Make the path relative to the current directory (the projects root folder)*/ char buf[256]; lv_snprintf(buf, sizeof(buf), LV_FS_POSIX_PATH "%s", path); - int f = open(buf, flags); + int f = open(buf, flags, 0666); if(f < 0) return NULL; return (void *)(lv_uintptr_t)f; diff --git a/lib/libesp32_lvgl/lvgl/src/extra/libs/gif/gifdec.c b/lib/libesp32_lvgl/lvgl/src/extra/libs/gif/gifdec.c index 68f50057e..3ee9b7194 100644 --- a/lib/libesp32_lvgl/lvgl/src/extra/libs/gif/gifdec.c +++ b/lib/libesp32_lvgl/lvgl/src/extra/libs/gif/gifdec.c @@ -160,6 +160,7 @@ static gd_GIF * gif_open(gd_GIF * gif_base) #endif } gif->anim_start = f_gif_seek(gif, 0, LV_FS_SEEK_CUR); + gif->loop_count = -1; goto ok; fail: f_gif_close(gif_base); @@ -239,6 +240,7 @@ read_application_ext(gd_GIF *gif) { char app_id[8]; char app_auth_code[3]; + uint16_t loop_count; /* Discard block size (always 0x0B). */ f_gif_seek(gif, 1, LV_FS_SEEK_CUR); @@ -249,7 +251,15 @@ read_application_ext(gd_GIF *gif) if (!strncmp(app_id, "NETSCAPE", sizeof(app_id))) { /* Discard block size (0x03) and constant byte (0x01). */ f_gif_seek(gif, 2, LV_FS_SEEK_CUR); - gif->loop_count = read_num(gif); + loop_count = read_num(gif); + if(gif->loop_count < 0) { + if(loop_count == 0) { + gif->loop_count = 0; + } + else{ + gif->loop_count = loop_count + 1; + } + } /* Skip block terminator. */ f_gif_seek(gif, 1, LV_FS_SEEK_CUR); } else if (gif->application) { @@ -568,9 +578,16 @@ gd_get_frame(gd_GIF *gif) dispose(gif); f_gif_read(gif, &sep, 1); while (sep != ',') { - if (sep == ';') - return 0; - if (sep == '!') + if (sep == ';') { + f_gif_seek(gif, gif->anim_start, LV_FS_SEEK_SET); + if(gif->loop_count == 1 || gif->loop_count < 0) { + return 0; + } + else if(gif->loop_count > 1) { + gif->loop_count--; + } + } + else if (sep == '!') read_ext(gif); else return -1; f_gif_read(gif, &sep, 1); @@ -598,6 +615,7 @@ gd_render_frame(gd_GIF *gif, uint8_t *buffer) void gd_rewind(gd_GIF *gif) { + gif->loop_count = -1; f_gif_seek(gif, gif->anim_start, LV_FS_SEEK_SET); } diff --git a/lib/libesp32_lvgl/lvgl/src/extra/libs/gif/gifdec.h b/lib/libesp32_lvgl/lvgl/src/extra/libs/gif/gifdec.h index 00f17c1da..b68fab5d4 100644 --- a/lib/libesp32_lvgl/lvgl/src/extra/libs/gif/gifdec.h +++ b/lib/libesp32_lvgl/lvgl/src/extra/libs/gif/gifdec.h @@ -29,7 +29,7 @@ typedef struct gd_GIF { int32_t anim_start; uint16_t width, height; uint16_t depth; - uint16_t loop_count; + int32_t loop_count; gd_GCE gce; gd_Palette *palette; gd_Palette lct, gct; diff --git a/lib/libesp32_lvgl/lvgl/src/extra/libs/gif/lv_gif.c b/lib/libesp32_lvgl/lvgl/src/extra/libs/gif/lv_gif.c index 4cb2955e2..2bd9e013c 100644 --- a/lib/libesp32_lvgl/lvgl/src/extra/libs/gif/lv_gif.c +++ b/lib/libesp32_lvgl/lvgl/src/extra/libs/gif/lv_gif.c @@ -99,6 +99,8 @@ void lv_gif_restart(lv_obj_t * obj) { lv_gif_t * gifobj = (lv_gif_t *) obj; gd_rewind(gifobj->gif); + lv_timer_resume(gifobj->timer); + lv_timer_reset(gifobj->timer); } /********************** @@ -111,6 +113,7 @@ static void lv_gif_constructor(const lv_obj_class_t * class_p, lv_obj_t * obj) lv_gif_t * gifobj = (lv_gif_t *) obj; + gifobj->gif = NULL; gifobj->timer = lv_timer_create(next_frame_task_cb, 10, obj); lv_timer_pause(gifobj->timer); } @@ -120,7 +123,8 @@ static void lv_gif_destructor(const lv_obj_class_t * class_p, lv_obj_t * obj) LV_UNUSED(class_p); lv_gif_t * gifobj = (lv_gif_t *) obj; lv_img_cache_invalidate_src(&gifobj->imgdsc); - gd_close_gif(gifobj->gif); + if(gifobj->gif) + gd_close_gif(gifobj->gif); lv_timer_del(gifobj->timer); } @@ -136,14 +140,9 @@ static void next_frame_task_cb(lv_timer_t * t) int has_next = gd_get_frame(gifobj->gif); if(has_next == 0) { /*It was the last repeat*/ - if(gifobj->gif->loop_count == 1) { - lv_res_t res = lv_event_send(obj, LV_EVENT_READY, NULL); - if(res != LV_FS_RES_OK) return; - } - else { - if(gifobj->gif->loop_count > 1) gifobj->gif->loop_count--; - gd_rewind(gifobj->gif); - } + lv_res_t res = lv_event_send(obj, LV_EVENT_READY, NULL); + lv_timer_pause(t); + if(res != LV_FS_RES_OK) return; } gd_render_frame(gifobj->gif, (uint8_t *)gifobj->imgdsc.data); diff --git a/lib/libesp32_lvgl/lvgl/src/extra/others/msg/lv_msg.c b/lib/libesp32_lvgl/lvgl/src/extra/others/msg/lv_msg.c index 8fd434d06..d54279c08 100644 --- a/lib/libesp32_lvgl/lvgl/src/extra/others/msg/lv_msg.c +++ b/lib/libesp32_lvgl/lvgl/src/extra/others/msg/lv_msg.c @@ -94,6 +94,25 @@ void lv_msg_unsubscribe(void * s) lv_mem_free(s); } +uint32_t lv_msg_unsubscribe_obj(uint32_t msg_id, lv_obj_t * obj) +{ + uint32_t cnt = 0; + sub_dsc_t * s = _lv_ll_get_head(&subs_ll); + while(s) { + sub_dsc_t * s_next = _lv_ll_get_next(&subs_ll, s); + if(s->callback == obj_notify_cb && + (s->msg_id == LV_MSG_ID_ANY || s->msg_id == msg_id) && + (obj == NULL || s->_priv_data == obj)) { + lv_msg_unsubscribe(s); + cnt++; + } + + s = s_next; + } + + return cnt; +} + void lv_msg_send(uint32_t msg_id, const void * payload) { lv_msg_t m; @@ -129,8 +148,6 @@ lv_msg_t * lv_event_get_msg(lv_event_t * e) } } - - /********************** * STATIC FUNCTIONS **********************/ diff --git a/lib/libesp32_lvgl/lvgl/src/extra/others/msg/lv_msg.h b/lib/libesp32_lvgl/lvgl/src/extra/others/msg/lv_msg.h index 96f08aa24..0ac2f77d5 100644 --- a/lib/libesp32_lvgl/lvgl/src/extra/others/msg/lv_msg.h +++ b/lib/libesp32_lvgl/lvgl/src/extra/others/msg/lv_msg.h @@ -19,6 +19,8 @@ extern "C" { /********************* * DEFINES *********************/ +#define LV_MSG_ID_ANY UINT32_MAX +LV_EXPORT_CONST_INT(LV_MSG_ID_ANY); /********************** * TYPEDEFS @@ -70,6 +72,14 @@ void * lv_msg_subsribe_obj(uint32_t msg_id, lv_obj_t * obj, void * user_data); */ void lv_msg_unsubscribe(void * s); +/** + * Unsubscribe an object from a message ID + * @param msg_id the message ID to unsubcribe from or `LV_MSG_ID_ANY` for any message ID + * @param obj the object to unsubscribe or NULL for any object + * @return number of unsubscriptions + */ +uint32_t lv_msg_unsubscribe_obj(uint32_t msg_id, lv_obj_t * obj); + /** * Send a message with a given ID and payload * @param msg_id ID of the message to send diff --git a/lib/libesp32_lvgl/lvgl/src/lv_conf_internal.h b/lib/libesp32_lvgl/lvgl/src/lv_conf_internal.h index 80b9b86cf..4cd3895f2 100644 --- a/lib/libesp32_lvgl/lvgl/src/lv_conf_internal.h +++ b/lib/libesp32_lvgl/lvgl/src/lv_conf_internal.h @@ -435,7 +435,7 @@ #endif #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"*/ + e.g. "stm32f7xx.h" or "stm32f4xx.h"*/ #ifndef LV_GPU_DMA2D_CMSIS_INCLUDE #ifdef CONFIG_LV_GPU_DMA2D_CMSIS_INCLUDE #define LV_GPU_DMA2D_CMSIS_INCLUDE CONFIG_LV_GPU_DMA2D_CMSIS_INCLUDE diff --git a/lib/libesp32_lvgl/lvgl/src/widgets/lv_arc.c b/lib/libesp32_lvgl/lvgl/src/widgets/lv_arc.c index 6cab5f339..848c20a72 100644 --- a/lib/libesp32_lvgl/lvgl/src/widgets/lv_arc.c +++ b/lib/libesp32_lvgl/lvgl/src/widgets/lv_arc.c @@ -39,6 +39,7 @@ static void get_center(const lv_obj_t * obj, lv_point_t * center, lv_coord_t * a static lv_coord_t get_angle(const lv_obj_t * obj); static void get_knob_area(lv_obj_t * arc, const lv_point_t * center, lv_coord_t r, lv_area_t * knob_area); static void value_update(lv_obj_t * arc); +static lv_coord_t knob_get_extra_size(lv_obj_t * obj); /********************** * STATIC VARIABLES @@ -600,8 +601,11 @@ static void lv_arc_event(const lv_obj_class_t * class_p, lv_event_t * e) lv_coord_t knob_bottom = lv_obj_get_style_pad_bottom(obj, LV_PART_KNOB); lv_coord_t knob_pad = LV_MAX4(knob_left, knob_right, knob_top, knob_bottom) + 2; + lv_coord_t knob_extra_size = knob_pad - bg_pad; + knob_extra_size += knob_get_extra_size(obj); + lv_coord_t * s = lv_event_get_param(e); - *s = LV_MAX(*s, knob_pad - bg_pad); + *s = LV_MAX(*s, knob_extra_size); } else if(code == LV_EVENT_DRAW_MAIN) { lv_arc_draw(e); @@ -716,6 +720,7 @@ static void inv_arc_area(lv_obj_t * obj, uint16_t start_angle, uint16_t end_angl lv_area_t inv_area; lv_draw_arc_get_area(c.x, c.y, r, start_angle, end_angle, w, rounded, &inv_area); + lv_obj_invalidate_area(obj, &inv_area); } @@ -727,6 +732,13 @@ static void inv_knob_area(lv_obj_t * obj) lv_area_t a; get_knob_area(obj, &c, r, &a); + + lv_coord_t knob_extra_size = knob_get_extra_size(obj); + + if(knob_extra_size > 0) { + lv_area_increase(&a, knob_extra_size, knob_extra_size); + } + lv_obj_invalidate_area(obj, &a); } @@ -841,4 +853,19 @@ static void value_update(lv_obj_t * obj) arc->last_angle = angle; /*Cache angle for slew rate limiting*/ } +static lv_coord_t knob_get_extra_size(lv_obj_t * obj) +{ + lv_coord_t knob_shadow_size = 0; + knob_shadow_size += lv_obj_get_style_shadow_width(obj, LV_PART_KNOB); + knob_shadow_size += lv_obj_get_style_shadow_spread(obj, LV_PART_KNOB); + knob_shadow_size += LV_ABS(lv_obj_get_style_shadow_ofs_x(obj, LV_PART_KNOB)); + knob_shadow_size += LV_ABS(lv_obj_get_style_shadow_ofs_y(obj, LV_PART_KNOB)); + + lv_coord_t knob_outline_size = 0; + knob_outline_size += lv_obj_get_style_outline_width(obj, LV_PART_KNOB); + knob_outline_size += lv_obj_get_style_outline_pad(obj, LV_PART_KNOB); + + return LV_MAX(knob_shadow_size, knob_outline_size); +} + #endif diff --git a/lib/libesp32_lvgl/lvgl/src/widgets/lv_bar.c b/lib/libesp32_lvgl/lvgl/src/widgets/lv_bar.c index 0da2a9875..a057618ec 100644 --- a/lib/libesp32_lvgl/lvgl/src/widgets/lv_bar.c +++ b/lib/libesp32_lvgl/lvgl/src/widgets/lv_bar.c @@ -571,6 +571,8 @@ static void lv_bar_set_value_with_anim(lv_obj_t * obj, int32_t new_value, int32_ _lv_bar_anim_t * anim_info, lv_anim_enable_t en) { if(en == LV_ANIM_OFF) { + lv_anim_del(anim_info, NULL); + anim_info->anim_state = LV_BAR_ANIM_STATE_INV; *value_ptr = new_value; lv_obj_invalidate((lv_obj_t *)obj); } diff --git a/lib/libesp32_lvgl/lvgl/src/widgets/lv_img.c b/lib/libesp32_lvgl/lvgl/src/widgets/lv_img.c index f47a789e7..3246e4a69 100644 --- a/lib/libesp32_lvgl/lvgl/src/widgets/lv_img.c +++ b/lib/libesp32_lvgl/lvgl/src/widgets/lv_img.c @@ -166,8 +166,6 @@ void lv_img_set_offset_x(lv_obj_t * obj, lv_coord_t x) lv_img_t * img = (lv_img_t *)obj; - x = x % img->w; - img->offset.x = x; lv_obj_invalidate(obj); } @@ -178,15 +176,14 @@ void lv_img_set_offset_y(lv_obj_t * obj, lv_coord_t y) lv_img_t * img = (lv_img_t *)obj; - y = y % img->h; - img->offset.y = y; lv_obj_invalidate(obj); } void lv_img_set_angle(lv_obj_t * obj, int16_t angle) { - if(angle < 0 || angle >= 3600) angle = angle % 3600; + while(angle >= 3600) angle -= 3600; + while(angle < 0) angle += 3600; lv_img_t * img = (lv_img_t *)obj; if(angle == img->angle) return; @@ -659,12 +656,14 @@ static void draw_img(lv_event_t * e) draw_ctx->clip_area = &img_clip_area; lv_area_t coords_tmp; - coords_tmp.y1 = img_max_area.y1 + img->offset.y; + lv_coord_t offset_x = img->offset.x % img->w; + lv_coord_t offset_y = img->offset.y % img->h; + coords_tmp.y1 = img_max_area.y1 + offset_y; if(coords_tmp.y1 > img_max_area.y1) coords_tmp.y1 -= img->h; coords_tmp.y2 = coords_tmp.y1 + img->h - 1; for(; coords_tmp.y1 < img_max_area.y2; coords_tmp.y1 += img_size_final.y, coords_tmp.y2 += img_size_final.y) { - coords_tmp.x1 = img_max_area.x1 + img->offset.x; + coords_tmp.x1 = img_max_area.x1 + offset_x; if(coords_tmp.x1 > img_max_area.x1) coords_tmp.x1 -= img->w; coords_tmp.x2 = coords_tmp.x1 + img->w - 1; diff --git a/lib/libesp32_lvgl/lvgl/src/widgets/lv_slider.c b/lib/libesp32_lvgl/lvgl/src/widgets/lv_slider.c index 3f85efc28..98711da40 100644 --- a/lib/libesp32_lvgl/lvgl/src/widgets/lv_slider.c +++ b/lib/libesp32_lvgl/lvgl/src/widgets/lv_slider.c @@ -239,8 +239,12 @@ static void lv_slider_event(const lv_obj_class_t * class_p, lv_event_t * e) new_value = LV_CLAMP(real_min_value, new_value, real_max_value); if(*slider->value_to_set != new_value) { - *slider->value_to_set = new_value; - lv_obj_invalidate(obj); + if(slider->value_to_set == &slider->bar.start_value) { + lv_bar_set_start_value(obj, new_value, LV_ANIM_ON); + } + else { + lv_bar_set_value(obj, new_value, LV_ANIM_ON); + } res = lv_event_send(obj, LV_EVENT_VALUE_CHANGED, NULL); if(res != LV_RES_OK) return; }