Commit 1b1c54d7 authored by wangxuhui's avatar wangxuhui

Merge branch 'xxh' into 'develop'

添加内部版本号与底板交互

See merge request !7
parents 15779b0d acdda56d
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
#include <stdbool.h> #include <stdbool.h>
#include <stdio.h> #include <stdio.h>
#include "main_user.h"
#define TAG "Prot_User" #define TAG "Prot_User"
...@@ -251,6 +253,8 @@ static void Protocol_UartHandle(const Protocol_Data_t *pData) ...@@ -251,6 +253,8 @@ static void Protocol_UartHandle(const Protocol_Data_t *pData)
{ {
bsp_Ble_Init(); bsp_Ble_Init();
SW_Send_Cnt_Set(150);
// printf("get uuid and init ble!!! \r\n"); // printf("get uuid and init ble!!! \r\n");
} }
...@@ -343,10 +347,10 @@ void Uart_Send_Id12_Pro(void ) ...@@ -343,10 +347,10 @@ void Uart_Send_Id12_Pro(void )
ID12[17] = time->u8Sec; ID12[17] = time->u8Sec;
} }
if(ID12[15] != 0xff) // if(ID12[15] != 0xff)
{ // {
// printf("hour = %d, minute = %d, SEC = %d\n", ID12[15], ID12[16], ID12[17]); // printf("hour = %d, minute = %d, SEC = %d\n", ID12[15], ID12[16], ID12[17]);
} // }
Protocol_Send(0x12, ID12, PROTOCOL_ID_12_DATA_LEN); Protocol_Send(0x12, ID12, PROTOCOL_ID_12_DATA_LEN);
} }
...@@ -377,7 +381,21 @@ void Uart_Send_Id02_Pro(void) ...@@ -377,7 +381,21 @@ void Uart_Send_Id02_Pro(void)
} }
void Uart_Send_Id13(void)
{
uint8_t wtemp[3] = {0};
wtemp[0] = BL_INTERNAL_SW_YEAR;
wtemp[1] = BL_INTERNAL_SW_MONTH;
wtemp[2] = BL_INTERNAL_SW_DAY;
Protocol_Send(0x13, wtemp, 3);
}
uint16_t SW_Send_Cnt = 0;
void SW_Send_Cnt_Set(uint16_t val)
{
SW_Send_Cnt = val;
}
void Prot_Send_Msg_Process(void ) void Prot_Send_Msg_Process(void )
{ {
...@@ -403,5 +421,12 @@ void Prot_Send_Msg_Process(void ) ...@@ -403,5 +421,12 @@ void Prot_Send_Msg_Process(void )
Prot_User.TimeDelay = 0; Prot_User.TimeDelay = 0;
//printf("send 0x01 0x02 \r\n"); //printf("send 0x01 0x02 \r\n");
} }
SW_Send_Cnt++;
if(SW_Send_Cnt >= 200)
{
Uart_Send_Id13();
SW_Send_Cnt = 0;
}
} }
} }
...@@ -39,4 +39,7 @@ void Prot_Send_Msg_Process(void ); ...@@ -39,4 +39,7 @@ void Prot_Send_Msg_Process(void );
void Uart_Send_Id12_Pro(void ); void Uart_Send_Id12_Pro(void );
void SW_Send_Cnt_Set(uint16_t val);
#endif #endif
...@@ -621,6 +621,7 @@ void Ble_DisConnect_Event_Pro(void ) ...@@ -621,6 +621,7 @@ void Ble_DisConnect_Event_Pro(void )
Ble_Clear_Rx_Buffer(); Ble_Clear_Rx_Buffer();
BleTime.TimeReqCnt = 0; BleTime.TimeReqCnt = 0;
} }
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "bt_app_hf.h" #include "bt_app_hf.h"
static const float Inter_SW = 1.1; // const float Inter_SW = 1.1;
#define TAG "MAIN_USER" #define TAG "MAIN_USER"
extern esp_bd_addr_t peer_addr; extern esp_bd_addr_t peer_addr;
...@@ -138,7 +138,7 @@ void app_main(void) ...@@ -138,7 +138,7 @@ void app_main(void)
bsp_Uart_Init(); bsp_Uart_Init();
// printf("KL30 INIT OVER~~~~~~\r\n"); // printf("KL30 INIT OVER~~~~~~\r\n");
ESP_LOGE("MAIN", "Internal Sw = %f", Inter_SW); // ESP_LOGE("MAIN", "Internal Sw = %f", Inter_SW);
xTaskCreatePinnedToCore(Sys_Run_Tasks, "Sys_Run_Tasks", 4096, NULL, 3, NULL, 1); xTaskCreatePinnedToCore(Sys_Run_Tasks, "Sys_Run_Tasks", 4096, NULL, 3, NULL, 1);
} }
......
#ifndef _MAIN_USER_H_ #ifndef _MAIN_USER_H_
#define _MAIN_USER_H_ #define _MAIN_USER_H_
#define BL_INTERNAL_SW_YEAR 24
#define BL_INTERNAL_SW_MONTH 7
#define BL_INTERNAL_SW_DAY 22
#endif #endif
\ No newline at end of file
...@@ -144,6 +144,16 @@ void simple_ota_example_task(void *pvParameter) ...@@ -144,6 +144,16 @@ void simple_ota_example_task(void *pvParameter)
esp_restart(); esp_restart();
} else { } else {
ESP_LOGE(TAG, "Firmware upgrade failed"); ESP_LOGE(TAG, "Firmware upgrade failed");
for(i = 5; i > 0; i--)
{
printf("============ System will restart in %d second. ============\n", i);
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
// printf("============ System rebooting... ============\n");
// printf("==========================================================\n");
// printf("\n");
esp_restart();
} }
while (1) { while (1) {
vTaskDelay(1000 / portTICK_PERIOD_MS); vTaskDelay(1000 / portTICK_PERIOD_MS);
......
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