1. 完成了语音识别的C++业务层封装,测试通过

2. 试着测试了一下LVGL_GIF渲染+音乐播放+语音识别的组合简单优化后,
          发现lvgl渲染略显卡顿,语音识别有缓冲区空警告,不过无伤大雅,还需要进一步深度优化。
This commit is contained in:
Misaki
2025-09-23 03:17:23 +08:00
parent 4cc761aab3
commit 48f208b2e6
19 changed files with 587 additions and 94 deletions
+38
View File
@@ -1,4 +1,42 @@
//
// Created by misaki on 2025/9/2.
//
#include "ToolsClass.h"
#include <esp_mac.h>
#include <esp_efuse.h>
#include <esp_log.h>
#include <array>
#include <esp_efuse_table.h>
#include <sstream>
#include <iomanip>
static const char *TAG = "ToolsClass";
std::string ToolsClass::getChipSerialNumber() {
// 获取芯片序列号(17 字节长的 "Chip ID" (乐鑫官方唯一序列号))
std::array<uint8_t, 17> id{};
/* 下面这个宏在 ESP32-S3 上展开为 17 byte 序列号字段,直接可用 */
esp_err_t err = esp_efuse_read_field_blob(ESP_EFUSE_OPTIONAL_UNIQUE_ID, id.data(), id.size() * 8);
if (err != ESP_OK) {
ESP_LOGE(TAG, "read Chip ID failed: %s", esp_err_to_name(err));
return "";
}
std::stringstream ss;
for (uint8_t v : id) ss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(v);
return ss.str();
}
std::string ToolsClass::getChipMAC() {
std::array<uint8_t, 6> mac{};
esp_efuse_mac_get_default(mac.data()); // 读出厂 MAC
std::stringstream ss;
for (size_t i = 0; i < mac.size(); ++i) {
ss << std::hex << std::setw(2) << std::setfill('0') << static_cast<int>(mac[i]);
if (i + 1 != mac.size()) ss << ':';
}
return ss.str();
}