Commit 204d45bf authored by 李秉薇's avatar 李秉薇

feat:升级ESP32时,升级完成后发送复位指令

parent 68c9a9f1
...@@ -45,6 +45,7 @@ typedef struct ...@@ -45,6 +45,7 @@ typedef struct
#define CMD_FLASH_ERASE 0x30//擦除 FLASH #define CMD_FLASH_ERASE 0x30//擦除 FLASH
#define CMD_FLASH_DWNLD 0x31//下载用户程序到 FLASH #define CMD_FLASH_DWNLD 0x31//下载用户程序到 FLASH
#define CMD_DATA_CRC_CHECK 0x32//CRC 校验下载用户程 #define CMD_DATA_CRC_CHECK 0x32//CRC 校验下载用户程
#define CMD_SYS_RESET 0x50//系统复位
typedef struct typedef struct
{ {
Protocol_uint8_t CMDH; //宏定义所包含的 Protocol_uint8_t CMDH; //宏定义所包含的
......
...@@ -511,6 +511,14 @@ void SendCmd_CrcCheckBAT32A239_Flash(void) ...@@ -511,6 +511,14 @@ void SendCmd_CrcCheckBAT32A239_Flash(void)
UpdateBAT32A239Protocol_Send(Update_Frame); UpdateBAT32A239Protocol_Send(Update_Frame);
} }
void SendCmd_ResetComond(void)
{
Update_Frame.CMDH = CMD_SYS_RESET;
Update_Frame.CMDL = 0x00;
Update_Frame.LEN = 0x00;
UpdateBAT32A239Protocol_Send(Update_Frame);
}
static uint32_t UpgradeBAT32A239_1ms_Cnt; static uint32_t UpgradeBAT32A239_1ms_Cnt;
void Upgrade_BAT32A239_Task(void *arg) void Upgrade_BAT32A239_Task(void *arg)
{ {
......
...@@ -28,6 +28,7 @@ void BAT32A239_MCU_Update(void); ...@@ -28,6 +28,7 @@ void BAT32A239_MCU_Update(void);
void Prot_Send_Msg_Process(void ); void Prot_Send_Msg_Process(void );
Protocol_uint32_t CalcCrc32(Protocol_uint8_t buf[], int Len); Protocol_uint32_t CalcCrc32(Protocol_uint8_t buf[], int Len);
extern Protocol_uint32_t UpdateBAT32A239Protocol_Parse(const Protocol_uint8_t *pData, Protocol_uint32_t len); extern Protocol_uint32_t UpdateBAT32A239Protocol_Parse(const Protocol_uint8_t *pData, Protocol_uint32_t len);
extern void SendCmd_ResetComond(void);
#ifdef UPGRADE_N32G031 #ifdef UPGRADE_N32G031
#define CMD_SET_BR 0x01//设置串口波特率 #define CMD_SET_BR 0x01//设置串口波特率
......
...@@ -701,8 +701,6 @@ CONFIG_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD=20 ...@@ -701,8 +701,6 @@ CONFIG_BTDM_BLE_ADV_REPORT_DISCARD_THRSHOLD=20
CONFIG_BTDM_RESERVE_DRAM=0xdb5c CONFIG_BTDM_RESERVE_DRAM=0xdb5c
CONFIG_BTDM_CTRL_HLI=y CONFIG_BTDM_CTRL_HLI=y
# end of Controller Options # end of Controller Options
# CONFIG_BT_HCI_LOG_DEBUG_EN is not set
# end of Bluetooth # end of Bluetooth
# CONFIG_BLE_MESH is not set # CONFIG_BLE_MESH is not set
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "nvs_flash.h" #include "nvs_flash.h"
#include "esp_ota_ops.h" #include "esp_ota_ops.h"
#include "http_server.h" #include "http_server.h"
#include "Protocol_User.h"
static const char *TAG = "http_server"; static const char *TAG = "http_server";
...@@ -133,7 +134,9 @@ static esp_err_t app_post_handler(httpd_req_t *req) ...@@ -133,7 +134,9 @@ static esp_err_t app_post_handler(httpd_req_t *req)
// delele_tasks(); // delele_tasks();
// httpd_resp_sendstr(req, "<p>应用程序更新完成,3秒后自动重启.</p>"); // httpd_resp_sendstr(req, "<p>应用程序更新完成,3秒后自动重启.</p>");
vTaskDelay(pdMS_TO_TICKS(3000)); vTaskDelay(pdMS_TO_TICKS(3000));
esp_restart(); //esp_restart();
SendCmd_ResetComond();
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment