fix(ota): 修复 ottoRobot和electronBot OTA 升级崩溃问题 bug (#812)

* otto v1.4.0 MCP

1.使用MCP协议控制机器人
2.gif继承lcdDisplay,避免修改lcdDisplay

* otto v1.4.1 gif as components

gif as components

* electronBot v1.1.0 mcp

1.增加electronBot支持
2.mcp协议
3.gif 作为组件
4.display子类

* 规范代码

1.规范代码
2.修复切换主题死机bug

* fix(ota): 修复 ottoRobot和electronBot OTA 升级崩溃问题 bug
This commit is contained in:
小鹏
2025-06-13 13:46:14 +08:00
committed by GitHub
parent f8c9126442
commit 7bb17f7539
6 changed files with 60 additions and 2 deletions

View File

@@ -47,5 +47,5 @@
#define BOOT_BUTTON_GPIO GPIO_NUM_0 #define BOOT_BUTTON_GPIO GPIO_NUM_0
#define ELECTRON_BOT_VERSION "1.1.1" #define ELECTRON_BOT_VERSION "1.1.2"
#endif // _BOARD_CONFIG_H_ #endif // _BOARD_CONFIG_H_

View File

@@ -4,6 +4,9 @@
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring>
#include <string>
#include "font_awesome_symbols.h"
#define TAG "ElectronEmojiDisplay" #define TAG "ElectronEmojiDisplay"
@@ -141,4 +144,27 @@ void ElectronEmojiDisplay::SetChatMessage(const char* role, const char* content)
lv_obj_clear_flag(chat_message_label_, LV_OBJ_FLAG_HIDDEN); lv_obj_clear_flag(chat_message_label_, LV_OBJ_FLAG_HIDDEN);
ESP_LOGI(TAG, "设置聊天消息 [%s]: %s", role, content); ESP_LOGI(TAG, "设置聊天消息 [%s]: %s", role, content);
}
void ElectronEmojiDisplay::SetIcon(const char* icon) {
if (!icon) {
return;
}
DisplayLockGuard lock(this);
if (chat_message_label_ != nullptr) {
std::string icon_message = std::string(icon) + " ";
if (strcmp(icon, FONT_AWESOME_DOWNLOAD) == 0) {
icon_message += "正在升级...";
} else {
icon_message += "系统状态";
}
lv_label_set_text(chat_message_label_, icon_message.c_str());
lv_obj_clear_flag(chat_message_label_, LV_OBJ_FLAG_HIDDEN);
ESP_LOGI(TAG, "设置图标: %s", icon);
}
} }

View File

@@ -33,6 +33,9 @@ public:
// 重写聊天消息设置方法 // 重写聊天消息设置方法
virtual void SetChatMessage(const char* role, const char* content) override; virtual void SetChatMessage(const char* role, const char* content) override;
// 重写图标设置方法
virtual void SetIcon(const char* icon) override;
private: private:
void SetupGifContainer(); void SetupGifContainer();

View File

@@ -47,6 +47,6 @@
#define BOOT_BUTTON_GPIO GPIO_NUM_0 #define BOOT_BUTTON_GPIO GPIO_NUM_0
#define OTTO_ROBOT_VERSION "1.4.2" #define OTTO_ROBOT_VERSION "1.4.3"
#endif // _BOARD_CONFIG_H_ #endif // _BOARD_CONFIG_H_

View File

@@ -4,8 +4,11 @@
#include <algorithm> #include <algorithm>
#include <cstring> #include <cstring>
#include <string>
#include "display/lcd_display.h" #include "display/lcd_display.h"
#include "font_awesome_symbols.h"
#define TAG "OttoEmojiDisplay" #define TAG "OttoEmojiDisplay"
// 表情映射表 - 将原版21种表情映射到现有6个GIF // 表情映射表 - 将原版21种表情映射到现有6个GIF
@@ -143,3 +146,26 @@ void OttoEmojiDisplay::SetChatMessage(const char* role, const char* content) {
ESP_LOGI(TAG, "设置聊天消息 [%s]: %s", role, content); ESP_LOGI(TAG, "设置聊天消息 [%s]: %s", role, content);
} }
void OttoEmojiDisplay::SetIcon(const char* icon) {
if (!icon) {
return;
}
DisplayLockGuard lock(this);
if (chat_message_label_ != nullptr) {
std::string icon_message = std::string(icon) + " ";
if (strcmp(icon, FONT_AWESOME_DOWNLOAD) == 0) {
icon_message += "正在升级...";
} else {
icon_message += "系统状态";
}
lv_label_set_text(chat_message_label_, icon_message.c_str());
lv_obj_clear_flag(chat_message_label_, LV_OBJ_FLAG_HIDDEN);
ESP_LOGI(TAG, "设置图标: %s", icon);
}
}

View File

@@ -26,6 +26,9 @@ public:
// 重写聊天消息设置方法 // 重写聊天消息设置方法
virtual void SetChatMessage(const char* role, const char* content) override; virtual void SetChatMessage(const char* role, const char* content) override;
// 添加SetIcon方法声明
virtual void SetIcon(const char* icon) override;
private: private:
void SetupGifContainer(); void SetupGifContainer();