Przeglądaj źródła

V0.2.1.7-电池温度改为单包6个

LAPTOP-KB7QFH2U\ChenJie-PC 1 rok temu
rodzic
commit
3d98280d9e
2 zmienionych plików z 10 dodań i 6 usunięć
  1. 1 1
      code/app/AppGlobalVar.c
  2. 9 5
      code/app/AppTaskCan.c

+ 1 - 1
code/app/AppGlobalVar.c

@@ -35,7 +35,7 @@ uint16 WebSitePort = 8812;
 #endif
 
 //*全局变量*//
-const uint32 AppSwVersion = 0x00020006;
+const uint32 AppSwVersion = 0x00020107;
 const uint8 DataModuleType = 0x02; // 01=NB,02-4G
 const uint16 HwVersion = 0x0102;
 const uint32 BlSwVersion = 0x00000002;

+ 9 - 5
code/app/AppTaskCan.c

@@ -294,14 +294,17 @@ void BcuDecodeFunction(uint32 ID, uint8 *rawData)
 		BcuRxFlag[13] = 0x01;
 		break;
 	case 0x18C2D0F3:
+		{
+		uint8 tempType = 6;
+		uint8 csc_maxCode = 10;
+		uint8 tempCount = 0,offvalue = 0;
 		BMS_CellTempFramNum = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF);
 		BMS_CSC_Code = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
-		if (BMS_CSC_Code == 0 || BMS_CSC_Code > 8)
+		if (BMS_CSC_Code == 0 || BMS_CSC_Code > csc_maxCode)
 		{
 			break;
 		}
-		uint8 tempCount = 0,offvalue = 0;
-		if(BMS_CellTempFramNum%2==0)
+		if(BMS_CellTempFramNum%2==0 && tempType==8)
 		{
 			tempCount = 2;
 			offvalue = 6;
@@ -313,12 +316,13 @@ void BcuDecodeFunction(uint32 ID, uint8 *rawData)
 		}
 		for(uint8 i=0; i<tempCount; i++)
 		{
-			if (((BMS_CSC_Code - 1) * 8 + i + offvalue) < sizeof(BMS_CellTemp) && ((UINT8)(((*(UINT8 *)(rawData + 2 + i))) & 0xFF) >= 10))
+			if (((BMS_CSC_Code - 1) * tempType + i + offvalue) < sizeof(BMS_CellTemp) && ((UINT8)(((*(UINT8 *)(rawData + 2 + i))) & 0xFF) >= 10))
 			{
-				BMS_CellTemp[(BMS_CSC_Code - 1) * 8 + i + offvalue] = (UINT8)(((*(UINT8 *)(rawData + 2 + i))) & 0xFF)- 10;
+				BMS_CellTemp[(BMS_CSC_Code - 1) * tempType + i + offvalue] = (UINT8)(((*(UINT8 *)(rawData + 2 + i))) & 0xFF)- 10;
 			}
 		}
 		BcuRxFlag[14] = 0x01;
+		}
 		break;
 	case 0x18E1D0F3:
 		BMS_Checksum = 0;