#pragma once #include "esp_ota_ops.h" #include "esp_system.h" #include "esp_log.h" #include "sys_log.h" #define OTA_TAG_0 "ota_0" #define OTA_TAG_1 "ota_1" typedef struct { const esp_partition_t *running; const esp_partition_t *update; esp_ota_handle_t ota_handle; int total_size; uint16_t ota_data_cnt; // uint8_t ota_buff[20480 + 512]; }ota_u_t; typedef struct { uint32_t ota_file_size; }ota_parm_t; /** * @brief 获取当前ota信息 */ void get_partition_status(ota_u_t* otau); /** * @brief OTA初始化 * * @param otau */ void otau_init(ota_u_t* otau); /** * @brief OTA写入 * * @param otau * @param data * @param size * @return uint8_t */ uint8_t otau_write(ota_u_t* otau, void* data, uint32_t size); /** * @brief OTA结束 * * @param otau * @return uint8_t */ uint8_t otau_end(ota_u_t* otau);