Browse Source

1.2.2.1,调试使用

CHENJIE-PC\QiXiang_CHENJIE 3 years ago
parent
commit
97de8b7e26
3 changed files with 58 additions and 35 deletions
  1. 26 16
      inc/app.h
  2. 8 0
      src/CANTask.c
  3. 24 19
      src/UartTask.c

+ 26 - 16
inc/app.h

@@ -13,34 +13,44 @@
 extern "C" {
 #endif
 //全局定义声明区
-#define BMS_MANUFACTURE (1) //BMS制造商表示1-超力源,2-美顺
+#define BMS_MANUFACTURE (2) //BMS制造商表示1-超力源,2-美顺
 #define DATA_MODULE_TYPE (1) //1表示NB模块,2表示4G cat1
-//#define BAT4830
-#define BAT6060  //电池型号变化需要更改
-#ifdef  BAT4830
-    #define BATT_CELL_VOL_NUM  (14)
-    #define BATT_TEMP_NUM  (3)
-    #define BMS_INFO  (1)      //1BMS信息表示4830
-    #define BATT_OTHER_TEMP_NUM  (2)
-#elif defined BAT6060
-    #define BATT_CELL_VOL_NUM  (17)
-    #define BATT_TEMP_NUM  (4)
-    #define BMS_INFO  (2)       //2-BMS信息表示6060
-    #define BATT_OTHER_TEMP_NUM  (2)
+#define BMS_INFO  (1)       //1-1表示超力源4830,1-2表示超力源6060,2-1表示美顺6455
+
+#if  BMS_MANUFACTURE==1
+    #if BMS_INFO==1
+        #define BATT_CELL_VOL_NUM  (14)
+        #define BATT_TEMP_NUM  (3)
+        #define BATT_OTHER_TEMP_NUM  (2)
+    #elif BMS_INFO==2
+        #define BATT_CELL_VOL_NUM  (17)
+        #define BATT_TEMP_NUM  (4)
+        #define BATT_OTHER_TEMP_NUM  (2)
+    #endif
+#elif  BMS_MANUFACTURE==2
+    #if BMS_INFO==1
+        #define BATT_CELL_VOL_NUM  (20)
+        #define BATT_TEMP_NUM  (3)
+        #define BATT_OTHER_TEMP_NUM  (2)
+    #elif BMS_INFO==2
+        #define BATT_CELL_VOL_NUM  (17)
+        #define BATT_TEMP_NUM  (4)
+        #define BATT_OTHER_TEMP_NUM  (2)
+    #endif
 #endif
 #define BATT_CELL_VOL_NUM_2 (BATT_CELL_VOL_NUM*2)
-#define BATT_SN_LEN           17
- 
+
 #define HWVERSION		    0x0102    //硬件主版本,现为V1.2板
 #define	BLSWVERSION		0x01020000    //BootLoader版本号V1.2.0.0
 #define	DRVSWVERSION		0x01040000     //驱动层版本号V1.4.0.0
-#define	APPSWVERSION		0x01020200     
+#define	APPSWVERSION		0x01020201     
 //#define	APPSWVERSION		0x02000003
 //--------------------------------------------------------------------------------
 
 #define APP_CONFIG_FILE_LATEST_VERSION 0
 #define APP_CONFIG_FILE_NAME  "qxappconfig.nvm"
 #define APP_DATAINFO_FILE_NAME  "qxappDataInfo.nvm"
+#define BATT_SN_LEN           17
 typedef struct AppNVMDataType
 {	
     BOOL   appDataModify;		//数据更改标志位

+ 8 - 0
src/CANTask.c

@@ -93,6 +93,14 @@ static void Can_Receive()
 					{								
 						if(CanRxMsg[i].Id == 0x7A0)
 						{	
+							#ifdef USING_PRINTF
+								printf("ID = 0x%x\n",CanRxMsg[i].Id);
+								for(UINT8 j = 0; j<8;j++)
+								{
+									printf("%x ",CanRxMsg[i].Data[j]);
+								}
+								printf("\n");
+							#endif
 							udsFlag = 1;
 							UDSService[i] =  CanRxMsg[i].Data[0];
 							UDSSubService[i] = CanRxMsg[i].Data[1];

+ 24 - 19
src/UartTask.c

@@ -116,9 +116,6 @@ static void UartTask(void* arg)
 					EncryptCount++;
 				}
 				PROC_UART_STATE_SWITCH(PROCESS_UART_STATE_IDLE);
-				#ifdef USING_PRINTF
-                    printf("[%d]PROCESS_UART_STATE_ENCRYPT Done\n",__LINE__);
-                #endif
 				break;
 			}
             case PROCESS_UART_STATE_IDLE:
@@ -130,7 +127,7 @@ static void UartTask(void* arg)
                 }
                 else if(Timer_count%10==0)
                 {
-                    #ifdef USING_PRINTF1
+                    #ifdef USING_PRINTF
                         printf("[%d]Uart Timer 5s:%d\n",__LINE__,Timer_count);
                     #endif
                     if(osMessageQueueGet(UartWriteCmdHandle,&UartWriteData,0,0)==osOK)
@@ -211,6 +208,14 @@ static void UartTask(void* arg)
                 {
                     BattChrgEndFlag=FALSE;
                 }
+				#ifdef USING_PRINTF1
+					printf("\nUart_Recv_buffer:  ");
+					for(int i=0;i<Uart_Recv_LEN;i++)
+					{
+						printf("%x ",*((UINT8 *)&UartReadMsg.Header+i));
+					}
+					printf("\n");
+				#endif
                 osMutexRelease(UartMutex);
                 break;
             }
@@ -383,14 +388,14 @@ UINT8 Uart_Transmit_func(UINT8* Uart_Read_Msg,UINT8* Uart_Recv_Buffer)
     *(Uart_Read_Msg+6) = CRC_chk_buffer;
     *(Uart_Read_Msg+7)  = CRC_chk_buffer>>8;
     USARTdrv->Send(Uart_Read_Msg,8);
-    // #ifdef USING_PRINTF
-    //     printf("Uart_Send_buffer:  ");
-    //     for(int i=0;i<8;i++)
-    //     {
-    //         printf("%x ",*(Uart_Read_Msg+i));
-    //     }
-    //     printf("\n");
-    // #endif
+    #ifdef USING_PRINTF
+        printf("Uart_Send_buffer:  ");
+        for(int i=0;i<8;i++)
+        {
+            printf("%x ",*(Uart_Read_Msg+i));
+        }
+        printf("\n");
+    #endif
     USARTdrv->Receive(Uart_Recv_Buffer,Data_Len);
     while((isRecvTimeout == false) && (isRecvComplete == false))
     {
@@ -403,13 +408,13 @@ UINT8 Uart_Transmit_func(UINT8* Uart_Read_Msg,UINT8* Uart_Recv_Buffer)
             break;
         }
     }
-    // #ifdef USING_PRINTF
-    //     printf("Uart_Rece_buffer1: ");
-    //     for(int i=0;i<Data_Len;i++)
-    //     {
-    //     printf("%x ",*(Uart_Recv_Buffer+i));
-    //     }
-    // #endif
+    #ifdef USING_PRINTF
+        printf("Uart_Rece_buffer: ");
+        for(int i=0;i<Data_Len;i++)
+        {
+        printf("%x ",*(Uart_Recv_Buffer+i));
+        }
+    #endif
     if (isRecvComplete == true)
     {
         isRecvComplete = false;