fix c3 compile

This commit is contained in:
Terrence
2025-01-23 22:44:44 +08:00
parent 2026472d48
commit c46052958f
2 changed files with 27 additions and 90 deletions

View File

@@ -17,9 +17,8 @@
#define TAG "magiclick_c3"
LV_FONT_DECLARE(font_puhui_14_1);
LV_FONT_DECLARE(font_awesome_30_4);
LV_FONT_DECLARE(font_awesome_14_1);
LV_FONT_DECLARE(font_puhui_16_4);
LV_FONT_DECLARE(font_awesome_16_4);
class NV3023Display : public LcdDisplay {
public:
@@ -28,95 +27,34 @@ public:
int width, int height, int offset_x, int offset_y, bool mirror_x, bool mirror_y, bool swap_xy)
: LcdDisplay(panel_io, panel, backlight_pin, backlight_output_invert,
width, height, offset_x, offset_y, mirror_x, mirror_y, swap_xy,
&font_puhui_14_1, &font_awesome_14_1) {}
&font_puhui_16_4, &font_awesome_16_4) {}
void SetupUI() override {
DisplayLockGuard lock(this);
// 调用父类的 SetupUI 来设置基本布局
LcdDisplay::SetupUI();
// 只需要覆盖颜色相关的样式
auto screen = lv_disp_get_scr_act(lv_disp_get_default());
lv_obj_set_style_text_font(screen,text_font_, 0);
lv_obj_set_style_text_color(screen, lv_color_black(), 0);
/* Container */
container_ = lv_obj_create(screen);
lv_obj_set_size(container_, LV_HOR_RES, LV_VER_RES);
lv_obj_set_flex_flow(container_, LV_FLEX_FLOW_COLUMN);
lv_obj_set_style_pad_all(container_, 0, 0);
lv_obj_set_style_border_width(container_, 0, 0);
lv_obj_set_style_pad_row(container_, 0, 0);
lv_obj_set_style_bg_color(container_,lv_color_black(), 0);
// 设置容器背景色
lv_obj_set_style_bg_color(container_, lv_color_black(), 0);
/* Status bar */
status_bar_ = lv_obj_create(container_);
lv_obj_set_size(status_bar_, LV_HOR_RES, text_font_->line_height);
lv_obj_set_style_radius(status_bar_, 0, 0);
lv_obj_set_style_bg_color(status_bar_, lv_color_make(0xff, 0xff, 0xff), 0);
/* Content */
content_ = lv_obj_create(container_);
lv_obj_set_scrollbar_mode(content_, LV_SCROLLBAR_MODE_OFF);
lv_obj_set_style_radius(content_, 0, 0);
lv_obj_set_width(content_, LV_HOR_RES);
lv_obj_set_flex_grow(content_, 1);
lv_obj_set_style_bg_color(content_,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);
lv_obj_set_style_text_color(status_label_, lv_color_black(), 0);
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_flex_flow(content_, LV_FLEX_FLOW_COLUMN); // 垂直布局(从上到下)
lv_obj_set_flex_align(content_, LV_FLEX_ALIGN_START, LV_FLEX_ALIGN_CENTER, LV_FLEX_ALIGN_SPACE_EVENLY); // 子对象顶部对齐,左右居中对齐,等距分布
emotion_label_ = lv_label_create(content_);
lv_obj_set_style_text_font(emotion_label_, &font_awesome_30_4, 0);
lv_label_set_text(emotion_label_, FONT_AWESOME_AI_CHIP);
lv_obj_set_style_text_color(emotion_label_,lv_color_white(), 0);
chat_message_label_ = lv_label_create(content_);
lv_label_set_text(chat_message_label_, "");
lv_obj_set_width(chat_message_label_, LV_HOR_RES * 0.9); // 限制宽度为屏幕宽度的 90%
lv_label_set_long_mode(chat_message_label_, LV_LABEL_LONG_WRAP); // 设置为自动换行模式
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);
/* Status bar */
lv_obj_set_flex_flow(status_bar_, LV_FLEX_FLOW_ROW);
lv_obj_set_style_pad_all(status_bar_, 0, 0);
lv_obj_set_style_border_width(status_bar_, 0, 0);
lv_obj_set_style_pad_column(status_bar_, 0, 0);
lv_obj_set_style_pad_left(status_bar_, 2, 0);
lv_obj_set_style_pad_right(status_bar_, 2, 0);
network_label_ = lv_label_create(status_bar_);
lv_label_set_text(network_label_, "");
lv_obj_set_style_text_font(network_label_, icon_font_, 0);
lv_obj_set_style_text_color(network_label_,lv_color_black(), 0);
notification_label_ = lv_label_create(status_bar_);
lv_obj_set_flex_grow(notification_label_, 1);
lv_obj_set_style_text_align(notification_label_, LV_TEXT_ALIGN_CENTER, 0);
lv_label_set_text(notification_label_, "通知");
lv_obj_add_flag(notification_label_, LV_OBJ_FLAG_HIDDEN);
lv_obj_set_style_text_color(notification_label_,lv_color_black(), 0);
status_label_ = lv_label_create(status_bar_);
lv_obj_set_flex_grow(status_label_, 1);
lv_label_set_long_mode(status_label_, LV_LABEL_LONG_SCROLL_CIRCULAR);
lv_label_set_text(status_label_, "正在初始化");
lv_obj_set_style_text_align(status_label_, LV_TEXT_ALIGN_CENTER, 0);
lv_obj_set_style_text_color(status_label_,lv_color_black(), 0);
mute_label_ = lv_label_create(status_bar_);
lv_label_set_text(mute_label_, "");
lv_obj_set_style_text_font(mute_label_, icon_font_, 0);
lv_obj_set_style_text_color(mute_label_,lv_color_black(), 0);
battery_label_ = lv_label_create(status_bar_);
lv_label_set_text(battery_label_, "");
lv_obj_set_style_text_font(battery_label_, icon_font_, 0);
lv_obj_set_style_text_color(battery_label_,lv_color_black(), 0);
lv_obj_set_style_text_color(emotion_label_, lv_color_white(), 0);
lv_obj_set_style_text_color(chat_message_label_, lv_color_white(), 0);
}
};