fix: 状态图标动画停止后无法正确显示指定的图标。

This commit is contained in:
Ivan Li 2023-05-07 22:09:16 +08:00
parent ac8520f31f
commit 04a36d14a1
4 changed files with 9 additions and 24 deletions

View File

@ -18,7 +18,7 @@ idf_component_register(
"light.c" "light.c"
"led_strip_encoder/led_strip_encoder.c" "led_strip_encoder/led_strip_encoder.c"
"gui.c" "gui.c"
"lvgl_demo_ui.c"
"app_icon_8.c" "app_icon_8.c"
INCLUDE_DIRS "." INCLUDE_DIRS "."
) )

View File

@ -147,7 +147,9 @@ static void gui_set_wifi_connecting() {
static void gui_set_wifi_connected() { static void gui_set_wifi_connected() {
lv_anim_del(wifi_label, NULL); lv_anim_del(wifi_label, NULL);
vTaskDelay(300 / portTICK_PERIOD_MS); lv_obj_clear_flag(wifi_label, LV_OBJ_FLAG_HIDDEN);
lv_label_set_text(wifi_label, APP_WIFI_GOOD_SYMBOL);
vTaskDelay(100 / portTICK_PERIOD_MS);
lv_obj_clear_flag(wifi_label, LV_OBJ_FLAG_HIDDEN); lv_obj_clear_flag(wifi_label, LV_OBJ_FLAG_HIDDEN);
lv_label_set_text(wifi_label, APP_WIFI_GOOD_SYMBOL); lv_label_set_text(wifi_label, APP_WIFI_GOOD_SYMBOL);
} }
@ -165,7 +167,9 @@ static void gui_set_server_connecting() {
static void gui_set_server_connected() { static void gui_set_server_connected() {
lv_anim_del(desktop_label, NULL); lv_anim_del(desktop_label, NULL);
vTaskDelay(300 / portTICK_PERIOD_MS); lv_obj_clear_flag(desktop_label, LV_OBJ_FLAG_HIDDEN);
lv_label_set_text(desktop_label, APP_CONNECTED_SYMBOL);
vTaskDelay(100 / portTICK_PERIOD_MS);
lv_obj_clear_flag(desktop_label, LV_OBJ_FLAG_HIDDEN); lv_obj_clear_flag(desktop_label, LV_OBJ_FLAG_HIDDEN);
lv_label_set_text(desktop_label, APP_CONNECTED_SYMBOL); lv_label_set_text(desktop_label, APP_CONNECTED_SYMBOL);
} }
@ -354,7 +358,7 @@ void example_lvgl_demo_ui(lv_disp_t *disp) {
lv_obj_set_width(label, 120); lv_obj_set_width(label, 120);
lv_obj_align(label, LV_ALIGN_BOTTOM_RIGHT, 0, 0); lv_obj_align(label, LV_ALIGN_BOTTOM_RIGHT, 0, 0);
lv_example_bar_6(scr); // lv_example_bar_6(scr);
gui_status_bar_create(scr); gui_status_bar_create(scr);

View File

@ -1,19 +0,0 @@
/*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
*
* SPDX-License-Identifier: CC0-1.0
*/
#include "lvgl.h"
void example_lvgl_demo_ui(lv_disp_t *disp) {
lv_obj_t *scr = lv_disp_get_scr_act(disp);
lv_obj_t *label = lv_label_create(scr);
lv_label_set_long_mode(label,
LV_LABEL_LONG_SCROLL_CIRCULAR); /* Circular scroll
*/
lv_label_set_text(label, "Hello Espressif, Hello LVGL.");
lv_obj_set_width(label, 120);
lv_obj_align(label, LV_ALIGN_TOP_MID, 0, 0);
}

View File

@ -192,7 +192,7 @@ static void encoder_value_change(encoder_state_t *state) {
} }
} }
xQueueSend(ui_input_event, &event, NULL); xQueueSend(ui_input_event, &event, NULL);
ESP_LOGI(UI_INPUT_TAG, "key: %d, delta: %d. delay: %lld, %lld", state->key, ESP_LOGD(UI_INPUT_TAG, "key: %d, delta: %d. delay: %lld, %lld", state->key,
event.value, ec0_interval, ec1_interval); event.value, ec0_interval, ec1_interval);
} }