Commit 7c8c73ee authored by 李俭双's avatar 李俭双

feat:增加WiFi升级协议内容,收到ESP32重启命令后复位重启

parent 83ef960d
......@@ -339,7 +339,7 @@
<MiscControls></MiscControls>
<Define>USE_STDPERIPH_DRIVER,BAT32G139_64PIN</Define>
<Undefine></Undefine>
<IncludePath>..\..\..\..\Source\Device\Cmsemicon\BAT32A239\RTE;..\..\..\..\Source\Component;..\..\..\..\Source\Device\Cmsemicon\BAT32A239\Library\Driver\include;..\..\..\..\Source\Device\Cmsemicon\BAT32A239\Library\Device\Include;..\..\..\..\Source\Application;..\..\..\..\Source;..\..\..\..\Source\Component\LED_Driver;..\..\..\..\Source\UDS</IncludePath>
<IncludePath>..\..\..\..\Source\Device\Cmsemicon\BAT32A239\RTE;..\..\..\..\Source\Component;..\..\..\..\Source\Device\Cmsemicon\BAT32A239\Library\Driver\include;..\..\..\..\Source\Device\Cmsemicon\BAT32A239\Library\Device\Include;..\..\..\..\Source\Application;..\..\..\..\Source;..\..\..\..\Source\Component\LED_Driver;..\..\..\..\Source\UDS;..\..\..\..\Source\Component\System_Monitor</IncludePath>
</VariousControls>
</Cads>
<Aads>
......
......@@ -11,6 +11,8 @@
#define ESP32_MCU_0x01 0x01 //ESP32发送蓝牙导航信息的ID
#define ESP32_MCU_0x12 0x12 //低功耗蓝牙启动状态及蓝牙名称
#define MCU_ESP32_0x03 0x03 //MCU发送UUID
#define ESP32_MCU_0x02 0x02 //ESP32发送重启请求
#define MCU_ESP32_0x04 0x04 //MCU发送重启命令
enum
{
BLUE_STATE_Starting, //蓝牙模组启动中
......@@ -23,7 +25,8 @@ typedef struct __attribute__((aligned(4)))
uint8_t Navigation_St;/*导航状态 0x35 未导航或导航结束 0x33 正在导航*/
uint8_t Navigation_Code;/*蓝牙导向编码*/
uint32_t Navigation_Mileage;/*剩余里程*/
uint8_t BLE_St;
uint8_t BLE_St;
uint8_t ESP32_Reset;
} BlueTooth_t;
typedef enum __attribute__((aligned(4)))
......
#include "Protocol_User.h"
#include "RTE.h"
#include "System_Monitor_User.h"
#define UART_TX_MAX_DEPTH 1024UL //(2 * 1024UL) // 4K
#define UART_RX_MAX_DEPTH (2 * 1024UL) // 4K
......@@ -169,7 +169,7 @@ static Protocol_uint32_t Protocol_UartSend(const Protocol_uint8_t *pData, Protoc
static void Protocol_UartHandle(const Protocol_Data_t *pData)
{
uint8_t ID04[1] = {0};
if ( pData->CmdID == ESP32_MCU_0x10 )
{
BlueTooth.BlueTooth_St = pData->Data[0];
......@@ -182,6 +182,24 @@ static void Protocol_UartHandle(const Protocol_Data_t *pData)
{
BlueTooth.BLE_St = pData->Data[0];
}
else if ( pData->CmdID == ESP32_MCU_0x02 )
{
BlueTooth.ESP32_Reset = pData->Data[0];
if (BlueTooth.ESP32_Reset == 1)
{
ID04[0] = 1;
Protocol_Send(MCU_ESP32_0x04, ID04, 1);
}
else if(BlueTooth.ESP32_Reset == 2)
{
__NVIC_SystemReset();
}
else
{
;
}
}
else if(pData->CmdID == ESP32_MCU_0x01 )
{
if (pData->Data[0] == 0x33)
......
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