Commit 682348c7 authored by 李俭双's avatar 李俭双

feat:增加ESP32心跳检测

parent 4b832f2e
......@@ -7,6 +7,8 @@
#define UART_RX_MAX_DEPTH (2 * 1024UL) // 4K
#define UART_DATA_BUF_LEN (2 * 1024UL) // 4K
uint32_t u32ActiveCount = 0;
uint32_t u32ActiveReset = 0;
typedef struct __attribute__((aligned(4)))
{
Protocol_uint32_t read_pos;
......@@ -170,6 +172,8 @@ 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};
u32ActiveCount = 0;
if ( pData->CmdID == ESP32_MCU_0x10 )
{
BlueTooth.BlueTooth_St = pData->Data[0];
......@@ -227,6 +231,37 @@ static void Protocol_UartHandle(const Protocol_Data_t *pData)
//非本协议数据,不处理
}
}
void Protocol_ESP32_Active_Service(void)
{
if (RTE_GPIO_Get_Level(L_BD433Ctrl_OUT) == 1)
{
if (u32ActiveCount >= 200)
{
u32ActiveReset = 0;
RTE_GPIO_Set_Level(L_BD433Ctrl_OUT, RTE_GPIO_LEVEL_LOW);
}
else
{
u32ActiveCount++;
}
}
else
{
if(u32ActiveReset <= 2)
{
u32ActiveReset++;
}
else
{
u32ActiveReset = 0;
u32ActiveCount = 0;
RTE_GPIO_Set_Level(L_BD433Ctrl_OUT, RTE_GPIO_LEVEL_HIGH);
}
}
}
void UART_Put(Protocol_uint16_t Data)
{
......
......@@ -9,5 +9,6 @@
void Protocol_KL30_Wakeup_Init(void);
void Protocol_Send_Service(void); // 10ms任务调用
void UART_Put(Protocol_uint16_t Data);
void Protocol_ESP32_Active_Service(void);
#endif
......@@ -114,6 +114,7 @@ void Sys_100ms_Tasks(void)
}
Clear_Navigation_St();
Protocol_ESP32_Active_Service();
//R_test = ADC_Read_Signal(ADC_CH_FUEL1);
}
......
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