This commit is contained in:
0Xiao0
2026-06-17 09:39:06 +08:00
parent 4903fdd7a8
commit 6a66014a19
5 changed files with 42 additions and 7 deletions

View File

@ -653,12 +653,20 @@ elseif(CONFIG_BOARD_TYPE_ZHENGCHEN_CAM)
set(BOARD_TYPE "zhengchen-cam") set(BOARD_TYPE "zhengchen-cam")
set(BUILTIN_TEXT_FONT font_puhui_20_4) set(BUILTIN_TEXT_FONT font_puhui_20_4)
set(BUILTIN_ICON_FONT font_awesome_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) elseif(CONFIG_BOARD_TYPE_ZHENGCHEN_CAM_ML307)
set(BOARD_TYPE "zhengchen-cam-ml307") set(BOARD_TYPE "zhengchen-cam-ml307")
set(BUILTIN_TEXT_FONT font_puhui_20_4) set(BUILTIN_TEXT_FONT font_puhui_20_4)
set(BUILTIN_ICON_FONT font_awesome_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) elseif(CONFIG_BOARD_TYPE_SPOTPEAR_ESP32_S3_1_54_MUMA)
set(BOARD_TYPE "sp-esp32-s3-1.54-muma") set(BOARD_TYPE "sp-esp32-s3-1.54-muma")
set(BUILTIN_TEXT_FONT font_puhui_basic_16_4) set(BUILTIN_TEXT_FONT font_puhui_basic_16_4)

View File

@ -133,6 +133,14 @@ choice BOARD_TYPE
depends on IDF_TARGET_ESP32S3 depends on IDF_TARGET_ESP32S3
endchoice 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 choice
depends on BOARD_TYPE_LILYGO_T_DISPLAY_P4 depends on BOARD_TYPE_LILYGO_T_DISPLAY_P4
prompt "Select the screen type" prompt "Select the screen type"

View File

@ -1,7 +1,6 @@
# Custom Emojis # Custom Emojis
Put your custom PNG or GIF files in this directory, or in `png/` and `gif/` Put your custom PNG files in `png/` and custom GIF files in `gif/`.
subdirectories.
The filename without extension is used as the emotion name. Directory names are 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`. not part of the emotion name, so `png/neutral.png` is loaded as `neutral`.
@ -28,8 +27,12 @@ Recommended minimum set:
- `angry` - `angry`
If an emotion-specific image is missing, the firmware falls back to `neutral` 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 before using the built-in icon.
`gif/happy.gif`; only one image per emotion should be used.
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 After adding or replacing files, run a full flash so the assets partition is
updated: updated:

View File

@ -65,7 +65,7 @@ void ApplyEmojiImageScale(lv_obj_t* image_obj, lv_obj_t* image_box, const lv_ima
if (image_box != nullptr) { if (image_box != nullptr) {
lv_obj_center(image_obj); 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<long>(scale), static_cast<long>(top_reserved), static_cast<long>(scale), static_cast<long>(top_reserved),
static_cast<long>(bottom_reserved), static_cast<long>(image_width), static_cast<long>(bottom_reserved), static_cast<long>(image_width),
static_cast<long>(image_height), static_cast<long>(image_height),

View File

@ -3,6 +3,7 @@
#include <string> #include <string>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <ctime>
#include <font_awesome.h> #include <font_awesome.h>
#include "lvgl_display.h" #include "lvgl_display.h"
@ -22,6 +23,21 @@ LvglDisplay::LvglDisplay() {
LvglDisplay *display = static_cast<LvglDisplay*>(arg); LvglDisplay *display = static_cast<LvglDisplay*>(arg);
DisplayLockGuard lock(display); DisplayLockGuard lock(display);
lv_obj_add_flag(display->notification_label_, LV_OBJ_FLAG_HIDDEN); 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); lv_obj_remove_flag(display->status_label_, LV_OBJ_FLAG_HIDDEN);
}, },
.arg = this, .arg = this,