Quellcode durchsuchen

北京测试:版本号为1.2.1.16,增加了Bms升级两次循环。

CHENJIE-PC\QiXiang_CHENJIE vor 3 Jahren
Ursprung
Commit
906efdb1f5
1 geänderte Dateien mit 34 neuen und 15 gelöschten Zeilen
  1. 34 15
      src/UartTask.c

+ 34 - 15
src/UartTask.c

@@ -845,7 +845,8 @@ void SP_BMS_Update_Service() //超力源BMS升级服务
 	UINT8 bmsUpdateFlag = 1;
 	//BMS_Update_Recv_Msg_Type bmsMsg;
 	//static UpdateStep step = UPDATE_STEP_CHECK_VERSION;
-	while(bmsUpdateFlag)
+	UINT8 Cycle_conut = 0;
+	while(bmsUpdateFlag && Cycle_conut<2)
 	{
 		switch (updateStep)
 		{
@@ -895,7 +896,7 @@ void SP_BMS_Update_Service() //超力源BMS升级服务
 				{
 					errorCount++;
 				}
-				#ifdef USING_PRINTF
+				#ifdef USING_PRINTF1
 							//printf("update step:%d\n",updateStep);
 							printf("query:");
 							
@@ -970,7 +971,7 @@ void SP_BMS_Update_Service() //超力源BMS升级服务
 					errorCount = 0;
 				}
 				
-				#ifdef USING_PRINTF
+				#ifdef USING_PRINTF1
 							printf("update step:%d\n",updateStep);
 							printf("query:");
 							for(j=0;j<updateMsgSendLen;j++)
@@ -1003,7 +1004,7 @@ void SP_BMS_Update_Service() //超力源BMS升级服务
 				ret = SP_BMS_Update_Query(pUpdateMsgSend, updateMsgSendLen, (UINT8*)(&pUpdateMsgRecv), 0, 500);
 				//updateStep = UPDATE_STEP_SET_BAUD_RATE;
 				updateStep = UPDATE_STEP_CHECK_VERSION_AGAIN;//2021-04-09跳过波特率设置
-				#ifdef USING_PRINTF
+				#ifdef USING_PRINTF1
 							
 							printf("query:");
 							for(j=0;j<updateMsgSendLen;j++)
@@ -1065,7 +1066,7 @@ void SP_BMS_Update_Service() //超力源BMS升级服务
 				{
 					errorCount++;
 				}
-				#ifdef USING_PRINTF
+				#ifdef USING_PRINTF1
 							//printf("update step:%d\n",updateStep);
 							printf("query:");
 							
@@ -1105,13 +1106,14 @@ void SP_BMS_Update_Service() //超力源BMS升级服务
 				pUpdateMsgSend[9] = 0x80;
 				pUpdateMsgSend[10] = 0x61;	//check
 				pUpdateMsgSend[11] = 0xF5;	//end flag
-				
+				#ifdef USING_PRINTF1
 				printf("query:");
 				for(j=0;j<updateMsgSendLen;j++)
 				{
 					printf("%x ",pUpdateMsgSend[j]);
 				}
 				printf("\n");
+				#endif
 				memset((UINT8*)(&pUpdateMsgRecv) , 0, sizeof(BMS_Update_Recv_Msg_Type));
 				ret = SP_BMS_Update_Query(pUpdateMsgSend, updateMsgSendLen, (UINT8*)(&pUpdateMsgRecv), sizeof(BMS_Update_Recv_Msg_Type), 500);
 				printf("ret = %d\n",ret);
@@ -1152,7 +1154,7 @@ void SP_BMS_Update_Service() //超力源BMS升级服务
 					errorCount = 0;
 				}
 				
-				#ifdef USING_PRINTF
+				#ifdef USING_PRINTF1
 					//printf("update step:%d\n",updateStep);
 					printf("query:");
 					for(j=0;j<updateMsgSendLen;j++)
@@ -1222,7 +1224,7 @@ void SP_BMS_Update_Service() //超力源BMS升级服务
 					errorCount = 0;
 				}
 				
-				#ifdef USING_PRINTF
+				#ifdef USING_PRINTF1
 					//printf("update step:%d\n",updateStep);
 					printf("query:");
 					for(j=0;j<updateMsgSendLen;j++)
@@ -1296,7 +1298,7 @@ void SP_BMS_Update_Service() //超力源BMS升级服务
 					errorCount = 0;
 				}
 				
-				#ifdef USING_PRINTF
+				#ifdef USING_PRINTF1
 							//printf("update step:%d\n",updateStep);
 							printf("query:");
 							for(j=0;j<updateMsgSendLen;j++)
@@ -1364,7 +1366,7 @@ void SP_BMS_Update_Service() //超力源BMS升级服务
 					errorCount = 0;
 				}
 				
-				#ifdef USING_PRINTF
+				#ifdef USING_PRINTF1
 					//printf("update step:%d\n",updateStep);
 					printf("query:");
 					for(j=0;j<updateMsgSendLen;j++)
@@ -1443,7 +1445,7 @@ void SP_BMS_Update_Service() //超力源BMS升级服务
 						errorCount = 0;
 						break;
 					}
-				#ifdef USING_PRINTF
+				#ifdef USING_PRINTF1
 							//printf("update step:%d\n",updateStep);
 							printf("query:");
 							for(j=0;j<updateMsgSendLen;j++)
@@ -1512,7 +1514,7 @@ void SP_BMS_Update_Service() //超力源BMS升级服务
 					errorCount = 0;
 				}
 				
-				#ifdef USING_PRINTF
+				#ifdef USING_PRINTF1
 							//printf("update step:%d\n",updateStep);
 							printf("query:");
 							for(j=0;j<updateMsgSendLen;j++)
@@ -1546,7 +1548,7 @@ void SP_BMS_Update_Service() //超力源BMS升级服务
 				
 				updateStep = UPDATE_STEP_END;
 				
-				#ifdef USING_PRINTF
+				#ifdef USING_PRINTF1
 							//printf("update step:%d\n",updateStep);
 							printf("query:");
 							for(j=0;j<updateMsgSendLen;j++)
@@ -1611,7 +1613,8 @@ void SP_BMS_Update_Service() //超力源BMS升级服务
 				memset((UINT8*)(&pUpdateMsgRecv) , 0, sizeof(BMS_Update_Recv_Msg_Type));
 				SP_BMS_Update_Query(pUpdateMsgSend, updateMsgSendLen, (UINT8*)(&pUpdateMsgRecv), 0, 500);
 				osDelay(50);
-				updateStep = UPDATE_STEP_ERROR;
+				updateStep = UPDATE_STEP_CHECK_VERSION;
+				Cycle_conut++:
 				break;
 			case UPDATE_STEP_ERROR:
 				updateStep = UPDATE_STEP_CHECK_VERSION;
@@ -1633,6 +1636,14 @@ UINT8 SP_BMS_Update_Query(UINT8* pSend,UINT32 sendLen, UINT8* pRead, UINT32 read
 	UINT8 timeCount = 0;
 	UINT8 j=0;
 	USARTdrv->Send(pSend,sendLen);
+	#ifdef USING_PRINTF
+		printf("query in:");
+		for(j=0;j<sendLen;j++)
+		{
+			printf("%x ",*(pSend+j));
+		}
+		printf("\n");	
+	#endif
 	if(readLen>0)
 	{
 		USARTdrv->Receive(pRead,readLen);         
@@ -1646,7 +1657,15 @@ UINT8 SP_BMS_Update_Query(UINT8* pSend,UINT32 sendLen, UINT8* pRead, UINT32 read
 				isRecvTimeout = true;
 				break;
 			}
-		}	
+		}
+		#ifdef USING_PRINTF
+			printf("\nanswer in:");
+			for(j=0;j<readLen;j++)
+			{
+				printf("%x ",*(pRead+j));
+			}
+			printf("\n");
+		#endif	
 		if (isRecvComplete == true)
 		{
 			isRecvComplete = false;