Browse Source

V2.3.0.36 更新Fota升级

CHENJIE-PC\QiXiang_CHENJIE 3 years ago
parent
commit
c5134c4477
5 changed files with 40 additions and 19 deletions
  1. 1 1
      inc/app.h
  2. 24 3
      src/Fota.c
  3. 1 1
      src/GpsTask.c
  4. 6 6
      src/TcpTask.c
  5. 8 8
      src/UartTask.c

+ 1 - 1
inc/app.h

@@ -51,7 +51,7 @@ extern "C" {
 #define	BLSWVERSION		0x01020000    //BootLoader版本号V1.2.0.0
 #define	DRVSWVERSION		0x01050000     //驱动层版本号V1.4.0.0  驱动层1.5.0.0,增加了三轴
 //#define	APPSWVERSION		0x01020209     
-#define	APPSWVERSION		0x02030023
+#define	APPSWVERSION		0x02030024
 //#define	APPSWVERSION		0x0201000E
 //--------------------------------------------------------------------------------
 

+ 24 - 3
src/Fota.c

@@ -92,16 +92,25 @@ void Fota_Func(UINT8 *DataPtr,INT32 connectId)
                     if(Data_Read_Crc==Fota_S.Fota_CRC )
                     {
                         Fota_Answer[3] = 0x01;
+                        #ifdef USING_PRINTF 
+                            printf("Write Sucess-%x\n",Fota_S.Fota_Current_Addres);
+                        #endif
                     }
                     else
                     {
                         Fota_Answer[3] = 0x02;
                         BSP_QSPI_Erase_Safe(Fota_S.Fota_Flash_Addres+Fota_S.Fota_Current_Addres,Fota_Recv_Data_Len_4);
+                        #ifdef USING_PRINTF 
+                            printf("Write Failed-%x\n",Fota_S.Fota_Current_Addres);
+                        #endif
                     }
                 }
                 else//数据校验失败
                 {
                     Fota_Answer[3] = 0x02;
+                    #ifdef USING_PRINTF 
+                        printf("Check Failed-%x\n",Fota_S.Fota_Current_Addres);
+                    #endif
                 }
                 if(Data_Read_Buffer!=PNULL)
                     free(Data_Read_Buffer);
@@ -112,7 +121,19 @@ void Fota_Func(UINT8 *DataPtr,INT32 connectId)
                 Fota_Answer[23] = 0x12;
                 memcpy(&Fota_Answer[24],(DataPtr+24),18);
                 Fota_Answer[42] =  bcc_chk_fota(Fota_Answer,42);
-                tcpipConnectionSend(connectId,Fota_Answer,43,0,0,0);
+                INT16 ret = 0;
+                ret =  tcpipConnectionSend(connectId,Fota_Answer,43,0,0,0);
+                #ifdef USING_PRINTF 
+                    printf("ret = %d_%x\n",ret,Fota_S.Fota_Current_Addres);
+                    if( Fota_Answer[3] == 0x02)
+                    {
+                        for (UINT8 i = 0; i < 42; i++)
+                        {
+                            printf("%02X \n",Fota_Answer[i]);
+                        }
+                        printf("\n");
+                    }
+                #endif
                 break;
             }
             case 0x03:
@@ -208,7 +229,7 @@ void Fota_Func(UINT8 *DataPtr,INT32 connectId)
                     }
                     BSP_QSPI_Write_Safe(Fota_S.Fota_Recv_Data,Fota_S.Fota_Flash_Addres+Fota_S.Fota_Current_Addres,Fota_Recv_Data_Len_4);
                     memset(Data_Read_Buffer,0x00,Fota_S.Fota_Recv_Data_Len);
-                    BSP_QSPI_Read_Safe(Data_Read_Buffer,Fota_S.Fota_Flash_Addres+Fota_S.Fota_Current_Addres,Fota_Recv_Data_Len);
+                    BSP_QSPI_Read_Safe(Data_Read_Buffer,Fota_S.Fota_Flash_Addres+Fota_S.Fota_Current_Addres,Fota_S.Fota_Recv_Data_Len);
                     Data_Read_Crc = Fota_crc_chk(Data_Read_Buffer,Fota_S.Fota_Recv_Data_Len);
                     #ifdef USING_PRINTF1
                         printf("\n\n\n");
@@ -226,7 +247,7 @@ void Fota_Func(UINT8 *DataPtr,INT32 connectId)
                     else
                     {
                         Fota_Answer[3] = 0x02;
-                        BSP_QSPI_Erase_Safe(Fota_S.Fota_Flash_Addres+Fota_S.Fota_Current_Addres,Fota_S.Fota_Recv_Data_Len_4);
+                        BSP_QSPI_Erase_Safe(Fota_S.Fota_Flash_Addres+Fota_S.Fota_Current_Addres,Fota_Recv_Data_Len_4);
                     }
                 }
                 else//数据校验失败

+ 1 - 1
src/GpsTask.c

@@ -174,7 +174,7 @@ static void GpsTask(void* arg)
             xzyDataSend[0] = (xData[0] + xData[1] + xData[2])/3;
             xzyDataSend[1] = (yData[0] + yData[1] + yData[2])/3;
             xzyDataSend[2] = (zData[0] + zData[1] + zData[2])/3;
-            #ifdef USING_PRINTF
+            #ifdef USING_PRINTF1
                 printf("\n%d %d %d \r\n", xzyDataSend[0],xzyDataSend[1],xzyDataSend[2]);
             #endif
 

+ 6 - 6
src/TcpTask.c

@@ -988,12 +988,12 @@ static void socketAppConnectionCallBack(UINT8 connectionEventType, void *bodyEve
                 osMessageQueuePut(TcpRecvHandle,&rcvbuffer,0,1000);
                 sendQueueMsg(QMSG_ID_SOCK_RECVPKG, 0);
                 #ifdef USING_PRINTF
-                    uint8_t* Ptr;
-                    Ptr=rcvInd->data;
-                    printf("socket connection %u receive length %u data:", rcvInd->connectionId, rcvInd->length);
-                    // for(int i = 0;i<rcvInd->length;i++)
-                    //     printf("%x  ",*(Ptr+i));
-                    // printf("\n");
+                    uint8_t* DataPtr;
+                    DataPtr=rcvInd->data;
+                    if(rcvInd->length>=43)
+                    {
+                        printf("receive=%u_%x\n",rcvInd->length,*(DataPtr+37)<<24|*(DataPtr+38)<<16|*(DataPtr+39)<<8|*(DataPtr+40));
+                    }  
                 #endif
                 ECOMM_TRACE(UNILOG_PLA_APP, socketAppConnectionCallBack_5, P_INFO, 2, "socketAppConnectionCallBack socket connection %u receive length %u data", rcvInd->connectionId, rcvInd->length);
             }

+ 8 - 8
src/UartTask.c

@@ -145,7 +145,7 @@ static void UartTask(void* arg)
                 }
                 else if(Timer_count%10==0)
                 {
-					#ifdef USING_PRINTF
+					#ifdef USING_PRINTF1
                             printf("[%d]AvgBattTemp :%d,UartBattInfoRecvFlag:%d,battHeatEnableState:%d \n",__LINE__,AvgBattTemp,UartBattInfoRecvFlag,battHeatEnableState);
                         #endif
                     if(osMessageQueueGet(UartWriteCmdHandle,&UartWriteData,0,0)==osOK && UartBattInfoRecvFlag==TRUE)
@@ -2306,7 +2306,7 @@ updateBMSStatus MS_BMS_Update_Service() //美顺BMS升级服务
 		{
 			checkSumCal = (checkSumCal + ReadNVMTemp[j]) & 0xFF;
 		}
-		//osDelay(10);
+		osDelay(10);
 	}
 	if(checkSum != checkSumCal)
 	{
@@ -2349,7 +2349,7 @@ updateBMSStatus MS_BMS_Update_Service() //美顺BMS升级服务
 				pUpdateMsgSend[5] = CRCtemp&0xFF;		//CRC Low
 				
 				memset((UINT8*)(bmsAnswerMsg) , 0, 8);
-				ret0 = MS_BMS_Update_Query(pUpdateMsgSend, updateMsgSendLen, (UINT8*)(bmsAnswerMsg), updateMsgReadLen, 500);
+				ret0 = MS_BMS_Update_Query(pUpdateMsgSend, updateMsgSendLen, (UINT8*)(bmsAnswerMsg), updateMsgReadLen, 1000);
 				#ifdef USING_PRINTF
 				printf("update step 1 answer,updateMsgReadLen = %x:\n",updateMsgReadLen);
 				
@@ -2449,7 +2449,7 @@ updateBMSStatus MS_BMS_Update_Service() //美顺BMS升级服务
 				pUpdateMsgSend[5+dataLen] = CRCtemp&0xFF;		//CRC Low
 				
 				memset((UINT8*)(bmsAnswerMsg) , 0, 8);
-				ret0 = MS_BMS_Update_Query(pUpdateMsgSend, updateMsgSendLen, (UINT8*)(bmsAnswerMsg), updateMsgReadLen, 500);
+				ret0 = MS_BMS_Update_Query(pUpdateMsgSend, updateMsgSendLen, (UINT8*)(bmsAnswerMsg), updateMsgReadLen, 1000);
 				#ifdef USING_PRINTF
 				printf("update step 3 answer:\n");
 				 for(ii=0;ii<updateMsgReadLen;ii++)
@@ -2532,7 +2532,7 @@ updateBMSStatus MS_BMS_Update_Service() //美顺BMS升级服务
 				pUpdateMsgSend[5+dataLen] = CRCtemp&0xFF;		//CRC Low
 				
 				memset((UINT8*)(bmsAnswerMsg) , 0, 8);
-				ret0 = MS_BMS_Update_Query(pUpdateMsgSend, updateMsgSendLen, (UINT8*)(bmsAnswerMsg), updateMsgReadLen, 500);
+				ret0 = MS_BMS_Update_Query(pUpdateMsgSend, updateMsgSendLen, (UINT8*)(bmsAnswerMsg), updateMsgReadLen, 1000);
 				#ifdef USING_PRINTF
 				printf("update step 5 answer:\n");
 				 for(ii=0;ii<updateMsgReadLen;ii++)
@@ -2632,7 +2632,7 @@ updateBMSStatus MS_BMS_Update_Service() //美顺BMS升级服务
 					pUpdateMsgSend[5+dataLen] = CRCtemp&0xFF;		//CRC Low
 					
 					memset((UINT8*)(bmsAnswerMsg) , 0, 8);
-					ret0 = MS_BMS_Update_Query(pUpdateMsgSend, updateMsgSendLen, (UINT8*)(bmsAnswerMsg), updateMsgReadLen, 500);
+					ret0 = MS_BMS_Update_Query(pUpdateMsgSend, updateMsgSendLen, (UINT8*)(bmsAnswerMsg), updateMsgReadLen, 1000);
 					#ifdef USING_PRINTF
 						printf("update step 7 answer:\n");
 					 for(ii=0;ii<updateMsgReadLen;ii++)
@@ -2716,7 +2716,7 @@ updateBMSStatus MS_BMS_Update_Service() //美顺BMS升级服务
 				pUpdateMsgSend[5] = CRCtemp&0xFF;		//CRC Low
 				
 				memset((UINT8*)(bmsAnswerMsg) , 0, 8);
-				ret0 = MS_BMS_Update_Query(pUpdateMsgSend, updateMsgSendLen, (UINT8*)(bmsAnswerMsg), updateMsgReadLen, 500);
+				ret0 = MS_BMS_Update_Query(pUpdateMsgSend, updateMsgSendLen, (UINT8*)(bmsAnswerMsg), updateMsgReadLen, 1000);
 				#ifdef USING_PRINTF
 				printf("update step 9 answer:\n");
 				 for(ii=0;ii<updateMsgReadLen;ii++)
@@ -2779,7 +2779,7 @@ updateBMSStatus MS_BMS_Update_Service() //美顺BMS升级服务
 				pUpdateMsgSend[5] = CRCtemp&0xFF;		//CRC Low
 				
 				memset((UINT8*)(bmsAnswerMsg) , 0, 8);
-				ret0 = MS_BMS_Update_Query(pUpdateMsgSend, updateMsgSendLen, (UINT8*)(bmsAnswerMsg), updateMsgReadLen, 500);
+				ret0 = MS_BMS_Update_Query(pUpdateMsgSend, updateMsgSendLen, (UINT8*)(bmsAnswerMsg), updateMsgReadLen, 1000);
 				#ifdef USING_PRINTF
 				printf("update step A answer:\n");
 				 for(ii=0;ii<updateMsgReadLen;ii++)