Browse Source

软件集成修改:1.对部分打印进行屏蔽,2.下线检测未完成不发送网络数据

CHENJIE-PC\QiXiang_CHENJIE 4 years ago
parent
commit
66d9ae3e62
8 changed files with 26 additions and 21 deletions
  1. 1 1
      inc/UDSService.h
  2. 3 1
      inc/app.h
  3. 3 3
      src/Fota.c
  4. 5 4
      src/MainTask.c
  5. 1 1
      src/TcpTask.c
  6. 0 1
      src/UDSService.c
  7. 12 9
      src/UartTask.c
  8. 1 1
      src/app.c

+ 1 - 1
inc/UDSService.h

@@ -1,5 +1,5 @@
 #include "TcpTask.h"
-
+extern UINT8 	UDSSwitch;
 extern CAN_Msg_Type CanRxMsg[2];
 
 extern UINT8   BattSN[BATT_SN_LEN];  //ASCII code

+ 3 - 1
inc/app.h

@@ -35,9 +35,11 @@ extern "C" {
 #define	BLSWVERSION		0x01020000    //BootLoader版本号V1.2.0.0
 #define	DRVSWVERSION		0x01030000     //驱动层版本号V1.3.0.0
 #define	APPSWVERSION		0x01020101      
+
+//--------------------------------------------------------------------------------
+
 #define APP_CONFIG_FILE_LATEST_VERSION 0
 #define APP_CONFIG_FILE_NAME  "qxappconfig.nvm"
-//--------------------------------------------------------------------------------
 typedef struct AppNVMDataType
 {	
     BOOL   appDataModify;		//数据更改标志位

+ 3 - 3
src/Fota.c

@@ -106,7 +106,7 @@ void Fota_Func(UINT8 *DataPtr,INT32 connectId,UINT8 FotaType)
                     Fota_S.Fota_Recv_Data_Len = Fota_S.Fota_Recv_Data_Len + 4-(Fota_S.Fota_Recv_Data_Len%4);
                     }
                     
-                    #ifdef USING_PRINTF
+                    #ifdef USING_PRINTF1
                         printf("\nlen:%x,%xFota_Data_Recv :",Fota_S.Fota_Recv_Data_Len,Fota_S.Fota_Current_Addres);
                         for(UINT32 i = 0;i<Fota_S.Fota_Recv_Data_Len;i++)
                         {
@@ -115,7 +115,7 @@ void Fota_Func(UINT8 *DataPtr,INT32 connectId,UINT8 FotaType)
                         printf("\ndata Recv end\n");
                     #endif
                     ret = BSP_QSPI_Write_Safe(Fota_S.Fota_Recv_Data,Fota_S.Fota_Flash_Addres+Fota_S.Fota_Current_Addres,Fota_S.Fota_Recv_Data_Len);
-                    #ifdef USING_PRINTF
+                    #ifdef USING_PRINTF1
                         printf("\nret:%d\n",ret);
                     #endif
                     if(ret==QSPI_OK)
@@ -126,7 +126,7 @@ void Fota_Func(UINT8 *DataPtr,INT32 connectId,UINT8 FotaType)
                     {
                         Fota_Answer[3] = 0x02;
                     }
-                    #ifdef USING_PRINTF
+                    #ifdef USING_PRINTF1
                         UINT8 Ptr[1];
                         printf("\nlen:%x,%xFota_Data :",Fota_S.Fota_Recv_Data_Len,Fota_S.Fota_Current_Addres);
                         for(UINT32 i = 0;i<Fota_S.Fota_Recv_Data_Len;i++)

+ 5 - 4
src/MainTask.c

@@ -31,6 +31,7 @@
 #include "TcpTask.h"
 #include "Fota.h"
 #include "UartTask.h"
+extern UINT8 	UDSSwitch;
 extern volatile bool Fota_update_flag;
 CHAR defaultBattSN[BATT_SN_LEN] = "GYTEST00000000003";//SN仍在测试
 //全局变量
@@ -92,7 +93,7 @@ static void MainTask(void* arg)
     slpManWakeSrc_e Wakeup_source;
 
 	appGetNVMSavedData();
-    #ifdef USING_PRINTF
+    #ifdef USING_PRINTF1
     UINT8 *pReadAppConfig;
     UINT32 readCount;
     //AppConfigHeader    AppConfigHr;
@@ -157,7 +158,7 @@ static void MainTask(void* arg)
                     xTimerStop(montior_timer, 0);
                     PROC_MAIN_STATE_SWITCH(PROCESS_STATE_SLEEP);
                 }
-                if(TcpService!=0x00)
+                if(TcpService!=0x00||UDSSwitch==1)
                 {
                     xTimerReset(work_timer,0);
                 }
@@ -254,7 +255,7 @@ void MainTaskDeInit(void *arg)
 //定时器回调函数区
 void montior_timer_callback(TimerHandle_t xTimer)
 {
-    #ifdef USING_PRINTF
+    #ifdef USING_PRINTF1
         if (Timer_count%50==0)
         {
             printf("Main Task,Batt_Cell_Num:%d,%d!\n",BATT_CELL_VOL_NUM,Timer_count);
@@ -581,7 +582,7 @@ static void setDefaultAppDataValue(void)
 	}
 	AppNVMData.isBattLocked = false;
 	AppNVMData.chargEndWorkTime = 30;  //30 min
-	AppNVMData.wakeupWorkTime = 15;	//2min
+	AppNVMData.wakeupWorkTime = 5;	//2min
 	AppNVMData.sleepTime = 5;			//5min
     AppNVMData.HwVersion = HWVERSION;
     AppNVMData.BLSwVersion = BLSWVERSION;

+ 1 - 1
src/TcpTask.c

@@ -88,7 +88,7 @@ static void TcpTask(void* arg)
             sendQueueMsg(QMSG_ID_NW_IP_SUSPEND, 0);
             sendQueueMsg(QMSG_ID_SOCK_EXIT, 0);
         }
-        else if(Timer_count%50==0 && TcpService==0x00)
+        else if(Timer_count%50==0 && TcpService==0x00 && AppNVMData.EOLState==1)
         {
             sendQueueMsg(QMSG_ID_SOCK_SENDPKG, 0);
         }

+ 0 - 1
src/UDSService.c

@@ -503,7 +503,6 @@ void UDS_Service()
 		UDSService[i] = 0;
 		UDSSubService[i] = 0;
 	}
-
 }
 
 UINT8 UDSPositiveAnswer(UINT8 answerLen,UINT8 messageIndex,UINT32 posCode)

+ 12 - 9
src/UartTask.c

@@ -481,10 +481,10 @@ void battSOCDisplay()
 	    workState = ((temp&0x01)<<01)|(temp>>0x01);
 	    currentSoc = UartReadMsg.data[(0x0B+BATT_CELL_VOL_NUM+BATT_TEMP_NUM+2)*2+1];
 	}
-#ifdef USING_PRINTF
-	printf("current SOC = %d\n",currentSoc);
-	printf("work state = %d\n",workState);
-#endif
+	#ifdef USING_PRINTF1
+		printf("current SOC = %d\n",currentSoc);
+		printf("work state = %d\n",workState);
+	#endif
 
 	lightTimer++;
 	
@@ -677,15 +677,18 @@ void battErrorStateDisplay()
 	
 	if(UartReadMsg.Header[2]>0)
 	{
-		MEMCPY(&errorState,&(UartReadMsg.data[(0x09+BATT_CELL_VOL_NUM+BATT_TEMP_NUM+2)*2]),4); 
+		errorState = ((UartReadMsg.data[(0x09+BATT_CELL_VOL_NUM+BATT_TEMP_NUM+2)*2])<<8)|0|((UartReadMsg.data[(0x0A+BATT_CELL_VOL_NUM+BATT_TEMP_NUM+2)*2])<<24)|((UartReadMsg.data[(0x0A+BATT_CELL_VOL_NUM+BATT_TEMP_NUM+2)*2+1])<<16);
+		//MEMCPY(&errorState,&(UartReadMsg.data[(0x09+BATT_CELL_VOL_NUM+BATT_TEMP_NUM+2)*2]),4); 
 	}
 	
 	errorLightTimer++;
 	
 	//errorState = testErrorState;
-#ifdef USING_PRINTF
-	printf("error state = %d\n",errorState);
-#endif
+	#ifdef USING_PRINTF1
+		for(int k=0;k<UartReadMsg.Header[2];k++)
+			printf("%x  ",UartReadMsg.data[k]);
+		printf("error state = %x\n",errorState);
+	#endif
 	if(errorState != 0)
 	{
 		if(errorLightTimer<(UINT8)(errorLEDFlashPeriod*errorDutyRatio)) 
@@ -723,7 +726,7 @@ void battLockStateDisplay(UINT8 lockState)
 	UINT8  errorLEDFlashPeriod = 10;//1000ms
 	float errorDutyRatio = 0.4;
 	
-	printf("lockState = %d\ncurrent State = %d\n",lockState,currentState);
+	//printf("lockState = %d\ncurrent State = %d\n",lockState,currentState);
 	if(lockState==0)//no error
 	{
 		if(currentState!=lockState)

+ 1 - 1
src/app.c

@@ -33,9 +33,9 @@ void appInit(void *arg)
     #ifdef USING_PRINTF	
     	printf("%s[%d]\r\n",__FUNCTION__, __LINE__);
     #endif
-    AdcTaskInit();
     MainTaskInit(arg);
     osDelay(1000);
+    AdcTaskInit();
     UartTaskInit(arg);
     TcpTaskInit(arg);
     GpsTaskInit();