Преглед на файлове

V0.2.1.9 加入观测量,取消高压上电判定再计算的前置条件,增加没有Keyon时降低调试信息,定位信息,整车信息的频率

LAPTOP-KB7QFH2U\ChenJie-PC преди 1 година
родител
ревизия
a082a17d76
променени са 3 файла, в които са добавени 46 реда и са изтрити 32 реда
  1. 1 1
      code/app/AppGlobalVar.c
  2. 31 27
      code/app/AppTaskCan.c
  3. 14 4
      code/app/AppTaskUart1.c

+ 1 - 1
code/app/AppGlobalVar.c

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

+ 31 - 27
code/app/AppTaskCan.c

@@ -76,7 +76,7 @@ static void CalAccAhFunc(void)//100ms运行一次
 	static float tmp_DischrgAh = 0;//mah
 	static float tmp_ChrgAh = 0;//mah
 //	if(BcuRxLongError[3]==0 && (BcuRxLongError[24]==1||BcuRxShortError[24]==1))//在CAN消息正常,CAN[24]存在时间长的问题,不建议用丢帧处理
-	if(BcuRxLongError[3]==0 && BMS_Mode==2)//海南协议为 0-高压下电,2-高压上电
+	if(BcuRxLongError[3]==0)//海南协议为 0-高压下电,2-高压上电
 	{
 		if(BMS_CharSt==1)//1是正在充电
 		{
@@ -280,18 +280,22 @@ void BcuDecodeFunction(uint32 ID, uint8 *rawData)
 		BcuRxFlag[12] = 0x01;
 		break;
 	case 0x18C1D0F3:
-		BMS_CellVoltFramNum = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF);
-		BMS_CSC_Code = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
-		if (BMS_CellVoltFramNum == 0 || BMS_CellVoltFramNum > 128)
 		{
-			break;
-		}
-		BMS_CellRecvCounter = (BMS_CellRecvCounter + 1) >= 128 ? 128 : (BMS_CellRecvCounter + 1);
-		for (UINT8 i = 0; i < 3; i++)
-		{
-			BMS_CellVolt[(BMS_CellVoltFramNum - 1) * 3 + i] = (UINT16)(((*(UINT8 *)(rawData + i * 2 + 2)) | (*(UINT8 *)(rawData + i * 2 + 3) << 8)) & 0xFFFF);
+			uint8 battCellTotalTemp = 0;
+			battCellTotalTemp = min(BMS_CellTotal, BMS_CELL_MAX_NUM)/3;
+			BMS_CellVoltFramNum = (UINT8)(((*(UINT8 *)(rawData + 0))) & 0xFF);
+			BMS_CSC_Code = (UINT8)(((*(UINT8 *)(rawData + 1))) & 0xFF);
+			if (BMS_CellVoltFramNum == 0 || BMS_CellVoltFramNum >battCellTotalTemp )
+			{
+				break;
+			}
+			BMS_CellRecvCounter = (BMS_CellRecvCounter + 1) >= battCellTotalTemp ? battCellTotalTemp : (BMS_CellRecvCounter + 1);
+			for (UINT8 i = 0; i < 3; i++)
+			{
+				BMS_CellVolt[(BMS_CellVoltFramNum - 1) * 3 + i] = (UINT16)(((*(UINT8 *)(rawData + i * 2 + 2)) | (*(UINT8 *)(rawData + i * 2 + 3) << 8)) & 0xFFFF);
+			}
+			BcuRxFlag[13] = 0x01;
 		}
-		BcuRxFlag[13] = 0x01;
 		break;
 	case 0x18C2D0F3:
 		{
@@ -1203,13 +1207,13 @@ void BcuRxMsgSetInvalidValue(uint32 ID)
 		break;
 	case 0x18E4D0F3:
 		BMS_Checksum = 0xFF;
-		BMS_SN[20] = 0xFF;
-		BMS_SN[21] = 0xFF;
-		BMS_SN[22] = 0xFF;
-		BMS_SN[23] = 0xFF;
-		BMS_SN[24] = 0xFF;
-		BMS_SN[25] = 0xFF;
-		BMS_SN[26] = 0xFF;
+//		BMS_SN[20] = 0xFF;
+//		BMS_SN[21] = 0xFF;
+//		BMS_SN[22] = 0xFF;
+//		BMS_SN[23] = 0xFF;
+//		BMS_SN[24] = 0xFF;
+//		BMS_SN[25] = 0xFF;
+//		BMS_SN[26] = 0xFF;
 		break;
 	case 0x18E5D0F3:
 		BMS_BattRateCap = 0xFFFF;
@@ -1220,24 +1224,24 @@ void BcuRxMsgSetInvalidValue(uint32 ID)
 		break;
 	case 0x18E6D0F3:
 		BMS_CSC_Total = 0xFF;
-		//		BMS_CellTotal = BMS_CELL_MAX_NUM;
-		//		BMS_TempTotal = BMS_TEMP_MAX_NUM;
+//		BMS_CellTotal = BMS_CELL_MAX_NUM;
+//		BMS_TempTotal = BMS_TEMP_MAX_NUM;
 		BMS_CellVoltLevel = 0xFF;
 		BMS_CellMinVolt = 0xFF;
 		BMS_CellMaxVolt = 0xFF;
 		break;
 	case 0x18F1D0F3:
-		BMS_TotalCharEngy = 0xFFFFFFFF;
-		BMS_TotalDisCharEngy = 0xFFFFFFFF;
-		BMS_SingleCharEngy = 0xFFFF;
+//		BMS_TotalCharEngy = 0xFFFFFFFF;
+//		BMS_TotalDisCharEngy = 0xFFFFFFFF;
+//		BMS_SingleCharEngy = 0xFFFF;
 		break;
 	case 0x18F2D0F3:
-		BMS_TotalBackCharEngy = 0xFFFFFFFF;
-		BMS_TotalStaCharEngy = 0xFFFFFFFF;
+//		BMS_TotalBackCharEngy = 0xFFFFFFFF;
+//		BMS_TotalStaCharEngy = 0xFFFFFFFF;
 		break;
 	case 0x18F3D0F3:
-		BMS_TotalGunCharEngy = 0xFFFFFFFF;
-		BMS_TotalGunCharCapy = 0xFFFFFFFF;
+//		BMS_TotalGunCharEngy = 0xFFFFFFFF;
+//		BMS_TotalGunCharCapy = 0xFFFFFFFF;
 		break;
 	case 0x18F4D0F3:
 //		BMS_TotalCharCapy = 0xFFFFFFFF;

+ 14 - 4
code/app/AppTaskUart1.c

@@ -265,7 +265,17 @@ static void TcpDataSendFeqHandFunc(uint8* DataIdx)
 		TcpDataFeq.GpsFeqCnt[1] = 60;
 		TcpDataFeq.TrkBattFeqCnt[1]  = 60;
 	}
-
+	TcpDataFeq.DebugMsgFeqCnt[1] = TcpDataFeq.TrkBattFeqCnt[1];
+	//读取硬线唤醒源状态,若没有硬线唤醒,则降低调试信息发送频率
+	Dio_LevelType wakeup1,wakeup2 = STD_HIGH;
+	wakeup1 = Dio_ReadChannel(DioConf_DioChannel_PTB0_GPIO_IN_MCU_WAKEUP1);
+	wakeup2 = Dio_ReadChannel(DioConf_DioChannel_PTE2_GPIO_IN_MCU_WAKEUP2);
+	if(wakeup1==STD_LOW && wakeup2==STD_LOW)
+	{
+		TcpDataFeq.DebugMsgFeqCnt[1] = 10*60;
+		TcpDataFeq.TrkVehichleFeqCnt[1] = 10*60;
+		TcpDataFeq.GpsFeqCnt[1] = 3*60;
+	}
 	return;
 }
 sint8 TcpDataSendFunc(sint8 ConnectId,uint8 DataSendIdxIn)
@@ -967,7 +977,7 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
 								{%.2f,%.2f,%.2f,%.2f,%.2f;\
 								%.2f,%.2f,%.2f,%.2f,%.2f,}\
 								{%.2f,%.2f,%.2f,%.2f,%.2f;\
-								%.2f,%.2f,%.2f,%.2f,%.2f,},%s,%d--%d,%d,%d",
+								%.2f,%.2f,%.2f,%.2f,%.2f,},%s,%d-M-%d,P-%d,N-%d,C-%d,A-%d",
 				returnFreq[0][0], returnFreq[0][1], returnFreq[0][2], returnFreq[0][3], returnFreq[0][4],
 				returnP[0][0], returnP[0][1], returnP[0][2], returnP[0][3], returnP[0][4],
 
@@ -976,7 +986,7 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
 
 				returnFreq[2][0], returnFreq[2][1], returnFreq[2][2], returnFreq[2][3], returnFreq[2][4],
 				returnP[2][0], returnP[2][1], returnP[2][2], returnP[2][3], returnP[2][4],tmp,DeviceErrNum,
-				BMS_Mode,BMS_StPosRly,BMS_StNegRly);
+				BMS_Mode,BMS_StPosRly,BMS_StNegRly,BMS_CharSt,BMS_PackCurr-10000);
 
 		BufferLen = strlen((const char *)rbuf);
 		*SendLen = BufferLen + sizeof(DebugMsgInfo);
@@ -1078,7 +1088,7 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
 	}
 	case 0x91:
 	{
-		if(BMS_CellRecvCounter<128)
+		if(BMS_CellRecvCounter<min(BMS_CellTotal, BMS_CELL_MAX_NUM)/3)
 		{
 			*SendLen = 0; // 不发送,长度为0
 			return;