소스 검색

添加公司Logo显示

xuxinyi 4 달 전
부모
커밋
39a7f942e1
4개의 변경된 파일62개의 추가작업 그리고 7개의 파일을 삭제
  1. 1 0
      main/CMakeLists.txt
  2. 24 0
      main/command.c
  3. 20 0
      main/command.h
  4. 17 7
      main/display/lcd_display.cc

+ 1 - 0
main/CMakeLists.txt

@@ -14,6 +14,7 @@ set(SOURCES "audio_codecs/audio_codec.cc"
             "iot/thing_manager.cc"
             "system_info.cc"
             "application.cc"
+            "command.c"
             "ota.cc"
             "settings.cc"
             "background_task.cc"

파일 크기가 너무 크기때문에 변경 상태를 표시하지 않습니다.
+ 24 - 0
main/command.c


+ 20 - 0
main/command.h

@@ -0,0 +1,20 @@
+#ifndef COMMAND_IMAGE_H
+#define COMMAND_IMAGE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "lvgl.h"  // 包含 LVGL 头文件
+
+// 声明图像数据数组
+extern const uint8_t command_map[];
+
+// 声明图像描述符结构体(如果 .c 文件中已定义,则不需要重复定义)
+extern const lv_img_dsc_t command_img;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // COMMAND_IMAGE_H

+ 17 - 7
main/display/lcd_display.cc

@@ -8,6 +8,7 @@
 #include "assets/lang_config.h"
 #include <cstring>
 #include "settings.h"
+#include "command.h"
 
 #include "board.h"
 #include "esp_lcd_touch_gt911.h"
@@ -395,19 +396,28 @@ void LcdDisplay::SetupUI() {
     // 替代方案:使用旧版本兼容方法固定元素位置
     // 1. 创建一个固定在右下角的容器
     lv_obj_t* fixed_container = lv_obj_create(screen);
-    lv_obj_set_size(fixed_container, 40, 40); // 根据图标大小调整
+    lv_obj_set_size(fixed_container, 140, 140); // 根据图标大小调整
     lv_obj_align(fixed_container, LV_ALIGN_BOTTOM_RIGHT, -10, -10);
     lv_obj_set_style_bg_opa(fixed_container, LV_OPA_TRANSP, 0); // 透明背景
     lv_obj_set_style_border_width(fixed_container, 0, 0); // 无边框
     lv_obj_clear_flag(fixed_container, LV_OBJ_FLAG_SCROLLABLE); // 禁止滚动
 
     // 2. 将图标添加到这个容器中
-    emotion_label_1 = lv_label_create(fixed_container);
-    lv_obj_set_style_text_font(emotion_label_1, &font_awesome_30_4, 0);
-    lv_obj_set_style_text_color(emotion_label_1, current_theme.text, 0);
-    lv_label_set_text(emotion_label_1, FONT_AWESOME_AI_CHIP);
-    lv_obj_center(emotion_label_1); // 居中显示在容器中
-    lv_obj_set_style_pad_row(content_, 10, 0); // Space between messages
+    // emotion_label_1 = lv_label_create(fixed_container);
+    // lv_obj_set_style_text_font(emotion_label_1, &font_awesome_30_4, 0);
+    // lv_obj_set_style_text_color(emotion_label_1, current_theme.text, 0);
+    // lv_label_set_text(emotion_label_1, FONT_AWESOME_AI_CHIP);
+    // lv_obj_center(emotion_label_1); // 居中显示在容器中
+    // lv_obj_set_style_pad_row(content_, 10, 0); // Space between messages
+
+    // 添加图片到容器中
+    lv_obj_t* image_obj = lv_img_create(fixed_container);
+    // 设置图片源,这里假设使用内置图片资源或已注册的图片
+    lv_img_set_src(image_obj, &command_img); // 示例:使用内置符号作为图片
+    // 或者使用自定义图片:lv_img_set_src(image_obj, &image_data);
+    lv_obj_align(image_obj, LV_ALIGN_BOTTOM_MID, 0, -5); // 居底部中间显示
+    // lv_obj_set_style_img_recolor_opa(image_obj, LV_OPA_70, 0); // 设置图片透明度
+    // lv_obj_set_style_img_recolor(image_obj, lv_color_hex(0xF8F8FF), 0); // 设置图片颜色
 
     // We'll create chat messages dynamically in SetChatMessage
     chat_message_label_ = nullptr;

이 변경점에서 너무 많은 파일들이 변경되어 몇몇 파일들은 표시되지 않았습니다.