xiaozhi-esp32/main/boards/electron-bot/electron_emoji_display.h
Xiaoxia 83f6f8c703
Some checks are pending
Build Boards / Determine boards to build (push) Waiting to run
Build Boards / Build ${{ matrix.board }} (push) Blocked by required conditions
Switch to 2.0 branch (#1152)
* Adapt boards to v2 partition tables

* fix esp log error

* fix display style

* reset emotion after download assets

* fix compiling

* update assets default url

* Add user only tools

* Add image cache

* smaller cache and buffer, more heap

* use MAIN_EVENT_CLOCK_TICK to avoid audio glitches

* bump to 2.0.0

* fix compiling errors

---------

Co-authored-by: Xiaoxia <terrence.huang@tenclass.com>
2025-09-04 15:41:28 +08:00

48 lines
1.4 KiB
C++
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#pragma once
#include <libs/gif/lv_gif.h>
#include "display/lcd_display.h"
// Electron Bot表情GIF声明 - 使用与Otto相同的6个表情
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 Electron Bot GIF表情显示类
* 继承LcdDisplay添加GIF表情支持
*/
class ElectronEmojiDisplay : public SpiLcdDisplay {
public:
/**
* @brief 构造函数参数与SpiLcdDisplay相同
*/
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, DisplayStyle style);
virtual ~ElectronEmojiDisplay() = default;
// 重写表情设置方法
virtual void SetEmotion(const char* emotion) override;
// 重写聊天消息设置方法
virtual void SetChatMessage(const char* role, const char* content) override;
private:
void SetupGifContainer();
lv_obj_t* emotion_gif_; ///< GIF表情组件
// 表情映射
struct EmotionMap {
const char* name;
const lv_image_dsc_t* gif;
};
static const EmotionMap emotion_maps_[];
};