瀏覽代碼

版本号为:1.2.2.5,作为009号包测试,增加了Uart指针,更改了睡眠不成功重启时间

CHENJIE-PC\QiXiang_CHENJIE 3 年之前
父節點
當前提交
0c87783a40
共有 3 個文件被更改,包括 16 次插入11 次删除
  1. 4 4
      inc/app.h
  2. 2 1
      src/MainTask.c
  3. 10 6
      src/UartTask.c

+ 4 - 4
inc/app.h

@@ -13,9 +13,9 @@
 extern "C" {
 #endif
 //全局定义声明区
-#define BMS_MANUFACTURE (2) //BMS制造商表示1-超力源,2-美顺
+#define BMS_MANUFACTURE (1) //BMS制造商表示1-超力源,2-美顺
 #define DATA_MODULE_TYPE (1) //1表示NB模块,2表示4G cat1
-#define BMS_INFO  (1)       //1-1表示超力源4830,1-2表示超力源6060,2-1表示美顺6455
+#define BMS_INFO  (2)       //1-1表示超力源4830,1-2表示超力源6060,2-1表示美顺6455
 
 #if  BMS_MANUFACTURE==1
     #if BMS_INFO==1
@@ -43,8 +43,8 @@ extern "C" {
 #define HWVERSION		    0x0102    //硬件主版本,现为V1.2板
 #define	BLSWVERSION		0x01020000    //BootLoader版本号V1.2.0.0
 #define	DRVSWVERSION		0x01040000     //驱动层版本号V1.4.0.0
-#define	APPSWVERSION		0x01020204     
-//#define	APPSWVERSION		0x02000004
+#define	APPSWVERSION		0x01020205     
+//#define	APPSWVERSION		0x02000005
 //--------------------------------------------------------------------------------
 
 #define APP_CONFIG_FILE_LATEST_VERSION 0

+ 2 - 1
src/MainTask.c

@@ -175,6 +175,7 @@ static void MainTask(void* arg)
                     #endif
                     xTimerStop(montior_timer, 0);
                     PROC_MAIN_STATE_SWITCH(PROCESS_STATE_SLEEP);
+                    break;
                 }
                 if(TcpService!=0x00||UDSSwitch==1||BMS_Fota_update_flag)
                 {
@@ -238,7 +239,7 @@ static void MainTask(void* arg)
 				    slpManDeepSlpTimerStart(deepslpTimerID, AppNVMData.sleepTime*1000*60);
                     osDelay(1*60*1000/portTICK_PERIOD_MS);
                     sleeptime_count++;
-                    if(sleeptime_count>5)
+                    if(sleeptime_count>10)
                     {
                         EC_SystemReset();
                     }

+ 10 - 6
src/UartTask.c

@@ -58,7 +58,7 @@ static process_Uart             gProcess_Uart_Task = PROCESS_UART_STATE_IDLE;
 
 //函数声明区
 void USART_callback(uint32_t event);
-UINT8 Uart_Transmit_func(UINT8* Uart_Read_Msg,UINT8* Uart_Recv_Buffer);
+UINT8 Uart_DataRecv_func(UINT8* Uart_Read_Msg,UINT8* Uart_Recv_Buffer);
 UINT8 Uart_WriteCmd_func(Uart_Write_Data_Type UartWriteData);
 UINT16 crc_chk(UINT8* data, UINT8 length);
 void battSOCDisplay(void);
@@ -93,6 +93,7 @@ static void UartTask(void* arg)
 	BOOL uartReadSuccessFlag = false;
     Uart_Read_Msg_Type Uart_Read_Msg;
     Uart_Write_Data_Type UartWriteData; //Uart控制命令
+	UINT8 *Uart_Buffer_Ptr;
     if(UartWriteCmdHandle == NULL)//Uart控制命令传输指针
 	{
 		UartWriteCmdHandle = osMessageQueueNew(3,sizeof(Uart_Write_Data_Type), NULL);
@@ -179,7 +180,6 @@ static void UartTask(void* arg)
             }
             case PROCESS_UART_STATE_READ:
             {
-                osStatus_t result = osMutexAcquire(UartMutex, osWaitForever);
                 Reg_Num = 0x21+BATT_CELL_VOL_NUM+BATT_TEMP_NUM + 2;//按照协议里面的0x21+X+N的结束地址
                 Uart_Read_Msg.Bms_Address = BMS_ADDRESS_CODE;
                 Uart_Read_Msg.Bms_Funcode = UART_READ_CODE;
@@ -188,8 +188,13 @@ static void UartTask(void* arg)
                 Uart_Read_Msg.Reg_Num_H = Reg_Num>>8;
                 Uart_Read_Msg.Reg_Num_L = Reg_Num;
                 Uart_Uds_LEN = Reg_Num*2;
-                memset(UartReadMsg.Header,0x00,Uart_Uds_LEN);
-                Uart_Recv_LEN = Uart_Transmit_func((UINT8 *)&Uart_Read_Msg,UartReadMsg.Header);
+				Uart_Buffer_Ptr = malloc(Uart_Uds_LEN);
+                memset(Uart_Buffer_Ptr,0x00,Uart_Uds_LEN);
+                Uart_Recv_LEN = Uart_DataRecv_func((UINT8 *)&Uart_Read_Msg,Uart_Buffer_Ptr);
+				osStatus_t result = osMutexAcquire(UartMutex, osWaitForever);
+				memcpy(UartReadMsg.Header,Uart_Buffer_Ptr,Uart_Uds_LEN);
+				osMutexRelease(UartMutex);
+				free(Uart_Buffer_Ptr);
 				if(Uart_Recv_LEN>0)
 				{
 					UartReadMsg.UartFlag = TRUE;
@@ -216,7 +221,6 @@ static void UartTask(void* arg)
 					}
 					printf("\n");
 				#endif
-                osMutexRelease(UartMutex);
                 break;
             }
             case PROCESS_UART_STATE_WRITE:
@@ -377,7 +381,7 @@ UINT8 Uart_WriteCmd_func(Uart_Write_Data_Type UartWriteData)
     }
 }
 //Uart发送接收函数
-UINT8 Uart_Transmit_func(UINT8* Uart_Read_Msg,UINT8* Uart_Recv_Buffer)
+UINT8 Uart_DataRecv_func(UINT8* Uart_Read_Msg,UINT8* Uart_Recv_Buffer)
 {
     UINT16 CRC_Rece_buffer;
     UINT16 CRC_chk_buffer;