Jelajahi Sumber

Uart改动测试完成,优化了V3 SN存储结构体

CHENJIE-PC\QiXiang_CHENJIE 3 tahun lalu
induk
melakukan
ff8f96075b
9 mengubah file dengan 93 tambahan dan 87 penghapusan
  1. 12 10
      inc/AppConfig.h
  2. 2 0
      inc/AppSignal.h
  3. 1 1
      inc/AppTaskUart.h
  4. 33 28
      src/AppFunc.c
  5. 5 3
      src/AppSignal.c
  6. 0 12
      src/AppTaskMain.c
  7. 3 14
      src/AppTaskTcp.c
  8. 36 18
      src/AppTaskUart.c
  9. 1 1
      src/app.c

+ 12 - 10
inc/AppConfig.h

@@ -9,7 +9,7 @@
 #ifndef  APPCONFIG_H
 #define  APPCONFIG_H
 #define BMS_MANUFACTURE             (2)                 //BMS制造商表示1-超力源,2-美顺
-#define BMS_INFO                    (1)                 //1-1表示超力源4830,1-2表示超力源6060,2-1表示美顺6455
+#define BMS_INFO                    (3)                 //1-1表示超力源4830,1-2表示超力源6060,2-1表示美顺4830,2-2表示美顺6060 2-3表示美顺7250
 #define DATA_MODULE_TYPE            (1)                 //1表示NB模块,2表示4G cat1
 #define EOLSTATE                    (1)                 //1表示下线检测跳过,使用默认值,0表示使用下线检测
 #define DEFAULT_SN                  "RLTEST00000000002" //默认上传的SN编码
@@ -64,19 +64,19 @@
 #define FLASH_BMS_FOTA_LEN                0x32000           //BMS升级文件存储长度 = =200k
 #define FLASH_BMS_FOTA_END_ADDR           0x318000          //BMS升级文件存储结束地址
 //declear struct vars   结构体变量定义
-typedef struct _AppConfigDataType
+typedef struct _AppConfigDataType//该结构体只允许下线检测写入
 {	
     BOOL   appDataModify;		//数据更改标志位
 	UINT8  battSN[BATT_SN_LEN]; //电池SN号码
    	BOOL   isBattLocked;		//0:not locked;	1:locked  //暂时取消没有使用
-    UINT8  chargEndWorkTime;     //
-    UINT8  BattTempCount;       //电池温度个数
-    UINT8  BattCellCount;       //电池电压串数
-    UINT8  BmsHwVersion;
-    UINT8  BmsSwVersion;
-    UINT32 BLSwVersion;
-    UINT32 DrvSwVersion;
-    UINT32 AppSwVersion;        //APP软件版本
+    UINT8  reserved1;     //
+    UINT8  reserved2;       //电池温度个数
+    UINT8  reserved3;       //电池电压串数
+    UINT8  reserved4;
+    UINT8  reserved5;
+    UINT32 reserved6;
+    UINT32 reserved7;
+    UINT32 reserved8;        //APP软件版本
 	UINT8  EOLState;
 }AppConfigDataType;
 
@@ -89,6 +89,8 @@ typedef struct _AppConfigDataHeader
 typedef struct _AppDataType
 {	
     BOOL   appDataModify;		        //数据更改标志位
+    UINT8  BattCellCount;               //电池模组个数
+    UINT8  BattTempCount;               //电池温度个数
     UINT8  BattInfoSendFreqHigh;        //电池信息发送间隔高频,单位s
     UINT8  BattInfoSendFreqNomal;       //电池信息发送间隔正常,单位s     
     UINT8  BattInfoSendFreqLow;         //电池信息发送间隔低频,单位s

+ 2 - 0
inc/AppSignal.h

@@ -69,6 +69,8 @@ extern UINT8    BattWorkStateDelay;
 extern UINT8   HeatForceControl;  
 extern UINT8   PadInterrupt ;
 extern UINT8   chargerConnectState;
+extern UINT8   BMSupdatestatus;
+
 //declear the UINT16 vars
 extern UINT16	battCellU[28];
 extern UINT16	minCellVol;

+ 1 - 1
inc/AppTaskUart.h

@@ -136,7 +136,7 @@ typedef enum
 	updateErrorPackageCRC = 9,			///the crc of some package is wrong
 	updateErrorPackageWrite = 10,		///package write in failed
 	updateErrorPackageNo = 11,			///package number is not right or not continues
-	updateErrorCheckSumError,			// checksum != checksumcal
+	updateErrorCheckSumError ,			// checksum != checksumcal
 	updateFailed = 0xFF					///					
 }updateBMSStatus;
 void AppTaskUartInit(void *arg);

+ 33 - 28
src/AppFunc.c

@@ -690,17 +690,26 @@ void LEDDisplay(void)
 			if(LightTimer<(UINT8)(LEDFlashPeriod*DutyRatio)) 
 			{			
 				NetSocDisplay(LED_SOC_0,LED_TURN_ON);
+				NetSocDisplay(LED_SOC_1,LED_TURN_OFF);
+				NetSocDisplay(LED_SOC_2,LED_TURN_OFF);
+				NetSocDisplay(LED_SOC_3,LED_TURN_OFF);
 				FaultDisplay(LED_TURN_ON);
 			}
 			else if(LightTimer>=(UINT8)(LEDFlashPeriod*DutyRatio) && LightTimer<LEDFlashPeriod)
 			{
 				NetSocDisplay(LED_SOC_0,LED_TURN_OFF);
+				NetSocDisplay(LED_SOC_1,LED_TURN_OFF);
+				NetSocDisplay(LED_SOC_2,LED_TURN_OFF);
+				NetSocDisplay(LED_SOC_3,LED_TURN_OFF);
 				FaultDisplay(LED_TURN_OFF);
 				
 			}
 			else
 			{
 				NetSocDisplay(LED_SOC_0,LED_TURN_OFF);
+				NetSocDisplay(LED_SOC_1,LED_TURN_OFF);
+				NetSocDisplay(LED_SOC_2,LED_TURN_OFF);
+				NetSocDisplay(LED_SOC_3,LED_TURN_OFF);
 				FaultDisplay(LED_TURN_OFF);
 				LightTimer = 0;			
 			}
@@ -930,20 +939,20 @@ BOOL uartBattInfoDecode(UINT8* dataPtr)
 	UINT32  Battsumvoltage = 0;
 	BATT_CELL_VOL_NUM =  (dataPtr[(0x00)*2] << 8) | (dataPtr[(0x00)*2 + 1]);
 	BATT_TEMP_NUM = ((dataPtr[(0x01)*2] << 8) | (dataPtr[(0x01)*2 + 1]))-BMS_OTHER_TEMP;
-	if((AppNVMData.BattCellCount!=BATT_CELL_VOL_NUM || AppNVMData.BattTempCount!=BATT_TEMP_NUM) &&(BATT_CELL_VOL_NUM !=0 ) && (BATT_TEMP_NUM!=0)  )
+	if((AppDataInfo.BattCellCount!=BATT_CELL_VOL_NUM || AppDataInfo.BattTempCount!=BATT_TEMP_NUM) &&(BATT_CELL_VOL_NUM !=0 ) && (BATT_TEMP_NUM!=0)  )
 	{
-		AppNVMData.appDataModify = TRUE;
-		AppNVMData.BattCellCount = BATT_CELL_VOL_NUM;
-		AppNVMData.BattTempCount = BATT_TEMP_NUM;
+		AppDataInfo.appDataModify = TRUE;
+		AppDataInfo.BattCellCount = BATT_CELL_VOL_NUM;
+		AppDataInfo.BattTempCount = BATT_TEMP_NUM;
 	}
 	else
 	{
-		BATT_CELL_VOL_NUM = AppNVMData.BattCellCount;
-		BATT_TEMP_NUM = AppNVMData.BattTempCount;
+		BATT_CELL_VOL_NUM = AppDataInfo.BattCellCount;
+		BATT_TEMP_NUM = AppDataInfo.BattTempCount;
 	}
 	#ifdef USING_PRINTF1
-        printf("BattCellCount:%d,BATT_CELL_VOL_NUM:%d ",AppNVMData.BattCellCount,BATT_CELL_VOL_NUM);
-		printf("BattTempCount:%d,BATT_TEMP_NUM:%d ",AppNVMData.BattTempCount,BATT_TEMP_NUM);
+        printf("BattCellCount:%d,BATT_CELL_VOL_NUM:%d ",AppDataInfo.BattCellCount,BATT_CELL_VOL_NUM);
+		printf("BattTempCount:%d,BATT_TEMP_NUM:%d ",AppDataInfo.BattTempCount,BATT_TEMP_NUM);
     #endif	
     for(i=0;i<BATT_CELL_VOL_NUM;i++)
     {
@@ -1002,12 +1011,6 @@ BOOL uartBattInfoDecode(UINT8* dataPtr)
     bmsHwVersion = dataPtr[(0x08+BATT_CELL_VOL_NUM+TEMP_NUM)*2+1]; 
     bmsSwVersion = dataPtr[(0x08+BATT_CELL_VOL_NUM+TEMP_NUM)*2];    
 
-	if(AppNVMData.BmsHwVersion!=bmsHwVersion || AppNVMData.BmsSwVersion!=bmsSwVersion )
-	{
-		AppNVMData.appDataModify = TRUE;
-		AppNVMData.BmsHwVersion = bmsHwVersion;
-		AppNVMData.BmsSwVersion = bmsSwVersion;
-	}
 	#ifdef USING_PRINTF1
 		printf("[%d]-%x\n",__LINE__,(dataPtr[(0x09+BATT_CELL_VOL_NUM+TEMP_NUM)*2+1]));
 		printf("[%d]-%x\n",__LINE__,(dataPtr[(0x1B+BATT_CELL_VOL_NUM+TEMP_NUM)*2]));
@@ -1327,6 +1330,7 @@ void SaveAppConfig(void)
     /*
      * open the NVM file
     */
+    AppNVMData.appDataModify = FALSE;
     fp = OsaFopen(APP_CONFIG_FILE_NAME, "wb");   //read & write
     if(OsaFseek(fp, 0, SEEK_SET) != 0)
 	{
@@ -1360,7 +1364,6 @@ void SaveAppConfig(void)
     /*
      * write the file body
     */
-    AppNVMData.appDataModify = FALSE;
     writeCount = OsaFwrite(&AppNVMData, sizeof(AppNVMData), 1, fp);
     if (writeCount != 1)
     {
@@ -1391,9 +1394,9 @@ void LoadAppConfig(void)
     
     if (fp == PNULL)
     {
-	#ifdef USING_PRINTF
-		printf(" NVM, can't open NVM: 'qxappConfig.nvm', use the defult value\n");
-	#endif
+		#ifdef USING_PRINTF
+			printf(" NVM, can't open NVM: 'qxappConfig.nvm', use the defult value\n");
+		#endif
         setDefaultAppConfigData();
         SaveAppConfig();
         return;
@@ -1470,15 +1473,15 @@ static void setDefaultAppConfigData(void)
     memset(&AppNVMData, 0x00, sizeof(AppConfigDataType));
 	AppNVMData.appDataModify = TRUE;		//数据更改标志位
 	memcpy(AppNVMData.battSN,DEFAULT_SN,BATT_SN_LEN);
-   	AppNVMData.isBattLocked = 0;		//0:not locked;	1:locked
-    AppNVMData.chargEndWorkTime = 30;     //
-    AppNVMData.BattTempCount = 5;       //电池温度个数
-    AppNVMData.BattCellCount = 17;       //电池电压串数
-    AppNVMData.BmsHwVersion = 0;
-    AppNVMData.BmsSwVersion = 0;
-    AppNVMData.BLSwVersion = BLSWVERSION;
-    AppNVMData.DrvSwVersion = DRVSWVERSION;
-    AppNVMData.AppSwVersion = APPSWVERSION;        //APP软件版本
+   	AppNVMData.isBattLocked = 0;
+    AppNVMData.reserved1 = 0;     
+    AppNVMData.reserved2 = 0;      
+    AppNVMData.reserved3 = 0;       
+    AppNVMData.reserved4 = 0;
+    AppNVMData.reserved5 = 0;
+    AppNVMData.reserved6 = 0;
+    AppNVMData.reserved7 = 0;
+    AppNVMData.reserved8 = 0; 
 	AppNVMData.EOLState = EOLSTATE;
 	return;
 }
@@ -1493,6 +1496,8 @@ static void setDefaultAppDataInfo(void)
 {
     memset(&AppDataInfo, 0x00, sizeof(AppDataInfo));
     AppDataInfo.appDataModify = false;
+	AppDataInfo.BattCellCount  = 17;
+	AppDataInfo.BattTempCount = 5;
     AppDataInfo.BattInfoSendFreqHigh = 	10;
     AppDataInfo.BattInfoSendFreqNomal = 30;
     AppDataInfo.BattInfoSendFreqLow = 	60;
@@ -2305,7 +2310,7 @@ void UDS_Service(CAN_Msg_Type* CanRxMsg)
 						{
 							UDSPositiveAnswer(0x04,i,0x00);										
 							osDelay(100);
-							SaveAppConfig();
+							//SaveAppConfig();
 							appSetCFUN(0);
 							osDelay(1000);
                 			EC_SystemReset();

+ 5 - 3
src/AppSignal.c

@@ -33,11 +33,11 @@ UINT8	maxCellTemp = 0xFF;             //最高单体温度
 UINT8	minCellTemp = 0xFF;             //最低单体温度
 UINT8	battSOC = 0xFF;                 //电池SOC
 UINT8	battSOH = 0xFF;                 //电池SOH
-UINT8	battWorkState = 0xFF;           //电池工作状态
+UINT8	battWorkState = 0x00;           //电池工作状态
 UINT8	bmsSwVersion = 0xFF;            //bms软件版本
 UINT8	bmsHwVersion = 0xFF;            //bms硬件版本
-UINT8	battMOSSwitchState = 0xFF;      //bms开关状态
-UINT8	battHeatEnableState = 0xFF;     //bms加热使能状态
+UINT8	battMOSSwitchState = 0x00;      //bms开关状态
+UINT8	battHeatEnableState = 0x00;     //bms加热使能状态
 UINT8	reservedSignal1 = 0xFF;         //can信息保留信号1
 UINT8	reservedSignal2 = 0xFF;         //can信息保留信号2
 UINT8	reservedSignal3 = 0xFF;         //can信息保留信号3
@@ -66,6 +66,8 @@ UINT8   BattWorkStateDelay = 0;     //电池工作状态(延时处理后的)
 UINT8   HeatForceControl = 0;       //加热强制控制使能
 UINT8   PadInterrupt = 0x00;           //每个bit代表一个中断标志
 UINT8   chargerConnectState = 0x00;
+UINT8   BMSupdatestatus = 0xFF;
+
 /**declear the uint16 vars**/
 UINT16	battCellU[28] = {0xFFFF};    //电池包单体电压
 UINT16	minCellVol = 0xFFFF;    //最小单体电压

+ 0 - 12
src/AppTaskMain.c

@@ -118,10 +118,6 @@ static void MainTask(void* arg)
                     {
                         AppDataInfo.SysReStartCount = 0;
                     }
-                    if(AppNVMData.appDataModify)
-                    {
-                        SaveAppConfig();
-                    }
                     if(AppDataInfo.appDataModify)
                     {
                         SaveAppData();
@@ -158,10 +154,6 @@ static void MainTask(void* arg)
                 {
                     osDelay(100);
                 }
-                if(AppNVMData.appDataModify)
-                {
-                    SaveAppConfig();
-                }
                 if(AppDataInfo.appDataModify)
                 {
                     SaveAppData();
@@ -193,10 +185,6 @@ static void MainTask(void* arg)
                     {
                         SaveAppData();
                     }
-                    if(AppNVMData.appDataModify)
-                    {
-                        SaveAppConfig();
-                    }
                     if(BcuDataInfo.appDataModify)
                     {
                         SaveBcuData();

File diff ditekan karena terlalu besar
+ 3 - 14
src/AppTaskTcp.c


+ 36 - 18
src/AppTaskUart.c

@@ -43,6 +43,15 @@ static void UartTask(void* arg)
         {
 			case PROCESS_UART_STATE_INTI:
 			{
+				hal_uart_hardware_config_t hwConfig = {
+	                                        ARM_POWER_FULL,
+	                                        ARM_USART_MODE_ASYNCHRONOUS | ARM_USART_DATA_BITS_8 |
+	                                        ARM_USART_PARITY_NONE       | ARM_USART_STOP_BITS_1 |
+	                                        ARM_USART_FLOW_CONTROL_NONE,
+	                                        9600U
+	                                       };
+				HAL_UART_ResetUartSetting(PORT_USART_1, &hwConfig, TRUE);
+				osDelay(100);
 				PROC_UART_STATE_SWITCH(PROCESS_UART_STATE_ENCRYPT);
 				break;
 			}
@@ -98,7 +107,7 @@ static void UartTask(void* arg)
             case PROCESS_UART_STATE_READ:
             {
                 UINT16 CRC_chk_buffer;
-                Reg_Num = 0x21 + AppNVMData.BattCellCount + AppNVMData.BattTempCount + BMS_OTHER_TEMP ;//按照协议里面的0x21+X+N的结束地址
+                Reg_Num = 0x21 + AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP ;//按照协议里面的0x21+X+N的结束地址
                 Uart_Read_Msg.Bms_Address = BMS_ADDRESS_CODE;
                 Uart_Read_Msg.Bms_Funcode = UART_READ_CODE;
                 Uart_Read_Msg.Reg_Begin_H = 0x00;
@@ -110,7 +119,7 @@ static void UartTask(void* arg)
 				Uart_Read_Msg.CRC_L = CRC_chk_buffer;
 				Uart_Read_Msg.CRC_H = CRC_chk_buffer>>8;
 				Uart_Recv_LEN = UartAppTrasmit((UINT8 *)&Uart_Read_Msg,sizeof(Uart_Read_Msg),(UINT8 *)&UartAnswerData,Reg_Num*2 + 5,1000);
-                #ifdef USING_PRINTF
+                #ifdef USING_PRINTF1
 					printf("[%d]Uart_Recv_buffer-%d: ",__LINE__,Uart_Recv_LEN);
                 #endif
 				#ifdef USING_PRINTF1
@@ -160,11 +169,12 @@ static void UartTask(void* arg)
             {
                 UartRecvFlag =  0;
 				#if  BMS_MANUFACTURE==1
-				{
-					SP_BMS_Update_Service();
-				}		
+					BMSupdatestatus = SP_BMS_Update_Service();		
 				#elif BMS_MANUFACTURE==2
-					MS_BMS_Update_Service();
+					BMSupdatestatus = MS_BMS_Update_Service();
+				#endif
+				#ifdef DEBUGLOG
+					Debug_printf("B-U-S:%d\n",BMSupdatestatus);
 				#endif
 				PROC_UART_STATE_SWITCH(PROCESS_UART_STATE_IDLE);
 				BMS_Fota_update_flag = FALSE;
@@ -206,17 +216,17 @@ static UINT8 Uart_WriteCmd_func(UartWriteData_S UartWriteData)
     {
         case 0x01://是否锁定
         {   
-            RegAddress = 0x1B + AppNVMData.BattCellCount + AppNVMData.BattTempCount + BMS_OTHER_TEMP;
+            RegAddress = 0x1B + AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP;
             break;
         }
 		case 0x02://是否加热
 		{
-			RegAddress = 0x1C + AppNVMData.BattCellCount + AppNVMData.BattTempCount + BMS_OTHER_TEMP;
+			RegAddress = 0x1C + AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP;
             break;
 		}
 		case 0x04://是否继电器控制
 		{
-			RegAddress = 0x1B + AppNVMData.BattCellCount + AppNVMData.BattTempCount + BMS_OTHER_TEMP;
+			RegAddress = 0x1B + AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP;
             break;
 		}
         default:
@@ -259,32 +269,32 @@ void Uart_Cmd_Control(QueueHandle_t UartWriteCmdHandle,UartBuffer UartAnswerData
 		UartWriteData.Data[1] = HeatSwitch&0xFF;
 		osMessageQueuePut(UartWriteCmdHandle,&UartWriteData,0,10);
 	}
-	if(battWorkState ==0x00 && AppDataInfo.BattLock==TRUE && ((UartAnswerData.data[(0x1B+AppNVMData.BattCellCount + AppNVMData.BattTempCount + BMS_OTHER_TEMP)*2+1])&0x01)!=0x00)//try to lock lock the discharge 
+	if(battWorkState ==0x00 && AppDataInfo.BattLock==TRUE && ((UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1])&0x01)!=0x00)//try to lock lock the discharge 
 	{
 		UartWriteData.WriteCmd = 0x01;
-		UartWriteData.Data[0] = 0x00|(UartAnswerData.data[(0x1B+AppNVMData.BattCellCount + AppNVMData.BattTempCount + BMS_OTHER_TEMP)*2]);
+		UartWriteData.Data[0] = 0x00|(UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2]);
 		UartWriteData.Data[1] = 0x02;
 		osMessageQueuePut(UartWriteCmdHandle,&UartWriteData,0,10);
 	}
-	else if (battWorkState ==0x00 && AppDataInfo.BattLock==FALSE && ((UartAnswerData.data[(0x1B+AppNVMData.BattCellCount + AppNVMData.BattTempCount + BMS_OTHER_TEMP)*2+1])&0x01)!=0x01 ) // try to unlock
+	else if (battWorkState ==0x00 && AppDataInfo.BattLock==FALSE && ((UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1])&0x01)!=0x01 ) // try to unlock
 	{
 		UartWriteData.WriteCmd = 0x01;
-		UartWriteData.Data[0] = 0x00|(UartAnswerData.data[(0x1B+AppNVMData.BattCellCount + AppNVMData.BattTempCount + BMS_OTHER_TEMP)*2]);
+		UartWriteData.Data[0] = 0x00|(UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2]);
 		UartWriteData.Data[1] = 0x03;
 		osMessageQueuePut(UartWriteCmdHandle,&UartWriteData,0,10);
 	}
-	if(AppDataInfo.RelayControl==TRUE && getbit((UartAnswerData.data[(0x09+AppNVMData.BattCellCount+AppNVMData.BattTempCount + BMS_OTHER_TEMP)*2+1]),0)==0x00)//继电器断开
+	if(AppDataInfo.RelayControl==TRUE && getbit((UartAnswerData.data[(0x09+AppDataInfo.BattCellCount+AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1]),0)==0x00)//继电器断开
 	{
 		UartWriteData.WriteCmd = 0x04;
 		UartWriteData.Data[0] = 0x80;
-		UartWriteData.Data[1] = 0x00|(UartAnswerData.data[(0x1B+AppNVMData.BattCellCount + AppNVMData.BattTempCount + BMS_OTHER_TEMP)*2+1]);
+		UartWriteData.Data[1] = 0x00|(UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1]);
 		osMessageQueuePut(UartWriteCmdHandle,&UartWriteData,0,10);
 	}
-	else if(AppDataInfo.RelayControl==FALSE && getbit((UartAnswerData.data[(0x09+AppNVMData.BattCellCount+AppNVMData.BattTempCount + BMS_OTHER_TEMP)*2+1]),0)==0x01)//继电器闭合
+	else if(AppDataInfo.RelayControl==FALSE && getbit((UartAnswerData.data[(0x09+AppDataInfo.BattCellCount+AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1]),0)==0x01)//继电器闭合
 	{
 		UartWriteData.WriteCmd = 0x04;
 		UartWriteData.Data[0] = 0x00;
-		UartWriteData.Data[1] = 0x00|(UartAnswerData.data[(0x1B+AppNVMData.BattCellCount + AppNVMData.BattTempCount + BMS_OTHER_TEMP)*2+1]);
+		UartWriteData.Data[1] = 0x00|(UartAnswerData.data[(0x1B+AppDataInfo.BattCellCount + AppDataInfo.BattTempCount + BMS_OTHER_TEMP)*2+1]);
 		osMessageQueuePut(UartWriteCmdHandle,&UartWriteData,0,10);
 	}
 }
@@ -297,7 +307,7 @@ UINT8 UartAppTrasmit(UINT8* pSend,UINT32 sendLen, UINT8* pRead, UINT32 readLen,
 	{
 		UartBuffer UartData;
 		osStatus_t ret = osMessageQueueGet(uartDataHandle, &UartData, 0, timeout);    	
-		if (ret == osOK)
+		if (ret == osOK && readLen==UartData.len)
 		{
 			memcpy(pRead,(UINT8 *)&UartData,UartData.len);
 			CRC_Rece_buffer =*(pRead+UartData.len-1)<<8|*(pRead+UartData.len-2);
@@ -315,6 +325,14 @@ UINT8 UartAppTrasmit(UINT8* pSend,UINT32 sendLen, UINT8* pRead, UINT32 readLen,
 				memset(pRead,0x00,readLen);
 				return  0;
 			}
+			#ifdef USING_PRINTF1
+                printf("Uart recv:%d-%d\n",UartData.len,readLen);
+				for (UINT8 i = 0; i < UartData.len; i++)
+				{
+					printf("%x ",*(pRead+i));
+				}
+				printf("\n");
+            #endif
 			return UartData.len;
 		}
 		else

+ 1 - 1
src/app.c

@@ -10,7 +10,7 @@
 void appInit(void *arg)
 {
     AppTaskMainInit(arg);
-    //AppTaskTcpInit(arg);
+    AppTaskTcpInit(arg);
     AppTaskControlInit(arg);
     AdcTaskInit();
     AppTaskGpsInit(arg);

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini