forked from xiaozhi/xiaozhi-esp32
将项目版本更新至1.5.9,优化内存使用,增加主任务栈大小至8192,优化固件升级流程,重构主循环为MainEventLoop,添加新版本检查功能,更新音频编解码器的DMA配置常量。
This commit is contained in:
10
main/ota.cc
10
main/ota.cc
@@ -58,15 +58,15 @@ bool Ota::CheckVersion() {
|
||||
http->SetHeader("Accept-Language", Lang::CODE);
|
||||
http->SetHeader("Content-Type", "application/json");
|
||||
|
||||
std::string post_data = board.GetJson();
|
||||
std::string method = post_data.length() > 0 ? "POST" : "GET";
|
||||
if (!http->Open(method, check_version_url_, post_data)) {
|
||||
std::string data = board.GetJson();
|
||||
std::string method = data.length() > 0 ? "POST" : "GET";
|
||||
if (!http->Open(method, check_version_url_, data)) {
|
||||
ESP_LOGE(TAG, "Failed to open HTTP connection");
|
||||
delete http;
|
||||
return false;
|
||||
}
|
||||
|
||||
auto response = http->GetBody();
|
||||
data = http->GetBody();
|
||||
http->Close();
|
||||
delete http;
|
||||
|
||||
@@ -74,7 +74,7 @@ bool Ota::CheckVersion() {
|
||||
// Parse the JSON response and check if the version is newer
|
||||
// If it is, set has_new_version_ to true and store the new version and URL
|
||||
|
||||
cJSON *root = cJSON_Parse(response.c_str());
|
||||
cJSON *root = cJSON_Parse(data.c_str());
|
||||
if (root == NULL) {
|
||||
ESP_LOGE(TAG, "Failed to parse JSON response");
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user