diff --git a/main/boards/yunliao-s3/README.md b/main/boards/yunliao-s3/README.md index 0cf6973..0fc4433 100644 --- a/main/boards/yunliao-s3/README.md +++ b/main/boards/yunliao-s3/README.md @@ -4,9 +4,9 @@ 小智云聊 S3 是小智 AI 的魔改项目,是首个 2.8 寸护眼大屏+大字体+2000mah 大电池的量产成品,做了大量创新和优化。 -## 合并版 +## 官方版 -合并版代码在小智 AI 主项目中维护,跟随主项目的一起版本更新,便于用户自行扩展和第三方固件扩展。支持语音唤醒、语音打断、OTA、4G 自由切换等功能。 +官方版代码在小智 AI 主项目中维护,跟随主项目的一起版本更新,便于用户自行扩展和第三方固件扩展。支持语音唤醒、语音打断、OTA、4G 自由切换等功能。 > ### 按键操作 > @@ -14,11 +14,12 @@ > - **关机**: 开机状态,长按 1 秒后释放按键,标题栏会显示'请稍候',再等 2 秒自动关机。 > - **唤醒/打断**: 正常通话环境下,单击按键。 > - **切换 4G/Wifi**: 启动过程或者配网界面,1 秒钟内双击按键(需安装 4G 模块)。 +> - **切换语音(AEC)打断模式**: 正常启动后,在空闲无对话模式下,1 秒钟内双击按键,循环切换语音打断模式。 > - **重新配网**: 开机状态,1 秒钟内三击按键,会自动重启并进入配网界面。 > ### 语音指令 > -> - **打开/关闭语音打断模式**: 在播放音乐时,需要关闭语音打断模式,否则可能会打断音乐播放。 +> - **打开/关闭语音(AEC)打断模式**: 在播放音乐时,需要关闭语音打断模式,否则可能会打断音乐播放。 > - **切换 IPS 屏幕显示模式**: 新版小智云聊 S3 升级了 IPS 屏幕,需要切换屏幕显示模式后才能正常显示,可以来回切换。 ## 魔改版 @@ -36,7 +37,7 @@ ## 版本区别 -> | 特性 | 合并版 | 魔改版 | +> | 特性 | 官方版 | 魔改版 | > | -------------- | ------ | ------ | > | 语音打断 | ✓ | ✓ | > | 4G 功能 | ✓ | ✓ | @@ -50,7 +51,7 @@ > | 扫码访问控制台 | X | ✓ | > | 繁日英文界面 | X | ✓ | > | 多语言支持 | 需自行编译 | ✓ | -> | 外接蓝牙音箱 | ✓ | ✓ | +> | 外接蓝牙音箱/耳机 | ✓ | ✓ | # 编译配置命令 diff --git a/main/boards/yunliao-s3/yunliao_s3.cc b/main/boards/yunliao-s3/yunliao_s3.cc index 944fa28..56f57bf 100644 --- a/main/boards/yunliao-s3/yunliao_s3.cc +++ b/main/boards/yunliao-s3/yunliao_s3.cc @@ -15,11 +15,35 @@ #define TAG "YunliaoS3" +class YunliaoDisplay : public SpiLcdDisplay { +public: + YunliaoDisplay(esp_lcd_panel_io_handle_t io_handle, + esp_lcd_panel_handle_t panel_handle, + int width, + int height, + int offset_x, + int offset_y, + bool mirror_x, + bool mirror_y, + bool swap_xy) + : SpiLcdDisplay(io_handle, panel_handle, width, height, offset_x, offset_y, mirror_x, mirror_y, swap_xy) { + } + + virtual void SetupUI() override { + SpiLcdDisplay::SetupUI(); + auto& theme_manager = LvglThemeManager::GetInstance(); + auto theme = theme_manager.GetTheme("dark"); + if (theme != nullptr) { + SetTheme(theme); + } + } +}; + class YunliaoS3 : public DualNetworkBoard { private: i2c_master_bus_handle_t codec_i2c_bus_; Button boot_button_; - SpiLcdDisplay* display_; + YunliaoDisplay* display_; PowerSaveTimer* power_save_timer_; PowerManager* power_manager_; @@ -83,6 +107,11 @@ class YunliaoS3 : public DualNetworkBoard { if (app.GetDeviceState() == kDeviceStateStarting || app.GetDeviceState() == kDeviceStateWifiConfiguring) { SwitchNetworkType(); + }else if(app.GetDeviceState() == kDeviceStateIdle){ + bool enableAec = app.GetAecMode() == kAecOff; + SetAecMode(enableAec); + Settings settings("aec", true); + settings.SetInt("mode", enableAec); } }); boot_button_.OnMultipleClick( @@ -133,15 +162,10 @@ class YunliaoS3 : public DualNetworkBoard { esp_lcd_panel_invert_color(panel, currentIpsMode); esp_lcd_panel_swap_xy(panel, DISPLAY_SWAP_XY); esp_lcd_panel_mirror(panel, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y); - display_ = new SpiLcdDisplay(panel_io, panel, DISPLAY_WIDTH, + display_ = new YunliaoDisplay(panel_io, panel, DISPLAY_WIDTH, DISPLAY_HEIGHT, DISPLAY_OFFSET_X, DISPLAY_OFFSET_Y, DISPLAY_MIRROR_X, DISPLAY_MIRROR_Y, DISPLAY_SWAP_XY); - auto& theme_manager = LvglThemeManager::GetInstance(); - auto theme = theme_manager.GetTheme("dark"); - if (theme != nullptr) { - display_->SetTheme(theme); - } } void InitializeTools(){ auto& mcp_server = McpServer::GetInstance(); @@ -218,7 +242,18 @@ class YunliaoS3 : public DualNetworkBoard { power_manager_->Enable4G(); } power_manager_->OnBtLinkStatusChanged([this](bool is_connected) { - SetAecMode(!is_connected); + auto& app = Application::GetInstance(); + if (is_connected) { + if (app.GetAecMode() != kAecOff) { + SetAecMode(false); + } + } else { + Settings settings("aec", false); + int storedMode = settings.GetInt("mode", kAecOnDeviceSide); + if (storedMode != kAecOff && app.GetAecMode() == kAecOff) { + SetAecMode(storedMode == kAecOnDeviceSide); + } + } }); power_manager_->InitializeBtModul(); InitializeTools();