修改OTA升级为双线程方式,边收数据边升级

This commit is contained in:
OPTOC
2025-10-20 12:15:17 +08:00
parent c026c49fac
commit 1e15f28f72
4 changed files with 107 additions and 21 deletions

View File

@@ -7,17 +7,35 @@
#include "protocol/resend_protl.h"
#include "protocol/stmisp.h"
#include "ota_u.h"
#include "tool.h"
#include "ring_buffer.h"
#include "../../config/app_config.h"
#define FC_ADDRESS "0x08000000"
#define DATA_HANDLE_BUFFER_SIZE 4096
typedef enum
{
DATA_HANDLE_IDLE = 0,
DATA_HANDLE_OTA_DATA,
DATA_HANDLE_OTA_DATA_END,
}data_handle_e;
typedef struct
{
data_handle_e task_state;
}sertrf_mode_status_t;
typedef struct
{
device_t device;
os_thread_t embedded_thread;
os_thread_t pc_thread;
os_thread_t task_thread;
os_thread_t app_thread;
// 任务
os_thread_t embedded_thread; //处理飞控接收
os_thread_t pc_thread; //处理app接收
os_thread_t task_thread; //处理其他任务
os_thread_t app_thread; //处理app任务
os_thread_t data_handle_thread; //数据处理任务
sertrf_mode_status_t mode_status;
// ota
ota_u_t otau;
//自定义协议
@@ -27,6 +45,8 @@ typedef struct
//STMISP协议
stmisp_device_t stmisp_device;
// 环形buff
RingBuffer data_handle_buffer;
uint32_t fc_address;
}sertrf_t;
@@ -80,6 +100,11 @@ void app_thread(void* arg);
* @brief task thread
*/
void task_thread(void* arg);
/**
* @brief data handle thread
*/
void data_handle_thread(void* arg);
/**
* @brief 根据连接状态显示不同的颜色
*