rename files

This commit is contained in:
Terrence 2024-11-05 20:15:00 +08:00
parent bc4b0a0bb1
commit 458ac2c999
41 changed files with 155 additions and 147 deletions

View File

@ -4,7 +4,7 @@
# CMakeLists in this exact order for cmake to work correctly # CMakeLists in this exact order for cmake to work correctly
cmake_minimum_required(VERSION 3.16) cmake_minimum_required(VERSION 3.16)
set(PROJECT_VER "0.6.3") set(PROJECT_VER "0.7.0")
include($ENV{IDF_PATH}/tools/cmake/project.cmake) include($ENV{IDF_PATH}/tools/cmake/project.cmake)
project(xiaozhi) project(xiaozhi)

View File

@ -1,12 +1,12 @@
set(SOURCES "AudioDevice.cc" set(SOURCES "audio_device.cc"
"FirmwareUpgrade.cc" "system_info.cc"
"SystemInfo.cc" "system_reset.cc"
"SystemReset.cc" "application.cc"
"Application.cc" "button.cc"
"Button.cc" "builtin_led.cc"
"BuiltinLed.cc" "display.cc"
"Display.cc" "board.cc"
"Board.cc" "ota.cc"
"main.cc" "main.cc"
) )
set(INCLUDE_DIRS ".") set(INCLUDE_DIRS ".")
@ -16,46 +16,46 @@ if(CONFIG_BOARD_TYPE_BREAD_COMPACT_WIFI)
# add all files from boards/bread-compact-wifi # add all files from boards/bread-compact-wifi
set(BOARD_TYPE "bread-compact-wifi") set(BOARD_TYPE "bread-compact-wifi")
file(GLOB BOARD_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}/*.cc) file(GLOB BOARD_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}/*.cc)
list(APPEND SOURCES ${BOARD_SOURCES} "WifiBoard.cc") list(APPEND SOURCES ${BOARD_SOURCES} "wifi_board.cc")
list(APPEND INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}) list(APPEND INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE})
elseif(CONFIG_BOARD_TYPE_BREAD_COMPACT_ML307) elseif(CONFIG_BOARD_TYPE_BREAD_COMPACT_ML307)
# add all files from boards/bread-compact-ml307 # add all files from boards/bread-compact-ml307
set(BOARD_TYPE "bread-compact-ml307") set(BOARD_TYPE "bread-compact-ml307")
file(GLOB BOARD_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}/*.cc) file(GLOB BOARD_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}/*.cc)
list(APPEND SOURCES ${BOARD_SOURCES} "Ml307Board.cc") list(APPEND SOURCES ${BOARD_SOURCES} "ml307_board.cc")
list(APPEND INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}) list(APPEND INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE})
elseif(CONFIG_BOARD_TYPE_ESP_BOX_3) elseif(CONFIG_BOARD_TYPE_ESP_BOX_3)
# add all files from boards/esp-box-3 # add all files from boards/esp-box-3
set(BOARD_TYPE "esp-box-3") set(BOARD_TYPE "esp-box-3")
file(GLOB BOARD_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}/*.cc) file(GLOB BOARD_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}/*.cc)
list(APPEND SOURCES ${BOARD_SOURCES} "WifiBoard.cc") list(APPEND SOURCES ${BOARD_SOURCES} "wifi_board.cc")
list(APPEND INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}) list(APPEND INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE})
list(APPEND SOURCES "BoxAudioDevice.cc") list(APPEND SOURCES "box_audio_device.cc")
elseif(CONFIG_BOARD_TYPE_KEVIN_BOX_0) elseif(CONFIG_BOARD_TYPE_KEVIN_BOX_0)
# add all files from boards/kevin-box-0 # add all files from boards/kevin-box-0
set(BOARD_TYPE "kevin-box-0") set(BOARD_TYPE "kevin-box-0")
file(GLOB BOARD_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}/*.cc) file(GLOB BOARD_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}/*.cc)
list(APPEND SOURCES ${BOARD_SOURCES} "Ml307Board.cc") list(APPEND SOURCES ${BOARD_SOURCES} "ml307_board.cc")
list(APPEND INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}) list(APPEND INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE})
list(APPEND SOURCES "BoxAudioDevice.cc") list(APPEND SOURCES "box_audio_device.cc")
elseif(CONFIG_BOARD_TYPE_KEVIN_BOX_1) elseif(CONFIG_BOARD_TYPE_KEVIN_BOX_1)
# add all files from boards/kevin-box-1 # add all files from boards/kevin-box-1
set(BOARD_TYPE "kevin-box-1") set(BOARD_TYPE "kevin-box-1")
file(GLOB BOARD_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}/*.cc) file(GLOB BOARD_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}/*.cc)
list(APPEND SOURCES ${BOARD_SOURCES} "Ml307Board.cc") list(APPEND SOURCES ${BOARD_SOURCES} "ml307_board.cc")
list(APPEND INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}) list(APPEND INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE})
list(APPEND SOURCES "BoxAudioDevice.cc") list(APPEND SOURCES "box_audio_device.cc")
elseif(CONFIG_BOARD_TYPE_LICHUANG_DEV) elseif(CONFIG_BOARD_TYPE_LICHUANG_DEV)
# add all files from boards/lichuang-dev # add all files from boards/lichuang-dev
set(BOARD_TYPE "lichuang-dev") set(BOARD_TYPE "lichuang-dev")
file(GLOB BOARD_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}/*.cc) file(GLOB BOARD_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}/*.cc)
list(APPEND SOURCES ${BOARD_SOURCES} "WifiBoard.cc") list(APPEND SOURCES ${BOARD_SOURCES} "wifi_board.cc")
list(APPEND INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE}) list(APPEND INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/boards/${BOARD_TYPE})
list(APPEND SOURCES "BoxAudioDevice.cc") list(APPEND SOURCES "box_audio_device.cc")
endif() endif()
if(CONFIG_USE_AFE_SR) if(CONFIG_USE_AFE_SR)
list(APPEND SOURCES "AudioProcessor.cc" "WakeWordDetect.cc") list(APPEND SOURCES "audio_processor.cc" "wake_word_detect.cc")
endif() endif()
idf_component_register(SRCS ${SOURCES} idf_component_register(SRCS ${SOURCES}

View File

@ -1,8 +1,7 @@
#include <BuiltinLed.h> #include "builtin_led.h"
#include <Ml307SslTransport.h> #include "system_info.h"
#include <WifiConfigurationAp.h> #include "ml307_ssl_transport.h"
#include <WifiStation.h> #include "application.h"
#include <SystemInfo.h>
#include <cstring> #include <cstring>
#include <esp_log.h> #include <esp_log.h>
@ -10,8 +9,6 @@
#include <driver/gpio.h> #include <driver/gpio.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include "Application.h"
#define TAG "Application" #define TAG "Application"
extern const char p3_err_reg_start[] asm("_binary_err_reg_p3_start"); extern const char p3_err_reg_start[] asm("_binary_err_reg_p3_start");
@ -40,8 +37,8 @@ Application::Application()
reference_resampler_.Configure(AUDIO_INPUT_SAMPLE_RATE, 16000); reference_resampler_.Configure(AUDIO_INPUT_SAMPLE_RATE, 16000);
} }
firmware_upgrade_.SetCheckVersionUrl(CONFIG_OTA_VERSION_URL); ota_.SetCheckVersionUrl(CONFIG_OTA_VERSION_URL);
firmware_upgrade_.SetHeader("Device-Id", SystemInfo::GetMacAddress().c_str()); ota_.SetHeader("Device-Id", SystemInfo::GetMacAddress().c_str());
} }
Application::~Application() { Application::~Application() {
@ -70,15 +67,15 @@ Application::~Application() {
void Application::CheckNewVersion() { void Application::CheckNewVersion() {
// Check if there is a new firmware version available // Check if there is a new firmware version available
firmware_upgrade_.SetPostData(Board::GetInstance().GetJson()); ota_.SetPostData(Board::GetInstance().GetJson());
firmware_upgrade_.CheckVersion(); ota_.CheckVersion();
if (firmware_upgrade_.HasNewVersion()) { if (ota_.HasNewVersion()) {
// Wait for the chat state to be idle // Wait for the chat state to be idle
while (chat_state_ != kChatStateIdle) { while (chat_state_ != kChatStateIdle) {
vTaskDelay(100); vTaskDelay(100);
} }
SetChatState(kChatStateUpgrading); SetChatState(kChatStateUpgrading);
firmware_upgrade_.StartUpgrade([this](int progress, size_t speed) { ota_.StartUpgrade([this](int progress, size_t speed) {
char buffer[64]; char buffer[64];
snprintf(buffer, sizeof(buffer), "Upgrading...\n %d%% %zuKB/s", progress, speed / 1024); snprintf(buffer, sizeof(buffer), "Upgrading...\n %d%% %zuKB/s", progress, speed / 1024);
display_.SetText(buffer); display_.SetText(buffer);
@ -87,7 +84,7 @@ void Application::CheckNewVersion() {
ESP_LOGI(TAG, "Firmware upgrade failed..."); ESP_LOGI(TAG, "Firmware upgrade failed...");
SetChatState(kChatStateIdle); SetChatState(kChatStateIdle);
} else { } else {
firmware_upgrade_.MarkCurrentVersionValid(); ota_.MarkCurrentVersionValid();
} }
} }

View File

@ -9,21 +9,21 @@
#include <list> #include <list>
#include <condition_variable> #include <condition_variable>
#include <OpusEncoder.h> #include "opus_encoder.h"
#include <OpusResampler.h> #include "opus_resampler.h"
#include <WebSocket.h> #include <web_socket.h>
#include "AudioDevice.h" #include "audio_device.h"
#include "Display.h" #include "display.h"
#include "Board.h" #include "board.h"
#include "FirmwareUpgrade.h" #include "ota.h"
#ifdef CONFIG_USE_AFE_SR #ifdef CONFIG_USE_AFE_SR
#include "WakeWordDetect.h" #include "wake_word_detect.h"
#include "AudioProcessor.h" #include "audio_processor.h"
#endif #endif
#include "Button.h" #include "button.h"
#define DETECTION_RUNNING 1 #define DETECTION_RUNNING 1
#define COMMUNICATION_RUNNING 2 #define COMMUNICATION_RUNNING 2
@ -95,7 +95,7 @@ private:
WakeWordDetect wake_word_detect_; WakeWordDetect wake_word_detect_;
AudioProcessor audio_processor_; AudioProcessor audio_processor_;
#endif #endif
FirmwareUpgrade firmware_upgrade_; Ota ota_;
std::mutex mutex_; std::mutex mutex_;
std::condition_variable_any cv_; std::condition_variable_any cv_;
std::list<std::function<void()>> main_tasks_; std::list<std::function<void()>> main_tasks_;

View File

@ -1,5 +1,5 @@
#include "AudioDevice.h" #include "audio_device.h"
#include "Board.h" #include "board.h"
#include <esp_log.h> #include <esp_log.h>
#include <cstring> #include <cstring>

View File

@ -8,7 +8,7 @@
#include <string> #include <string>
#include <functional> #include <functional>
#include "Board.h" #include "board.h"
class AudioDevice { class AudioDevice {
public: public:

View File

@ -1,4 +1,4 @@
#include "AudioProcessor.h" #include "audio_processor.h"
#include <esp_log.h> #include <esp_log.h>
#define PROCESSOR_RUNNING 0x01 #define PROCESSOR_RUNNING 0x01

View File

@ -1,5 +1,5 @@
#include "Board.h" #include "board.h"
#include "SystemInfo.h" #include "system_info.h"
#include <esp_log.h> #include <esp_log.h>
#include <esp_ota_ops.h> #include <esp_ota_ops.h>

View File

@ -2,8 +2,9 @@
#define BOARD_H #define BOARD_H
#include "config.h" #include "config.h"
#include <Http.h>
#include <WebSocket.h> #include <http.h>
#include <web_socket.h>
#include <string> #include <string>
void* create_board(); void* create_board();

View File

@ -1,5 +1,7 @@
#include "Ml307Board.h" #include "ml307_board.h"
#include "SystemReset.h" #include "system_reset.h"
#include "audio_device.h"
#include <esp_log.h> #include <esp_log.h>
#define TAG "CompactMl307Board" #define TAG "CompactMl307Board"

View File

@ -1,5 +1,7 @@
#include "WifiBoard.h" #include "wifi_board.h"
#include "SystemReset.h" #include "system_reset.h"
#include "audio_device.h"
#include <esp_log.h> #include <esp_log.h>
#define TAG "CompactWifiBoard" #define TAG "CompactWifiBoard"

View File

@ -5,7 +5,7 @@
#define AUDIO_INPUT_SAMPLE_RATE 16000 #define AUDIO_INPUT_SAMPLE_RATE 16000
#define AUDIO_OUTPUT_SAMPLE_RATE 16000 #define AUDIO_OUTPUT_SAMPLE_RATE 16000
#define AUDIO_DEFAULT_OUTPUT_VOLUME 70 #define AUDIO_DEFAULT_OUTPUT_VOLUME 90
#define AUDIO_INPUT_REFERENCE true #define AUDIO_INPUT_REFERENCE true

View File

@ -1,5 +1,5 @@
#include "WifiBoard.h" #include "wifi_board.h"
#include "BoxAudioDevice.h" #include "box_audio_device.h"
#include <esp_log.h> #include <esp_log.h>

View File

@ -1,5 +1,5 @@
#include "Ml307Board.h" #include "ml307_board.h"
#include "BoxAudioDevice.h" #include "box_audio_device.h"
#include <esp_log.h> #include <esp_log.h>
#include <esp_spiffs.h> #include <esp_spiffs.h>

View File

@ -1,5 +1,5 @@
#include "Ml307Board.h" #include "ml307_board.h"
#include "BoxAudioDevice.h" #include "box_audio_device.h"
#include <esp_log.h> #include <esp_log.h>
#include <esp_spiffs.h> #include <esp_spiffs.h>

View File

@ -1,20 +0,0 @@
#include "WifiBoard.h"
#include "BoxAudioDevice.h"
#include <esp_log.h>
#define TAG "LiChuangDevBoard"
class LiChuangDevBoard : public WifiBoard {
public:
virtual void Initialize() override {
ESP_LOGI(TAG, "Initializing LiChuangDevBoard");
WifiBoard::Initialize();
}
virtual AudioDevice* CreateAudioDevice() override {
return new BoxAudioDevice();
}
};
DECLARE_BOARD(LiChuangDevBoard);

View File

@ -5,7 +5,7 @@
#define AUDIO_INPUT_SAMPLE_RATE 24000 #define AUDIO_INPUT_SAMPLE_RATE 24000
#define AUDIO_OUTPUT_SAMPLE_RATE 24000 #define AUDIO_OUTPUT_SAMPLE_RATE 24000
#define AUDIO_DEFAULT_OUTPUT_VOLUME 80 #define AUDIO_DEFAULT_OUTPUT_VOLUME 90
#define AUDIO_INPUT_REFERENCE true #define AUDIO_INPUT_REFERENCE true

View File

@ -0,0 +1,20 @@
#include "wifi_board.h"
#include "box_audio_device.h"
#include <esp_log.h>
#define TAG "LichuangDevBoard"
class LichuangDevBoard : public WifiBoard {
public:
virtual void Initialize() override {
ESP_LOGI(TAG, "Initializing LichuangDevBoard");
WifiBoard::Initialize();
}
virtual AudioDevice* CreateAudioDevice() override {
return new BoxAudioDevice();
}
};
DECLARE_BOARD(LichuangDevBoard);

View File

@ -1,5 +1,5 @@
#include "BoxAudioDevice.h" #include "box_audio_device.h"
#include "Board.h" #include "board.h"
#include <esp_log.h> #include <esp_log.h>
#include <cassert> #include <cassert>

View File

@ -1,7 +1,8 @@
#ifndef _BOX_AUDIO_DEVICE_H #ifndef _BOX_AUDIO_DEVICE_H
#define _BOX_AUDIO_DEVICE_H #define _BOX_AUDIO_DEVICE_H
#include "AudioDevice.h" #include "audio_device.h"
#include <driver/i2c_master.h> #include <driver/i2c_master.h>
#include <driver/i2s_tdm.h> #include <driver/i2s_tdm.h>
#include <esp_codec_dev.h> #include <esp_codec_dev.h>

View File

@ -1,5 +1,6 @@
#include "BuiltinLed.h" #include "builtin_led.h"
#include "Board.h" #include "board.h"
#include <cstring> #include <cstring>
#include <esp_log.h> #include <esp_log.h>

View File

@ -1,4 +1,5 @@
#include "Button.h" #include "button.h"
#include <esp_log.h> #include <esp_log.h>
static const char* TAG = "Button"; static const char* TAG = "Button";

View File

@ -6,9 +6,9 @@
#include <string> #include <string>
#include <cstdlib> #include <cstdlib>
#include "Display.h" #include "display.h"
#include "Board.h" #include "board.h"
#include "Application.h" #include "application.h"
#define TAG "Display" #define TAG "Display"

View File

@ -1,8 +1,8 @@
## IDF Component Manager Manifest File ## IDF Component Manager Manifest File
dependencies: dependencies:
78/esp-wifi-connect: "~1.2.0" 78/esp-wifi-connect: "~1.3.0"
78/esp-opus-encoder: "~1.0.2" 78/esp-opus-encoder: "~1.1.0"
78/esp-ml307: "~1.3.0" 78/esp-ml307: "~1.4.0"
espressif/led_strip: "^2.4.1" espressif/led_strip: "^2.4.1"
espressif/esp_codec_dev: "^1.3.1" espressif/esp_codec_dev: "^1.3.1"
espressif/esp-sr: "^1.9.0" espressif/esp-sr: "^1.9.0"

View File

@ -5,8 +5,8 @@
#include <driver/gpio.h> #include <driver/gpio.h>
#include <esp_event.h> #include <esp_event.h>
#include "Application.h" #include "application.h"
#include "SystemInfo.h" #include "system_info.h"
#define TAG "main" #define TAG "main"

View File

@ -1,11 +1,11 @@
#include "Ml307Board.h" #include "ml307_board.h"
#include "Application.h" #include "application.h"
#include <esp_log.h> #include <esp_log.h>
#include <Ml307Http.h>
#include <Ml307SslTransport.h>
#include <WebSocket.h>
#include <esp_timer.h> #include <esp_timer.h>
#include <ml307_http.h>
#include <ml307_ssl_transport.h>
#include <web_socket.h>
static const char *TAG = "Ml307Board"; static const char *TAG = "Ml307Board";

View File

@ -1,8 +1,8 @@
#ifndef ML307_BOARD_H #ifndef ML307_BOARD_H
#define ML307_BOARD_H #define ML307_BOARD_H
#include "Board.h" #include "board.h"
#include <Ml307AtModem.h> #include <ml307_at_modem.h>
class Ml307Board : public Board { class Ml307Board : public Board {
protected: protected:

View File

@ -1,6 +1,6 @@
#include "FirmwareUpgrade.h" #include "ota.h"
#include "SystemInfo.h" #include "system_info.h"
#include "Board.h" #include "board.h"
#include <cJSON.h> #include <cJSON.h>
#include <esp_log.h> #include <esp_log.h>
@ -13,28 +13,28 @@
#include <sstream> #include <sstream>
#include <algorithm> #include <algorithm>
#define TAG "FirmwareUpgrade" #define TAG "Ota"
FirmwareUpgrade::FirmwareUpgrade() { Ota::Ota() {
} }
FirmwareUpgrade::~FirmwareUpgrade() { Ota::~Ota() {
} }
void FirmwareUpgrade::SetCheckVersionUrl(std::string check_version_url) { void Ota::SetCheckVersionUrl(std::string check_version_url) {
check_version_url_ = check_version_url; check_version_url_ = check_version_url;
} }
void FirmwareUpgrade::SetHeader(const std::string& key, const std::string& value) { void Ota::SetHeader(const std::string& key, const std::string& value) {
headers_[key] = value; headers_[key] = value;
} }
void FirmwareUpgrade::SetPostData(const std::string& post_data) { void Ota::SetPostData(const std::string& post_data) {
post_data_ = post_data; post_data_ = post_data;
} }
void FirmwareUpgrade::CheckVersion() { void Ota::CheckVersion() {
std::string current_version = esp_app_get_description()->version; std::string current_version = esp_app_get_description()->version;
ESP_LOGI(TAG, "Current version: %s", current_version.c_str()); ESP_LOGI(TAG, "Current version: %s", current_version.c_str());
@ -101,7 +101,7 @@ void FirmwareUpgrade::CheckVersion() {
} }
} }
void FirmwareUpgrade::MarkCurrentVersionValid() { void Ota::MarkCurrentVersionValid() {
auto partition = esp_ota_get_running_partition(); auto partition = esp_ota_get_running_partition();
if (strcmp(partition->label, "factory") == 0) { if (strcmp(partition->label, "factory") == 0) {
ESP_LOGI(TAG, "Running from factory partition, skipping"); ESP_LOGI(TAG, "Running from factory partition, skipping");
@ -121,7 +121,7 @@ void FirmwareUpgrade::MarkCurrentVersionValid() {
} }
} }
void FirmwareUpgrade::Upgrade(const std::string& firmware_url) { void Ota::Upgrade(const std::string& firmware_url) {
ESP_LOGI(TAG, "Upgrading firmware from %s", firmware_url.c_str()); ESP_LOGI(TAG, "Upgrading firmware from %s", firmware_url.c_str());
esp_ota_handle_t update_handle = 0; esp_ota_handle_t update_handle = 0;
auto update_partition = esp_ota_get_next_update_partition(NULL); auto update_partition = esp_ota_get_next_update_partition(NULL);
@ -232,12 +232,12 @@ void FirmwareUpgrade::Upgrade(const std::string& firmware_url) {
esp_restart(); esp_restart();
} }
void FirmwareUpgrade::StartUpgrade(std::function<void(int progress, size_t speed)> callback) { void Ota::StartUpgrade(std::function<void(int progress, size_t speed)> callback) {
upgrade_callback_ = callback; upgrade_callback_ = callback;
Upgrade(firmware_url_); Upgrade(firmware_url_);
} }
std::vector<int> FirmwareUpgrade::ParseVersion(const std::string& version) { std::vector<int> Ota::ParseVersion(const std::string& version) {
std::vector<int> versionNumbers; std::vector<int> versionNumbers;
std::stringstream ss(version); std::stringstream ss(version);
std::string segment; std::string segment;
@ -249,7 +249,7 @@ std::vector<int> FirmwareUpgrade::ParseVersion(const std::string& version) {
return versionNumbers; return versionNumbers;
} }
bool FirmwareUpgrade::IsNewVersionAvailable(const std::string& currentVersion, const std::string& newVersion) { bool Ota::IsNewVersionAvailable(const std::string& currentVersion, const std::string& newVersion) {
std::vector<int> current = ParseVersion(currentVersion); std::vector<int> current = ParseVersion(currentVersion);
std::vector<int> newer = ParseVersion(newVersion); std::vector<int> newer = ParseVersion(newVersion);

View File

@ -1,14 +1,14 @@
#ifndef _FIRMWARE_UPGRADE_H #ifndef _OTA_H
#define _FIRMWARE_UPGRADE_H #define _OTA_H
#include <functional> #include <functional>
#include <string> #include <string>
#include <map> #include <map>
class FirmwareUpgrade { class Ota {
public: public:
FirmwareUpgrade(); Ota();
~FirmwareUpgrade(); ~Ota();
void SetCheckVersionUrl(std::string check_version_url); void SetCheckVersionUrl(std::string check_version_url);
void SetHeader(const std::string& key, const std::string& value); void SetHeader(const std::string& key, const std::string& value);
@ -32,4 +32,4 @@ private:
bool IsNewVersionAvailable(const std::string& currentVersion, const std::string& newVersion); bool IsNewVersionAvailable(const std::string& currentVersion, const std::string& newVersion);
}; };
#endif // _FIRMWARE_UPGRADE_H #endif // _OTA_H

View File

@ -1,4 +1,5 @@
#include "SystemInfo.h" #include "system_info.h"
#include <freertos/task.h> #include <freertos/task.h>
#include <esp_log.h> #include <esp_log.h>
#include <esp_flash.h> #include <esp_flash.h>

View File

@ -1,4 +1,5 @@
#include "SystemReset.h" #include "system_reset.h"
#include <esp_log.h> #include <esp_log.h>
#include <nvs_flash.h> #include <nvs_flash.h>
#include <driver/gpio.h> #include <driver/gpio.h>

View File

@ -1,10 +1,10 @@
#include "wake_word_detect.h"
#include "application.h"
#include <esp_log.h> #include <esp_log.h>
#include <model_path.h> #include <model_path.h>
#include <arpa/inet.h> #include <arpa/inet.h>
#include "WakeWordDetect.h"
#include "Application.h"
#define DETECTION_RUNNING_EVENT 1 #define DETECTION_RUNNING_EVENT 1
#define WAKE_WORD_ENCODED_EVENT 2 #define WAKE_WORD_ENCODED_EVENT 2

View File

@ -1,13 +1,13 @@
#ifndef WAKE_WORD_DETECT_H #ifndef WAKE_WORD_DETECT_H
#define WAKE_WORD_DETECT_H #define WAKE_WORD_DETECT_H
#include <esp_afe_sr_models.h>
#include <esp_nsn_models.h>
#include <freertos/FreeRTOS.h> #include <freertos/FreeRTOS.h>
#include <freertos/task.h> #include <freertos/task.h>
#include <freertos/event_groups.h> #include <freertos/event_groups.h>
#include <esp_afe_sr_models.h>
#include <esp_nsn_models.h>
#include <list> #include <list>
#include <string> #include <string>
#include <vector> #include <vector>

View File

@ -1,18 +1,19 @@
#include "WifiBoard.h" #include "wifi_board.h"
#include "Application.h" #include "application.h"
#include "WifiStation.h" #include "system_info.h"
#include "WifiConfigurationAp.h" #include "builtin_led.h"
#include "SystemInfo.h"
#include "BuiltinLed.h"
#include <freertos/FreeRTOS.h> #include <freertos/FreeRTOS.h>
#include <freertos/task.h> #include <freertos/task.h>
#include <EspHttp.h> #include <esp_http.h>
#include <TcpTransport.h> #include <tcp_transport.h>
#include <TlsTransport.h> #include <tls_transport.h>
#include <WebSocket.h> #include <web_socket.h>
#include <esp_log.h> #include <esp_log.h>
#include <wifi_station.h>
#include <wifi_configuration_ap.h>
static const char *TAG = "WifiBoard"; static const char *TAG = "WifiBoard";
static std::string rssi_to_string(int rssi) { static std::string rssi_to_string(int rssi) {

View File

@ -1,7 +1,7 @@
#ifndef WIFI_BOARD_H #ifndef WIFI_BOARD_H
#define WIFI_BOARD_H #define WIFI_BOARD_H
#include "Board.h" #include "board.h"
class WifiBoard : public Board { class WifiBoard : public Board {
protected: protected: