Fix setupui (#1777)
* Enhance GitHub Actions artifact download script - Updated the output directory structure to save downloaded files in a version-specific subdirectory (releases/<version>). - Added a new function to determine the default releases directory path relative to the script's location. - Improved artifact renaming logic to handle known extensions more robustly and ensure compatibility with filenames containing dots. * Refactor UI setup in ElectronEmojiDisplay and OttoEmojiDisplay classes - Moved SetupChatLabel call in ElectronEmojiDisplay to ensure it is executed after the parent UI is initialized, preventing potential issues with container validity. - Updated SetupUI in OttoEmojiDisplay to release the display lock before calling SetEmotion, avoiding deadlock scenarios during UI setup. * Add multiline chat message support in display configuration - Introduced a new Kconfig option to enable multiline chat message display in the default mode. - Updated the LCD display setup to accommodate a dynamic height bottom bar for multiline messages. - Modified the configuration files for the waveshare-esp32-s3-epaper-1.54 board to include the new chat message setting. * Update font and emoji settings for Magiclick boards; enhance bottom bar visibility logic in LCD display - Changed the default text and emoji fonts for Magiclick S3 2P4 and S3 2P5 boards to Noto fonts. - Improved bottom bar visibility logic in LcdDisplay to hide when there is no content, ensuring a cleaner UI experience.
This commit is contained in:
@ -15,7 +15,6 @@
|
||||
ElectronEmojiDisplay::ElectronEmojiDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel, int width, int height, int offset_x, int offset_y, bool mirror_x, bool mirror_y,
|
||||
bool swap_xy)
|
||||
: SpiLcdDisplay(panel_io, panel, width, height, offset_x, offset_y, mirror_x, mirror_y, swap_xy) {
|
||||
SetupChatLabel();
|
||||
}
|
||||
|
||||
void ElectronEmojiDisplay::SetupUI() {
|
||||
@ -25,9 +24,12 @@ void ElectronEmojiDisplay::SetupUI() {
|
||||
return;
|
||||
}
|
||||
|
||||
// Call parent SetupUI() first to create all lvgl objects
|
||||
// Call parent SetupUI() first to create all lvgl objects (including container_)
|
||||
SpiLcdDisplay::SetupUI();
|
||||
|
||||
|
||||
// Setup chat label after parent UI is initialized so that container_ is valid
|
||||
SetupChatLabel();
|
||||
|
||||
// Set default emotion after UI is initialized
|
||||
SetEmotion("staticstate");
|
||||
}
|
||||
@ -40,18 +42,22 @@ void ElectronEmojiDisplay::InitializeElectronEmojis() {
|
||||
}
|
||||
|
||||
void ElectronEmojiDisplay::SetupChatLabel() {
|
||||
DisplayLockGuard lock(this);
|
||||
// Create/recreate the chat label under the display lock
|
||||
{
|
||||
DisplayLockGuard lock(this);
|
||||
|
||||
if (chat_message_label_) {
|
||||
lv_obj_del(chat_message_label_);
|
||||
if (chat_message_label_) {
|
||||
lv_obj_del(chat_message_label_);
|
||||
}
|
||||
|
||||
chat_message_label_ = lv_label_create(container_);
|
||||
lv_label_set_text(chat_message_label_, "");
|
||||
lv_obj_set_width(chat_message_label_, width_ * 0.9);
|
||||
lv_label_set_long_mode(chat_message_label_, LV_LABEL_LONG_SCROLL_CIRCULAR);
|
||||
lv_obj_set_style_text_align(chat_message_label_, LV_TEXT_ALIGN_CENTER, 0);
|
||||
lv_obj_set_style_text_color(chat_message_label_, lv_color_white(), 0);
|
||||
}
|
||||
|
||||
chat_message_label_ = lv_label_create(container_);
|
||||
lv_label_set_text(chat_message_label_, "");
|
||||
lv_obj_set_width(chat_message_label_, width_ * 0.9); // 限制宽度为屏幕宽度的 90%
|
||||
lv_label_set_long_mode(chat_message_label_, LV_LABEL_LONG_SCROLL_CIRCULAR); // 设置为自动换行模式
|
||||
lv_obj_set_style_text_align(chat_message_label_, LV_TEXT_ALIGN_CENTER, 0); // 设置文本居中对齐
|
||||
lv_obj_set_style_text_color(chat_message_label_, lv_color_white(), 0);
|
||||
// SetTheme acquires DisplayLockGuard internally, so call it after releasing the lock above
|
||||
SetTheme(LvglThemeManager::GetInstance().GetTheme("dark"));
|
||||
}
|
||||
|
||||
|
||||
@ -23,16 +23,18 @@ public:
|
||||
NV3023Display(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
|
||||
int width, int height, int offset_x, int offset_y, bool mirror_x, bool mirror_y, bool swap_xy)
|
||||
: SpiLcdDisplay(panel_io, panel, width, height, offset_x, offset_y, mirror_x, mirror_y, swap_xy) {
|
||||
}
|
||||
|
||||
void SetupUI() override {
|
||||
SpiLcdDisplay::SetupUI();
|
||||
|
||||
// Apply custom color styles after parent creates all LVGL objects
|
||||
DisplayLockGuard lock(this);
|
||||
// 只需要覆盖颜色相关的样式
|
||||
auto screen = lv_disp_get_scr_act(lv_disp_get_default());
|
||||
lv_obj_set_style_text_color(screen, lv_color_black(), 0);
|
||||
|
||||
// 设置容器背景色
|
||||
lv_obj_set_style_bg_color(container_, lv_color_black(), 0);
|
||||
|
||||
// 设置状态栏背景色和文本颜色
|
||||
lv_obj_set_style_bg_color(status_bar_, lv_color_white(), 0);
|
||||
lv_obj_set_style_text_color(network_label_, lv_color_black(), 0);
|
||||
lv_obj_set_style_text_color(notification_label_, lv_color_black(), 0);
|
||||
@ -40,7 +42,6 @@ public:
|
||||
lv_obj_set_style_text_color(mute_label_, lv_color_black(), 0);
|
||||
lv_obj_set_style_text_color(battery_label_, lv_color_black(), 0);
|
||||
|
||||
// 设置内容区背景色和文本颜色
|
||||
lv_obj_set_style_bg_color(content_, lv_color_black(), 0);
|
||||
lv_obj_set_style_border_width(content_, 0, 0);
|
||||
lv_obj_set_style_text_color(emoji_label_, lv_color_white(), 0);
|
||||
|
||||
@ -23,16 +23,18 @@ public:
|
||||
GC9107Display(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
|
||||
int width, int height, int offset_x, int offset_y, bool mirror_x, bool mirror_y, bool swap_xy)
|
||||
: SpiLcdDisplay(panel_io, panel, width, height, offset_x, offset_y, mirror_x, mirror_y, swap_xy) {
|
||||
}
|
||||
|
||||
void SetupUI() override {
|
||||
SpiLcdDisplay::SetupUI();
|
||||
|
||||
// Apply custom color styles after parent creates all LVGL objects
|
||||
DisplayLockGuard lock(this);
|
||||
// 只需要覆盖颜色相关的样式
|
||||
auto screen = lv_disp_get_scr_act(lv_disp_get_default());
|
||||
lv_obj_set_style_text_color(screen, lv_color_black(), 0);
|
||||
|
||||
// 设置容器背景色
|
||||
lv_obj_set_style_bg_color(container_, lv_color_black(), 0);
|
||||
|
||||
// 设置状态栏背景色和文本颜色
|
||||
lv_obj_set_style_bg_color(status_bar_, lv_color_make(0x1e, 0x90, 0xff), 0);
|
||||
lv_obj_set_style_text_color(network_label_, lv_color_black(), 0);
|
||||
lv_obj_set_style_text_color(notification_label_, lv_color_black(), 0);
|
||||
@ -40,12 +42,11 @@ public:
|
||||
lv_obj_set_style_text_color(mute_label_, lv_color_black(), 0);
|
||||
lv_obj_set_style_text_color(battery_label_, lv_color_black(), 0);
|
||||
|
||||
// 设置内容区背景色和文本颜色
|
||||
lv_obj_set_style_bg_color(content_, lv_color_black(), 0);
|
||||
lv_obj_set_style_border_width(content_, 0, 0);
|
||||
lv_obj_set_style_text_color(emoji_label_, lv_color_white(), 0);
|
||||
lv_obj_set_style_text_color(chat_message_label_, lv_color_white(), 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
static const gc9a01_lcd_init_cmd_t gc9107_lcd_init_cmds[] = {
|
||||
|
||||
@ -21,16 +21,18 @@ public:
|
||||
NV3023Display(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_handle_t panel,
|
||||
int width, int height, int offset_x, int offset_y, bool mirror_x, bool mirror_y, bool swap_xy)
|
||||
: SpiLcdDisplay(panel_io, panel, width, height, offset_x, offset_y, mirror_x, mirror_y, swap_xy) {
|
||||
}
|
||||
|
||||
void SetupUI() override {
|
||||
SpiLcdDisplay::SetupUI();
|
||||
|
||||
// Apply custom color styles after parent creates all LVGL objects
|
||||
DisplayLockGuard lock(this);
|
||||
// 只需要覆盖颜色相关的样式
|
||||
auto screen = lv_disp_get_scr_act(lv_disp_get_default());
|
||||
lv_obj_set_style_text_color(screen, lv_color_black(), 0);
|
||||
|
||||
// 设置容器背景色
|
||||
lv_obj_set_style_bg_color(container_, lv_color_black(), 0);
|
||||
|
||||
// 设置状态栏背景色和文本颜色
|
||||
lv_obj_set_style_bg_color(status_bar_, lv_color_white(), 0);
|
||||
lv_obj_set_style_text_color(network_label_, lv_color_black(), 0);
|
||||
lv_obj_set_style_text_color(notification_label_, lv_color_black(), 0);
|
||||
@ -38,7 +40,6 @@ public:
|
||||
lv_obj_set_style_text_color(mute_label_, lv_color_black(), 0);
|
||||
lv_obj_set_style_text_color(battery_label_, lv_color_black(), 0);
|
||||
|
||||
// 设置内容区背景色和文本颜色
|
||||
lv_obj_set_style_bg_color(content_, lv_color_black(), 0);
|
||||
lv_obj_set_style_border_width(content_, 0, 0);
|
||||
lv_obj_set_style_text_color(emoji_label_, lv_color_white(), 0);
|
||||
|
||||
@ -27,10 +27,13 @@ void OttoEmojiDisplay::SetupUI() {
|
||||
// Call parent SetupUI() first to create all lvgl objects
|
||||
SpiLcdDisplay::SetupUI();
|
||||
|
||||
// Setup preview image after UI is initialized
|
||||
DisplayLockGuard lock(this);
|
||||
lv_obj_set_size(preview_image_, width_ , height_ );
|
||||
|
||||
// Setup preview image after UI is initialized - release lock before calling SetEmotion
|
||||
// to avoid deadlock (SetEmotion also acquires DisplayLockGuard internally)
|
||||
{
|
||||
DisplayLockGuard lock(this);
|
||||
lv_obj_set_size(preview_image_, width_ , height_ );
|
||||
}
|
||||
|
||||
// Set default emotion after UI is initialized
|
||||
SetEmotion("staticstate");
|
||||
}
|
||||
|
||||
@ -6,7 +6,8 @@
|
||||
"name": "esp32-s3-epaper-1.54-v2",
|
||||
"sdkconfig_append": [
|
||||
"CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y",
|
||||
"CONFIG_PARTITION_TABLE_CUSTOM_FILENAME=\"partitions/v2/8m.csv\""
|
||||
"CONFIG_PARTITION_TABLE_CUSTOM_FILENAME=\"partitions/v2/8m.csv\"",
|
||||
"CONFIG_USE_MULTILINE_CHAT_MESSAGE=y"
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -14,7 +15,8 @@
|
||||
"sdkconfig_append": [
|
||||
"CONFIG_SPIRAM_MODE_QUAD=y",
|
||||
"CONFIG_ESPTOOLPY_FLASHSIZE_4MB=y",
|
||||
"CONFIG_PARTITION_TABLE_CUSTOM_FILENAME=\"partitions/v2/4m.csv\""
|
||||
"CONFIG_PARTITION_TABLE_CUSTOM_FILENAME=\"partitions/v2/4m.csv\"",
|
||||
"CONFIG_USE_MULTILINE_CHAT_MESSAGE=y"
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user