forked from xiaozhi/xiaozhi-esp32
开机启动显示开发板信息,提前启动event loop
This commit is contained in:
@@ -332,6 +332,9 @@ void Application::Start() {
|
|||||||
/* Setup the display */
|
/* Setup the display */
|
||||||
auto display = board.GetDisplay();
|
auto display = board.GetDisplay();
|
||||||
|
|
||||||
|
// Print board name/version info
|
||||||
|
display->SetChatMessage("system", SystemInfo::GetUserAgent().c_str());
|
||||||
|
|
||||||
/* Setup the audio service */
|
/* Setup the audio service */
|
||||||
auto codec = board.GetAudioCodec();
|
auto codec = board.GetAudioCodec();
|
||||||
audio_service_.Initialize(codec);
|
audio_service_.Initialize(codec);
|
||||||
@@ -349,6 +352,12 @@ void Application::Start() {
|
|||||||
};
|
};
|
||||||
audio_service_.SetCallbacks(callbacks);
|
audio_service_.SetCallbacks(callbacks);
|
||||||
|
|
||||||
|
// Start the main event loop task with priority 3
|
||||||
|
xTaskCreate([](void* arg) {
|
||||||
|
((Application*)arg)->MainEventLoop();
|
||||||
|
vTaskDelete(NULL);
|
||||||
|
}, "main_event_loop", 2048 * 4, this, 3, &main_event_loop_task_handle_);
|
||||||
|
|
||||||
/* Start the clock timer to update the status bar */
|
/* Start the clock timer to update the status bar */
|
||||||
esp_timer_start_periodic(clock_timer_handle_, 1000000);
|
esp_timer_start_periodic(clock_timer_handle_, 1000000);
|
||||||
|
|
||||||
|
|||||||
@@ -51,11 +51,9 @@ std::string Ota::GetCheckVersionUrl() {
|
|||||||
|
|
||||||
std::unique_ptr<Http> Ota::SetupHttp() {
|
std::unique_ptr<Http> Ota::SetupHttp() {
|
||||||
auto& board = Board::GetInstance();
|
auto& board = Board::GetInstance();
|
||||||
auto app_desc = esp_app_get_description();
|
|
||||||
|
|
||||||
auto network = board.GetNetwork();
|
auto network = board.GetNetwork();
|
||||||
auto http = network->CreateHttp(0);
|
auto http = network->CreateHttp(0);
|
||||||
auto user_agent = std::string(BOARD_NAME "/") + app_desc->version;
|
auto user_agent = SystemInfo::GetUserAgent();
|
||||||
http->SetHeader("Activation-Version", has_serial_number_ ? "2" : "1");
|
http->SetHeader("Activation-Version", has_serial_number_ ? "2" : "1");
|
||||||
http->SetHeader("Device-Id", SystemInfo::GetMacAddress().c_str());
|
http->SetHeader("Device-Id", SystemInfo::GetMacAddress().c_str());
|
||||||
http->SetHeader("Client-Id", board.GetUuid());
|
http->SetHeader("Client-Id", board.GetUuid());
|
||||||
|
|||||||
@@ -47,6 +47,12 @@ std::string SystemInfo::GetChipModelName() {
|
|||||||
return std::string(CONFIG_IDF_TARGET);
|
return std::string(CONFIG_IDF_TARGET);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string SystemInfo::GetUserAgent() {
|
||||||
|
auto app_desc = esp_app_get_description();
|
||||||
|
auto user_agent = std::string(BOARD_NAME "/") + app_desc->version;
|
||||||
|
return user_agent;
|
||||||
|
}
|
||||||
|
|
||||||
esp_err_t SystemInfo::PrintTaskCpuUsage(TickType_t xTicksToWait) {
|
esp_err_t SystemInfo::PrintTaskCpuUsage(TickType_t xTicksToWait) {
|
||||||
#define ARRAY_SIZE_OFFSET 5
|
#define ARRAY_SIZE_OFFSET 5
|
||||||
TaskStatus_t *start_array = NULL, *end_array = NULL;
|
TaskStatus_t *start_array = NULL, *end_array = NULL;
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ public:
|
|||||||
static size_t GetFreeHeapSize();
|
static size_t GetFreeHeapSize();
|
||||||
static std::string GetMacAddress();
|
static std::string GetMacAddress();
|
||||||
static std::string GetChipModelName();
|
static std::string GetChipModelName();
|
||||||
|
static std::string GetUserAgent();
|
||||||
static esp_err_t PrintTaskCpuUsage(TickType_t xTicksToWait);
|
static esp_err_t PrintTaskCpuUsage(TickType_t xTicksToWait);
|
||||||
static void PrintTaskList();
|
static void PrintTaskList();
|
||||||
static void PrintHeapStats();
|
static void PrintHeapStats();
|
||||||
|
|||||||
Reference in New Issue
Block a user