mirror of
https://github.com/78/xiaozhi-esp32.git
synced 2026-02-11 14:43:47 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
18e44ec775 | ||
|
|
81aa8a43ce | ||
|
|
dc28f0d9c2 | ||
|
|
a6ce728386 | ||
|
|
652e5cbcdd | ||
|
|
69540c6551 | ||
|
|
9e0de3b302 | ||
|
|
27a14c249a |
@@ -4,7 +4,7 @@
|
||||
# CMakeLists in this exact order for cmake to work correctly
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
set(PROJECT_VER "1.5.6")
|
||||
set(PROJECT_VER "1.5.8")
|
||||
|
||||
# Add this line to disable the specific warning
|
||||
add_compile_options(-Wno-missing-field-initializers)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "box_audio_codec.h"
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <driver/i2c.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/i2s_tdm.h>
|
||||
|
||||
static const char TAG[] = "BoxAudioCodec";
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "audio_codec.h"
|
||||
|
||||
#include <driver/i2c.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/gpio.h>
|
||||
#include <esp_codec_dev.h>
|
||||
#include <esp_codec_dev_defaults.h>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#include "audio_codec.h"
|
||||
|
||||
#include <driver/i2c.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <esp_codec_dev.h>
|
||||
#include <esp_codec_dev_defaults.h>
|
||||
|
||||
|
||||
@@ -78,7 +78,9 @@ void AudioProcessor::Start() {
|
||||
|
||||
void AudioProcessor::Stop() {
|
||||
xEventGroupClearBits(event_group_, PROCESSOR_RUNNING);
|
||||
afe_iface_->reset_buffer(afe_data_);
|
||||
if (afe_data_ != nullptr) {
|
||||
afe_iface_->reset_buffer(afe_data_);
|
||||
}
|
||||
}
|
||||
|
||||
bool AudioProcessor::IsRunning() {
|
||||
|
||||
@@ -83,7 +83,9 @@ void WakeWordDetect::StartDetection() {
|
||||
|
||||
void WakeWordDetect::StopDetection() {
|
||||
xEventGroupClearBits(event_group_, DETECTION_RUNNING_EVENT);
|
||||
afe_iface_->reset_buffer(afe_data_);
|
||||
if (afe_data_ != nullptr) {
|
||||
afe_iface_->reset_buffer(afe_data_);
|
||||
}
|
||||
}
|
||||
|
||||
bool WakeWordDetect::IsDetectionRunning() {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "k10_audio_codec.h"
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <driver/i2c.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/i2s_tdm.h>
|
||||
#include <cmath>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "box_audio_codec_lite.h"
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <driver/i2c.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/i2s_tdm.h>
|
||||
|
||||
static const char TAG[] = "BoxAudioCodecLite";
|
||||
|
||||
@@ -195,7 +195,11 @@ private:
|
||||
{
|
||||
.text_font = &font_puhui_20_4,
|
||||
.icon_font = &font_awesome_20_4,
|
||||
#if CONFIG_USE_WECHAT_MESSAGE_STYLE
|
||||
.emoji_font = font_emoji_32_init(),
|
||||
#else
|
||||
.emoji_font = font_emoji_64_init(),
|
||||
#endif
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -126,7 +126,11 @@ private:
|
||||
{
|
||||
.text_font = &font_puhui_20_4,
|
||||
.icon_font = &font_awesome_20_4,
|
||||
#if CONFIG_USE_WECHAT_MESSAGE_STYLE
|
||||
.emoji_font = font_emoji_32_init(),
|
||||
#else
|
||||
.emoji_font = font_emoji_64_init(),
|
||||
#endif
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <esp_log.h>
|
||||
#include "i2c_device.h"
|
||||
#include <driver/i2c.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/ledc.h>
|
||||
#include <wifi_station.h>
|
||||
#include <esp_lcd_panel_io.h>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <esp_log.h>
|
||||
#include "i2c_device.h"
|
||||
#include <driver/i2c.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/ledc.h>
|
||||
#include <wifi_station.h>
|
||||
#include <esp_lcd_panel_io.h>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include <esp_log.h>
|
||||
#include "i2c_device.h"
|
||||
#include <driver/i2c.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/ledc.h>
|
||||
#include <wifi_station.h>
|
||||
#include <esp_lcd_panel_io.h>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
#include <esp_log.h>
|
||||
#include "i2c_device.h"
|
||||
#include <driver/i2c.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/ledc.h>
|
||||
#include <wifi_station.h>
|
||||
#include <esp_lcd_panel_vendor.h>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "tcamerapluss3_audio_codec.h"
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <driver/i2c.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/i2s_tdm.h>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "tcircles3_audio_codec.h"
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <driver/i2c.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/i2s_tdm.h>
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "cores3_audio_codec.h"
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <driver/i2c.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/i2s_tdm.h>
|
||||
|
||||
|
||||
@@ -301,7 +301,11 @@ private:
|
||||
{
|
||||
.text_font = &font_puhui_20_4,
|
||||
.icon_font = &font_awesome_20_4,
|
||||
#if CONFIG_USE_WECHAT_MESSAGE_STYLE
|
||||
.emoji_font = font_emoji_32_init(),
|
||||
#else
|
||||
.emoji_font = font_emoji_64_init(),
|
||||
#endif
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,11 @@
|
||||
"builds": [
|
||||
{
|
||||
"name": "movecall-cuican-esp32s3",
|
||||
"sdkconfig_append": []
|
||||
"sdkconfig_append": [
|
||||
"CONFIG_ESPTOOLPY_FLASHSIZE_8MB=y",
|
||||
"CONFIG_PARTITION_TABLE_CUSTOM_FILENAME=\"partitions_8M.csv\"",
|
||||
"CONFIG_COMPILER_OPTIMIZATION_SIZE=y"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
#include "sensecap_audio_codec.h"
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <driver/i2c.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/i2s_tdm.h>
|
||||
|
||||
static const char TAG[] = "SensecapAudioCodec";
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "iot/thing_manager.h"
|
||||
|
||||
#include <esp_log.h>
|
||||
#include <driver/i2c.h>
|
||||
#include <driver/i2c_master.h>
|
||||
#include <driver/ledc.h>
|
||||
#include <wifi_station.h>
|
||||
#include <esp_lcd_panel_io.h>
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
{
|
||||
"name": "xingzhi-cube-1.54tft-ml307",
|
||||
"sdkconfig_append": []
|
||||
},
|
||||
{
|
||||
"name": "xingzhi-cube-1.54tft-ml307-wechatui",
|
||||
"sdkconfig_append": [
|
||||
"CONFIG_USE_WECHAT_MESSAGE_STYLE=y"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -155,7 +155,11 @@ private:
|
||||
{
|
||||
.text_font = &font_puhui_20_4,
|
||||
.icon_font = &font_awesome_20_4,
|
||||
#if CONFIG_USE_WECHAT_MESSAGE_STYLE
|
||||
.emoji_font = font_emoji_32_init(),
|
||||
#else
|
||||
.emoji_font = font_emoji_64_init(),
|
||||
#endif
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -159,7 +159,11 @@ private:
|
||||
{
|
||||
.text_font = &font_puhui_20_4,
|
||||
.icon_font = &font_awesome_20_4,
|
||||
#if CONFIG_USE_WECHAT_MESSAGE_STYLE
|
||||
.emoji_font = font_emoji_32_init(),
|
||||
#else
|
||||
.emoji_font = font_emoji_64_init(),
|
||||
#endif
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -174,6 +174,7 @@ RgbLcdDisplay::RgbLcdDisplay(esp_lcd_panel_io_handle_t panel_io, esp_lcd_panel_h
|
||||
ESP_LOGI(TAG, "Initialize LVGL port");
|
||||
lvgl_port_cfg_t port_cfg = ESP_LVGL_PORT_INIT_CONFIG();
|
||||
port_cfg.task_priority = 1;
|
||||
port_cfg.timer_period_ms = 50;
|
||||
lvgl_port_init(&port_cfg);
|
||||
|
||||
ESP_LOGI(TAG, "Adding LCD screen");
|
||||
|
||||
@@ -10,7 +10,7 @@ dependencies:
|
||||
78/esp_lcd_nv3023: "~1.0.0"
|
||||
78/esp-wifi-connect: "~2.3.1"
|
||||
78/esp-opus-encoder: "~2.3.0"
|
||||
78/esp-ml307: "~1.7.3"
|
||||
78/esp-ml307: "~1.8.1"
|
||||
78/xiaozhi-fonts: "~1.3.2"
|
||||
espressif/led_strip: "^2.4.1"
|
||||
espressif/esp_codec_dev: "~1.3.2"
|
||||
|
||||
@@ -100,14 +100,16 @@ bool MqttProtocol::StartMqttClient(bool report_error) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void MqttProtocol::SendText(const std::string& text) {
|
||||
bool MqttProtocol::SendText(const std::string& text) {
|
||||
if (publish_topic_.empty()) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
if (!mqtt_->Publish(publish_topic_, text)) {
|
||||
ESP_LOGE(TAG, "Failed to publish message: %s", text.c_str());
|
||||
SetError(Lang::Strings::SERVER_ERROR);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void MqttProtocol::SendAudio(const std::vector<uint8_t>& data) {
|
||||
@@ -174,7 +176,9 @@ bool MqttProtocol::OpenAudioChannel() {
|
||||
message += "\"audio_params\":{";
|
||||
message += "\"format\":\"opus\", \"sample_rate\":16000, \"channels\":1, \"frame_duration\":" + std::to_string(OPUS_FRAME_DURATION_MS);
|
||||
message += "}}";
|
||||
SendText(message);
|
||||
if (!SendText(message)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// 等待服务器响应
|
||||
EventBits_t bits = xEventGroupWaitBits(event_group_handle_, MQTT_PROTOCOL_SERVER_HELLO_EVENT, pdTRUE, pdFALSE, pdMS_TO_TICKS(10000));
|
||||
|
||||
@@ -54,7 +54,7 @@ private:
|
||||
void ParseServerHello(const cJSON* root);
|
||||
std::string DecodeHexString(const std::string& hex_string);
|
||||
|
||||
void SendText(const std::string& text) override;
|
||||
bool SendText(const std::string& text) override;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ protected:
|
||||
std::string session_id_;
|
||||
std::chrono::time_point<std::chrono::steady_clock> last_incoming_time_;
|
||||
|
||||
virtual void SendText(const std::string& text) = 0;
|
||||
virtual bool SendText(const std::string& text) = 0;
|
||||
virtual void SetError(const std::string& message);
|
||||
virtual bool IsTimeout() const;
|
||||
};
|
||||
|
||||
@@ -33,15 +33,18 @@ void WebsocketProtocol::SendAudio(const std::vector<uint8_t>& data) {
|
||||
websocket_->Send(data.data(), data.size(), true);
|
||||
}
|
||||
|
||||
void WebsocketProtocol::SendText(const std::string& text) {
|
||||
bool WebsocketProtocol::SendText(const std::string& text) {
|
||||
if (websocket_ == nullptr) {
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!websocket_->Send(text)) {
|
||||
ESP_LOGE(TAG, "Failed to send text: %s", text.c_str());
|
||||
SetError(Lang::Strings::SERVER_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool WebsocketProtocol::IsAudioChannelOpened() const {
|
||||
@@ -116,7 +119,9 @@ bool WebsocketProtocol::OpenAudioChannel() {
|
||||
message += "\"audio_params\":{";
|
||||
message += "\"format\":\"opus\", \"sample_rate\":16000, \"channels\":1, \"frame_duration\":" + std::to_string(OPUS_FRAME_DURATION_MS);
|
||||
message += "}}";
|
||||
websocket_->Send(message);
|
||||
if (!SendText(message)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Wait for server hello
|
||||
EventBits_t bits = xEventGroupWaitBits(event_group_handle_, WEBSOCKET_PROTOCOL_SERVER_HELLO_EVENT, pdTRUE, pdFALSE, pdMS_TO_TICKS(10000));
|
||||
|
||||
@@ -26,7 +26,7 @@ private:
|
||||
WebSocket* websocket_ = nullptr;
|
||||
|
||||
void ParseServerHello(const cJSON* root);
|
||||
void SendText(const std::string& text) override;
|
||||
bool SendText(const std::string& text) override;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -51,7 +51,7 @@ def release_current():
|
||||
|
||||
def get_all_board_types():
|
||||
board_configs = {}
|
||||
with open("main/CMakeLists.txt") as f:
|
||||
with open("main/CMakeLists.txt", encoding='utf-8') as f:
|
||||
lines = f.readlines()
|
||||
for i, line in enumerate(lines):
|
||||
# 查找 if(CONFIG_BOARD_TYPE_*) 行
|
||||
@@ -73,10 +73,6 @@ def release(board_type, board_config):
|
||||
# Print Project Version
|
||||
project_version = get_project_version()
|
||||
print(f"Project Version: {project_version}", config_path)
|
||||
release_path = f"releases/v{project_version}_{board_type}.zip"
|
||||
if os.path.exists(release_path):
|
||||
print(f"跳过 {board_type} 因为 {release_path} 已存在")
|
||||
return
|
||||
|
||||
with open(config_path, "r") as f:
|
||||
config = json.load(f)
|
||||
@@ -86,7 +82,11 @@ def release(board_type, board_config):
|
||||
for build in builds:
|
||||
name = build["name"]
|
||||
if not name.startswith(board_type):
|
||||
raise ValueError(f"name {name} 必须 {board_type} 开头")
|
||||
raise ValueError(f"name {name} 必须以 {board_type} 开头")
|
||||
output_path = f"releases/v{project_version}_{name}.zip"
|
||||
if os.path.exists(output_path):
|
||||
print(f"跳过 {board_type} 因为 {output_path} 已存在")
|
||||
continue
|
||||
|
||||
sdkconfig_append = [f"{board_config}=y"]
|
||||
for append in build.get("sdkconfig_append", []):
|
||||
|
||||
@@ -26,6 +26,9 @@ CONFIG_ESP_WIFI_DYNAMIC_RX_MGMT_BUFFER=y
|
||||
|
||||
CONFIG_CODEC_I2C_BACKWARD_COMPATIBLE=n
|
||||
|
||||
# Fix ML307 FIFO Overflow
|
||||
CONFIG_UART_ISR_IN_IRAM=y
|
||||
|
||||
# LVGL 9.2.2
|
||||
|
||||
CONFIG_LV_OS_NONE=y
|
||||
|
||||
Reference in New Issue
Block a user