Commit af031a30 authored by 薛小虎's avatar 薛小虎

perf: 优化wifi升级问题。蓝牙相关任务整理

parent 9ac078a8
......@@ -271,7 +271,6 @@ static void Protocol_UartHandle(const Protocol_Data_t *pData)
// {
if(Wifi_OTA_Request == 0)
{
app_ble_stop();
Wifi_OTA_Request = 1;
printf("get ota req! \r\n");
}
......@@ -400,34 +399,70 @@ void SW_Send_Cnt_Set(uint16_t val)
void Prot_Send_Msg_Process(void )
{
if(Prot_User.TimeDelay < 4)
{
Prot_User.TimeDelay ++;
}
else
{
Prot_User.TimeDelay = 0;
}
switch(Prot_User.TimeDelay)
{
case 0:
{
if(Prot_User.State < Prot_Start)
{
Uart_Send_Id10_Pro();
// printf("send 0x10 \r\n");
}
if(Prot_User.State >= Prot_Start)
break;
}
case 1:
{
if(Prot_User.TimeDelay == 0)
if(Prot_User.State >= Prot_Start)
{
Uart_Send_Id12_Pro();
Prot_User.TimeDelay++;
// printf("send 0x12 \r\n");
// Uart_Send_Id10_Pro();
}
else
break;
}
case 2:
{
if(Prot_User.State >= Prot_Start)
{
Uart_Send_Id01_Pro();
}
break;
}
case 3:
{
if(Prot_User.State >= Prot_Start)
{
Uart_Send_Id02_Pro();
Prot_User.TimeDelay = 0;
//printf("send 0x01 0x02 \r\n");
}
SW_Send_Cnt++;
break;
}
case 4:
{
if(Prot_User.State >= Prot_Start)
{
SW_Send_Cnt ++;
if(SW_Send_Cnt >= 200)
{
Uart_Send_Id13();
SW_Send_Cnt = 0;
}
}
break;
}
default:
{
break;
}
}
}
......@@ -13,6 +13,7 @@
#include "main_user.h"
#include "esp_log.h"
#include "Protocol_User.h"
#include "bt_app_hf.h"
#define TAG "APP_BLE_USER"
......@@ -22,6 +23,8 @@ app_Ble_User_Data_Union BleRecData;
app_Ble_User_Data_Union BleTransData;
app_Ble_Rec_Data_Ctrl_Struct RecCtrl;
static uint32_t gu8BleCycTaskCnt;
uint8_t Wifi_OTA_Request = 0;
uint8_t ble_key[32] = "1BJ7J8S";
......@@ -32,6 +35,8 @@ uint8_t flavor[4] = {0x33, 0, 0, 0};
SemaphoreHandle_t BleRecSuc_Semaphore;
static TaskHandle_t gBleEventTaskHdl = NULL;
......@@ -625,7 +630,7 @@ void Ble_DisConnect_Event_Pro(void )
}
void Ble_User_Task(void *pvParameter)
void Ble_User_Task_Event(void *pvParameter)
{
while (1)
......@@ -658,6 +663,8 @@ void Ble_User_Task(void *pvParameter)
}
}
}
ESP_LOGW("ota", "vtask del ble event");
vTaskDelete(NULL);
}
......@@ -665,9 +672,27 @@ void Ble_User_Task_Cyc(void *pvParameter)
{
while (1)
{
if(gu8BleCycTaskCnt < 9)
{
gu8BleCycTaskCnt++;
}
else
{
gu8BleCycTaskCnt = 0;
Ble_Msg_RequestTime();
vTaskDelay(1000);
}
Get_Iphone_Fitter_callsts();
Ble_MsgRec_Navi_Timeout();
esp_hf_client_query_current_calls();
if(Wifi_OTA_Request != 0)
{
break;
}
vTaskDelay(100);
}
ESP_LOGW("ota", "vtask del ble cyc");
vTaskDelete(NULL);
}
......@@ -698,8 +723,16 @@ void Ble_User_Init(void )
Ble_Clear_Rx_Buffer();
xTaskCreatePinnedToCore(Ble_User_Task, "Ble_User", 4096, NULL, 10, NULL, 0);
xTaskCreatePinnedToCore(Ble_User_Task_Event, "Ble_User", 4096, NULL, 10, &gBleEventTaskHdl, 0);
xTaskCreatePinnedToCore(Ble_User_Task_Cyc, "Ble_User_Cyc", 4096, NULL, 9, NULL, 0);
}
void gatts_Ble_User_Task_Event_Del(void )
{
if(gBleEventTaskHdl != NULL)
{
vTaskDelete(gBleEventTaskHdl);
}
}
......@@ -244,5 +244,7 @@ void Ble_MsgRec_Navi_Timeout(void );
void Ble_Msg_RequestTime(void );
app_Ble_Time_Info_Struct *Get_Ble_TimeInfo(void );
void gatts_Ble_User_Task_Event_Del(void );
#endif
\ No newline at end of file
......@@ -101,8 +101,15 @@ static void Uart_Rx_Task(void *arg)
UART_Put(data[i]);
}
}
if(Wifi_OTA_Request != 0)
{
break;
}
}
ESP_LOGW("ota", "vtask del uart rx");
free(data);
vTaskDelete(NULL);
}
void bsp_Uart_Init(void )
......@@ -124,15 +131,17 @@ void simple_ota_service(void)
{
if(Wifi_OTA_Request == 1)
{
Wifi_OTA_Request = 2;
gatts_Ble_User_Task_Event_Del();
vTaskDelay(300);
gatts_App_Ble_DeInit();
simple_ota_main();
vTaskDelay(portMAX_DELAY);
Wifi_OTA_Request = 2;
}
}
int app_ble_stop(void)
int gatts_App_Ble_DeInit(void)
{
esp_err_t err;
err = esp_bluedroid_disable();
......
......@@ -80,5 +80,5 @@ extern uint8_t BT_Device_Name[14];
void Get_Mac_Init(void );
extern int bsp_Uart_Send_Data(uint8_t * data , unsigned int len);
extern uint8_t BT_Device_Name[14];
int app_ble_stop(void);
int gatts_App_Ble_DeInit(void);
#endif
\ No newline at end of file
......@@ -68,6 +68,8 @@ static void Sys_Run_Tasks(void *arg)
Protocol_Service();
BT_User_Process();
Prot_Send_Msg_Process();
}
if(SYS_RUN_TASK_20MS)
......@@ -77,17 +79,12 @@ static void Sys_Run_Tasks(void *arg)
if(SYS_RUN_TASK_50MS)
{
Prot_Send_Msg_Process();
}
if(SYS_RUN_TASK_100MS)
{
Get_Iphone_Fitter_callsts();
Ble_MsgRec_Navi_Timeout();
if(Wifi_OTA_Request == 0)
{
esp_hf_client_query_current_calls();
}
}
if(SYS_RUN_TASK_1000MS)
......@@ -95,6 +92,7 @@ static void Sys_Run_Tasks(void *arg)
simple_ota_service();
testcnt++;
if(testcnt >= 10)
{
......@@ -125,8 +123,15 @@ static void Sys_Run_Tasks(void *arg)
}
}
if(Wifi_OTA_Request == 2)
{
break;
}
vTaskDelay(1);
}
ESP_LOGW("ota", "vtask del sys run");
vTaskDelete(NULL);
}
......
#ifndef _MAIN_USER_H_
#define _MAIN_USER_H_
#define BL_INTERNAL_SW_YEAR 24
#define BL_INTERNAL_SW_MONTH 7
#define BL_INTERNAL_SW_DAY 26
#define BL_INTERNAL_SW_YEAR 0x24
#define BL_INTERNAL_SW_MONTH 0x07
#define BL_INTERNAL_SW_DAY 0x29
#endif
\ No newline at end of file
......@@ -1335,18 +1335,16 @@ CONFIG_HEAP_TRACING_OFF=y
# Log output
#
# CONFIG_LOG_DEFAULT_LEVEL_NONE is not set
CONFIG_LOG_DEFAULT_LEVEL_ERROR=y
# CONFIG_LOG_DEFAULT_LEVEL_ERROR is not set
# CONFIG_LOG_DEFAULT_LEVEL_WARN is not set
# CONFIG_LOG_DEFAULT_LEVEL_INFO is not set
CONFIG_LOG_DEFAULT_LEVEL_INFO=y
# CONFIG_LOG_DEFAULT_LEVEL_DEBUG is not set
# CONFIG_LOG_DEFAULT_LEVEL_VERBOSE is not set
CONFIG_LOG_DEFAULT_LEVEL=1
CONFIG_LOG_DEFAULT_LEVEL=3
CONFIG_LOG_MAXIMUM_EQUALS_DEFAULT=y
# CONFIG_LOG_MAXIMUM_LEVEL_WARN is not set
# CONFIG_LOG_MAXIMUM_LEVEL_INFO is not set
# CONFIG_LOG_MAXIMUM_LEVEL_DEBUG is not set
# CONFIG_LOG_MAXIMUM_LEVEL_VERBOSE is not set
CONFIG_LOG_MAXIMUM_LEVEL=1
CONFIG_LOG_MAXIMUM_LEVEL=3
CONFIG_LOG_COLORS=y
CONFIG_LOG_TIMESTAMP_SOURCE_RTOS=y
# CONFIG_LOG_TIMESTAMP_SOURCE_SYSTEM is not set
......
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