diff --git a/main/CMakeLists.txt b/main/CMakeLists.txt index 061ab18..b41239e 100644 --- a/main/CMakeLists.txt +++ b/main/CMakeLists.txt @@ -653,12 +653,20 @@ elseif(CONFIG_BOARD_TYPE_ZHENGCHEN_CAM) set(BOARD_TYPE "zhengchen-cam") set(BUILTIN_TEXT_FONT font_puhui_20_4) set(BUILTIN_ICON_FONT font_awesome_20_4) - set(DEFAULT_EMOJI_COLLECTION main/boards/zhengchen-cam/custom-emojis) + if(CONFIG_ZHENGCHEN_CAM_USE_GIF_EMOJI) + set(DEFAULT_EMOJI_COLLECTION main/boards/zhengchen-cam/custom-emojis/gif) + else() + set(DEFAULT_EMOJI_COLLECTION main/boards/zhengchen-cam/custom-emojis/png) + endif() elseif(CONFIG_BOARD_TYPE_ZHENGCHEN_CAM_ML307) set(BOARD_TYPE "zhengchen-cam-ml307") set(BUILTIN_TEXT_FONT font_puhui_20_4) set(BUILTIN_ICON_FONT font_awesome_20_4) - set(DEFAULT_EMOJI_COLLECTION main/boards/zhengchen-cam/custom-emojis) + if(CONFIG_ZHENGCHEN_CAM_USE_GIF_EMOJI) + set(DEFAULT_EMOJI_COLLECTION main/boards/zhengchen-cam/custom-emojis/gif) + else() + set(DEFAULT_EMOJI_COLLECTION main/boards/zhengchen-cam/custom-emojis/png) + endif() elseif(CONFIG_BOARD_TYPE_SPOTPEAR_ESP32_S3_1_54_MUMA) set(BOARD_TYPE "sp-esp32-s3-1.54-muma") set(BUILTIN_TEXT_FONT font_puhui_basic_16_4) diff --git a/main/Kconfig.projbuild b/main/Kconfig.projbuild index 0f8f77a..b1e9b64 100644 --- a/main/Kconfig.projbuild +++ b/main/Kconfig.projbuild @@ -133,6 +133,14 @@ choice BOARD_TYPE depends on IDF_TARGET_ESP32S3 endchoice +config ZHENGCHEN_CAM_USE_GIF_EMOJI + bool "Use GIF custom emojis for Zhengchen CAM" + depends on BOARD_TYPE_ZHENGCHEN_CAM || BOARD_TYPE_ZHENGCHEN_CAM_ML307 + default n + help + When enabled, default assets use custom-emojis/gif. + When disabled, default assets use custom-emojis/png. + choice depends on BOARD_TYPE_LILYGO_T_DISPLAY_P4 prompt "Select the screen type" diff --git a/main/boards/zhengchen-cam/custom-emojis/README.md b/main/boards/zhengchen-cam/custom-emojis/README.md index 4c43afe..8a64a71 100644 --- a/main/boards/zhengchen-cam/custom-emojis/README.md +++ b/main/boards/zhengchen-cam/custom-emojis/README.md @@ -1,7 +1,6 @@ # Custom Emojis -Put your custom PNG or GIF files in this directory, or in `png/` and `gif/` -subdirectories. +Put your custom PNG files in `png/` and custom GIF files in `gif/`. The filename without extension is used as the emotion name. Directory names are not part of the emotion name, so `png/neutral.png` is loaded as `neutral`. @@ -28,8 +27,12 @@ Recommended minimum set: - `angry` If an emotion-specific image is missing, the firmware falls back to `neutral` -before using the built-in icon. Do not add both `png/happy.png` and -`gif/happy.gif`; only one image per emotion should be used. +before using the built-in icon. + +For Zhengchen CAM boards, the build selects one subdirectory: + +- `CONFIG_ZHENGCHEN_CAM_USE_GIF_EMOJI=y`: use `gif/` +- unset `CONFIG_ZHENGCHEN_CAM_USE_GIF_EMOJI`: use `png/` After adding or replacing files, run a full flash so the assets partition is updated: diff --git a/main/display/lcd_display.cc b/main/display/lcd_display.cc index a707257..fd4e838 100644 --- a/main/display/lcd_display.cc +++ b/main/display/lcd_display.cc @@ -65,7 +65,7 @@ void ApplyEmojiImageScale(lv_obj_t* image_obj, lv_obj_t* image_box, const lv_ima if (image_box != nullptr) { lv_obj_center(image_obj); } - ESP_LOGI(TAG, "Emoji image scale=%ld reserved=%ld/%ld size=%ldx%ld -> %ldx%ld", + ESP_LOGD(TAG, "Emoji image scale=%ld reserved=%ld/%ld size=%ldx%ld -> %ldx%ld", static_cast(scale), static_cast(top_reserved), static_cast(bottom_reserved), static_cast(image_width), static_cast(image_height), diff --git a/main/display/lvgl_display/lvgl_display.cc b/main/display/lvgl_display/lvgl_display.cc index 06c4b3c..15fd25e 100644 --- a/main/display/lvgl_display/lvgl_display.cc +++ b/main/display/lvgl_display/lvgl_display.cc @@ -3,6 +3,7 @@ #include #include #include +#include #include #include "lvgl_display.h" @@ -22,6 +23,21 @@ LvglDisplay::LvglDisplay() { LvglDisplay *display = static_cast(arg); DisplayLockGuard lock(display); lv_obj_add_flag(display->notification_label_, LV_OBJ_FLAG_HIDDEN); + if (Application::GetInstance().GetDeviceState() == kDeviceStateIdle && display->time_label_ != nullptr) { + time_t now = time(NULL); + struct tm* tm = localtime(&now); + if (tm->tm_year >= 2025 - 1900) { + char time_str[16]; + strftime(time_str, sizeof(time_str), "%H:%M", tm); + lv_label_set_text(display->time_label_, time_str); + lv_obj_remove_flag(display->time_label_, LV_OBJ_FLAG_HIDDEN); + lv_obj_add_flag(display->status_label_, LV_OBJ_FLAG_HIDDEN); + return; + } + } + if (display->time_label_ != nullptr) { + lv_obj_add_flag(display->time_label_, LV_OBJ_FLAG_HIDDEN); + } lv_obj_remove_flag(display->status_label_, LV_OBJ_FLAG_HIDDEN); }, .arg = this,