add some code

This commit is contained in:
2025-09-05 13:25:11 +08:00
parent 9ff0a99e7a
commit 3cf1229a85
8911 changed files with 2535396 additions and 0 deletions

View File

@@ -0,0 +1 @@
22580fe159d3fae35f1c44634e883726f503424eb0c96bc1ee9b2cf9e32b6f2f

View File

@@ -0,0 +1 @@
dist/

View File

@@ -0,0 +1 @@
{"version": "1.0", "algorithm": "sha256", "created_at": "2025-06-05T06:34:07.344462+00:00", "files": [{"path": ".gitIgnore", "size": 5, "hash": "887f42eeae4276a8ba8ed3e14ec6567107ed2760d18ea7303cc715a38670fbea"}, {"path": "CMakeLists.txt", "size": 1003, "hash": "c4776d9762f5a9f77800f7864541ac7ab29441ac3a470ea8c7b23fd8a5ef5592"}, {"path": "LICENSE", "size": 1084, "hash": "5e7adf0d4325ec1a8d8b18f187afb72a99532e3293e230d37bde141eae4f1408"}, {"path": "README.md", "size": 4289, "hash": "6b621ae497ca098451d63e43cf6b9e2b5612a2629c6fc51237bdf6012a5c938a"}, {"path": "idf_component.yml", "size": 352, "hash": "145f538ceff2bbb7dc4c35d68e5f510883513e3300fba1f773824cc91e02747d"}, {"path": "include/otto_emoji_gif.h", "size": 1795, "hash": "e5969afce0a54e166614ef2e3ed3d5f2bfc51d3bae6aa78a5986c75fe1bd53bb"}, {"path": "src/anger.c", "size": 225002, "hash": "d904f498a67b0e024530faf12dc5a5c4b3f272fe3581644bd8417c3e84a1b671"}, {"path": "src/buxue.c", "size": 250181, "hash": "0fac26c0464de6214e4464afd78d3bf62d949cd214785def5d08b93a61312038"}, {"path": "src/happy.c", "size": 253032, "hash": "c10172b58ac07048b19a897095e9a8e05edd1ec0914624ff60b805858b856b3c"}, {"path": "src/otto_emoji_gif_utils.c", "size": 1253, "hash": "7f97f467232e65ca074da4633955fb50cf67010d856226e3c0101fde8c776f5b"}, {"path": "src/sad.c", "size": 208212, "hash": "21f604e1d1ecfb32b9bb8fe3bac0bfaa9a165d977e07033aca268ff6da672b1e"}, {"path": "src/scare.c", "size": 312846, "hash": "aa2e054ff7b0f8df02160e500dc4c99f733bcf949222bcfefbbb50fb69ac83f5"}, {"path": "src/staticstate.c", "size": 166808, "hash": "0eee2e4939211beb92e851ff4128eb119e810e2d31d6a5e3a63c20a9e6a74878"}]}

View File

@@ -0,0 +1,35 @@
# Otto机器人GIF表情组件
#
# 这个组件包含了Otto机器人的6个GIF表情资源
# - staticstate (静态状态/中性表情)
# - sad (悲伤表情)
# - happy (开心表情)
# - scare (惊吓/惊讶表情)
# - buxue (不学/困惑表情)
# - anger (愤怒表情)
# 收集所有GIF源文件
file(GLOB GIF_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.c")
# 检查是否找到GIF源文件
list(LENGTH GIF_SOURCES GIF_COUNT)
if(GIF_COUNT EQUAL 0)
message(WARNING "未找到GIF源文件请确保src目录中包含.c文件")
endif()
# 注册组件
idf_component_register(
SRCS ${GIF_SOURCES}
INCLUDE_DIRS "include"
REQUIRES "lvgl"
)
# 添加编译定义
target_compile_definitions(${COMPONENT_LIB}
PRIVATE OTTO_EMOJI_GIF_VERSION="1.0.2"
)
# 输出调试信息
message(STATUS "Otto Emoji GIF Component:")
message(STATUS " Found ${GIF_COUNT} GIF source files")
message(STATUS " Include directory: ${CMAKE_CURRENT_SOURCE_DIR}/include")

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025 小鹏
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,153 @@
# Otto 机器人 GIF 表情组件
Otto Robot Emoji GIF Component for ESP-IDF
## 概述
这是一个 ESP-IDF 组件,包含了 Otto 机器人的 6 个 GIF 表情资源,专为 LVGL 显示系统设计。组件提供了完整的 GIF 动画资源,可以在支持 LVGL 的 ESP32 设备上显示动态表情。
## 支持的表情
| 表情名称 | 描述 | 用途 |
| ------------- | ----------------- | ------------------------ |
| `staticstate` | 静态状态/中性表情 | 默认表情,表示平静状态 |
| `sad` | 悲伤表情 | 表示难过、沮丧等负面情绪 |
| `happy` | 开心表情 | 表示高兴、愉快等正面情绪 |
| `scare` | 惊吓/惊讶表情 | 表示震惊、意外等情绪 |
| `buxue` | 不学/困惑表情 | 表示疑惑、不理解等状态 |
| `anger` | 愤怒表情 | 表示生气、愤怒等强烈情绪 |
## 系统要求
- ESP-IDF >= 5.4.0
- LVGL >= 9.0
- 支持的芯片ESP32, ESP32-S3, ESP32-C3, ESP32-C6, ESP32-H2, ESP32-P4
## 安装方法
### 方法 1使用 ESP-IDF 组件管理器(推荐)
在您的项目的 `idf_component.yml` 文件中添加:
```yaml
dependencies:
otto_emoji_gif:
version: "^1.0.2"
# 或者使用本地路径
# path: "../path/to/otto-emoji-gif-component"
```
### 方法 2手动安装
1. 将此组件复制到您的项目的 `components/` 目录中
2. 或者将其添加为 Git 子模块
## 使用方法
### 基础用法
```c
#include "otto_emoji_gif.h"
void display_emotion(lv_obj_t* parent) {
// 创建GIF对象
lv_obj_t* gif = lv_gif_create(parent);
// 设置表情
lv_gif_set_src(gif, &happy); // 显示开心表情
// 设置位置和大小
lv_obj_set_size(gif, 240, 240);
lv_obj_center(gif);
}
```
### 动态切换表情
```c
#include "otto_emoji_gif.h"
void switch_emotion(lv_obj_t* gif, const char* emotion_name) {
const lv_img_dsc_t* emotion = otto_emoji_gif_get_by_name(emotion_name);
if (emotion != NULL) {
lv_gif_set_src(gif, emotion);
} else {
// 使用默认表情
lv_gif_set_src(gif, &staticstate);
}
}
// 使用示例
void example_usage(lv_obj_t* gif) {
switch_emotion(gif, "happy"); // 切换到开心表情
switch_emotion(gif, "sad"); // 切换到悲伤表情
switch_emotion(gif, "anger"); // 切换到愤怒表情
}
```
### 获取组件信息
```c
#include "otto_emoji_gif.h"
void print_component_info() {
printf("Otto Emoji GIF组件版本: %s\n", otto_emoji_gif_get_version());
printf("支持的表情数量: %d\n", otto_emoji_gif_get_count());
}
```
## 文件结构
```
otto-emoji-gif-component/
├── idf_component.yml # 组件配置文件
├── CMakeLists.txt # 构建配置
├── README.md # 说明文档
├── LICENSE # 许可证
├── include/
│ └── otto_emoji_gif.h # 头文件
└── src/
├── otto_emoji_gif_utils.c # 辅助函数
├── staticstate.c # 静态表情GIF数据
├── sad.c # 悲伤表情GIF数据
├── happy.c # 开心表情GIF数据
├── scare.c # 惊吓表情GIF数据
├── buxue.c # 困惑表情GIF数据
└── anger.c # 愤怒表情GIF数据
```
## 技术细节
- 所有 GIF 资源都经过优化,适合在嵌入式设备上使用
- 使用 LVGL 的 GIF 库进行渲染
- 支持透明背景
- 文件大小经过优化,平衡了画质和存储空间
## 许可证
MIT License - 详见 [LICENSE](LICENSE) 文件
## 贡献
欢迎提交问题和拉取请求。在贡献代码之前,请阅读贡献指南。
## 更新日志
### v1.0.2 (2025)
- bug fix
### v1.0.1 (2025)
- 删除示例项目,简化组件结构
- 优化组件发布配置
### v1.0.0 (2025)
- 初始版本发布
- 包含 6 个基础表情 GIF
- 支持 ESP-IDF 5.4.0+和 LVGL 9.0+
## 联系方式
如有问题请提交 Issue 或联系维护者。

View File

@@ -0,0 +1,16 @@
dependencies:
idf:
version: '>=5.4.0'
lvgl/lvgl: '>=9.0'
description: Otto机器人GIF表情资源包 - 包含6个动态表情GIF
license: MIT
repository: https://github.com/txp666/otto-emoji-gif-component
targets:
- esp32s3
- esp32
- esp32c3
- esp32c6
- esp32h2
- esp32p4
url: https://github.com/txp666/otto-emoji-gif-component
version: 1.0.2

View File

@@ -0,0 +1,78 @@
/**
* @file otto_emoji_gif.h
* @brief Otto机器人GIF表情资源组件
*
* 这个头文件声明了Otto机器人的6个GIF表情资源用于在LVGL显示屏上显示动态表情。
*
* @version 1.0.2
* @date 2024
*
* 支持的表情:
* - staticstate: 静态状态/中性表情
* - sad: 悲伤表情
* - happy: 开心表情
* - scare: 惊吓/惊讶表情
* - buxue: 不学/困惑表情
* - anger: 愤怒表情
*/
#pragma once
#include <libs/gif/lv_gif.h>
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief Otto机器人表情GIF声明
*
* 这些GIF资源可以直接用于LVGL的lv_gif组件
*
* 使用示例:
* ```c
* lv_obj_t* gif = lv_gif_create(parent);
* lv_gif_set_src(gif, &happy); // 设置开心表情
* ```
*/
// 静态状态/中性表情 - 默认表情,表示平静状态
LV_IMAGE_DECLARE(staticstate);
// 悲伤表情 - 表示难过、沮丧等负面情绪
LV_IMAGE_DECLARE(sad);
// 开心表情 - 表示高兴、愉快等正面情绪
LV_IMAGE_DECLARE(happy);
// 惊吓/惊讶表情 - 表示震惊、意外等情绪
LV_IMAGE_DECLARE(scare);
// 不学/困惑表情 - 表示疑惑、不理解等状态
LV_IMAGE_DECLARE(buxue);
// 愤怒表情 - 表示生气、愤怒等强烈情绪
LV_IMAGE_DECLARE(anger);
/**
* @brief 获取组件版本
* @return 版本字符串
*/
const char* otto_emoji_gif_get_version(void);
/**
* @brief 获取支持的表情数量
* @return 表情数量
*/
int otto_emoji_gif_get_count(void);
/**
* @brief 根据名称获取表情资源
* @param name 表情名称
* @return 表情资源指针如果未找到则返回NULL
*/
const lv_image_dsc_t* otto_emoji_gif_get_by_name(const char* name);
#ifdef __cplusplus
}
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,55 @@
/**
* @file otto_emoji_gif_utils.c
* @brief Otto机器人GIF表情资源组件辅助函数实现
*/
#include <string.h>
#include "otto_emoji_gif.h"
// 表情映射表
typedef struct {
const char* name;
const lv_image_dsc_t* gif;
} emotion_map_t;
// 外部声明的GIF资源
extern const lv_image_dsc_t staticstate;
extern const lv_image_dsc_t sad;
extern const lv_image_dsc_t happy;
extern const lv_image_dsc_t scare;
extern const lv_image_dsc_t buxue;
extern const lv_image_dsc_t anger;
// 表情映射表
static const emotion_map_t emotion_maps[] = {
{"staticstate", &staticstate},
{"sad", &sad},
{"happy", &happy},
{"scare", &scare},
{"buxue", &buxue},
{"anger", &anger},
{NULL, NULL} // 结束标记
};
const char* otto_emoji_gif_get_version(void) {
return "1.0.2";
}
int otto_emoji_gif_get_count(void) {
return 6;
}
const lv_image_dsc_t* otto_emoji_gif_get_by_name(const char* name) {
if (name == NULL) {
return NULL;
}
for (int i = 0; emotion_maps[i].name != NULL; i++) {
if (strcmp(emotion_maps[i].name, name) == 0) {
return emotion_maps[i].gif;
}
}
return NULL; // 未找到
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff