Files
mimiclaw/main/ota/ota_manager.c
Z.To eedc6757d8
Some checks failed
Build / idf-build (push) Has been cancelled
使用中文提交内容
适配ESP-IDF v6.0编译 补充项目相关文档

* 修复16处头文件缺失、flash配置错误、WiFi断开原因码兼容问题
* 新增ESP-IDF v6.0迁移适配文档
* 更新变更日志,补充v1.0.0功能清单及v1.1.0版本规划
* 整理讨论记录,新增v6.0适配及国内大模型接入内容
2026-03-31 21:34:59 +08:00

37 lines
827 B
C

#include "ota_manager.h"
#include "esp_log.h"
#include "esp_ota_ops.h"
#include "esp_http_client.h"
#include "esp_crt_bundle.h"
#include "esp_https_ota.h"
#include "esp_system.h"
static const char *TAG = "ota";
esp_err_t ota_update_from_url(const char *url)
{
ESP_LOGI(TAG, "Starting OTA from: %s", url);
esp_http_client_config_t config = {
.url = url,
.timeout_ms = 120000,
.buffer_size = 4096,
.crt_bundle_attach = esp_crt_bundle_attach,
};
esp_https_ota_config_t ota_config = {
.http_config = &config,
};
esp_err_t ret = esp_https_ota(&ota_config);
if (ret == ESP_OK) {
ESP_LOGI(TAG, "OTA successful, restarting...");
esp_restart();
} else {
ESP_LOGE(TAG, "OTA failed: %s", esp_err_to_name(ret));
}
return ret;
}