Jelajahi Sumber

TMS故障暂时屏蔽

陈杰 2 tahun lalu
induk
melakukan
55a1fd9cf7
1 mengubah file dengan 24 tambahan dan 3 penghapusan
  1. 24 3
      System/Vehicle/Communication/CANNet.c

+ 24 - 3
System/Vehicle/Communication/CANNet.c

@@ -125,11 +125,11 @@ void CANNet_RecvMsgCAN1(MCANDrv_infoMsgS_TYPE infoMsgS)
 	memcpy(infoBmsSendMsg.CanData,infoMsgS.datMsgUBA,8);
 	BmsSendFlg = TRUE;
 	CANNet_infoMsgTxConfSA[0].infoMsgIDUI = infoBmsSendMsg.CanID;
-
-	if((infoBmsSendMsg.CanID==0x1880D0F3)&& 1)//主负继电器状态和主正一起发出
+	static uint8 TmsErrorFltTemp = 0;
+	if((infoBmsSendMsg.CanID==0x1880D0F3)&& 1)//主负继电器状态和主正一起发出  加TMS故障屏蔽
 	{
 		uint8 DataTemp = 0x00;
-		if(((infoBmsSendMsg.CanData[1]>>4)&0x03)==0x02)
+		if(((infoBmsSendMsg.CanData[1]>>4)&0x03)==0x02)//主负继电器状态和主正一起发出
 		{
 			DataTemp = infoBmsSendMsg.CanData[1]&0x3F;
 			DataTemp = DataTemp|((0x02)<<6);
@@ -141,6 +141,27 @@ void CANNet_RecvMsgCAN1(MCANDrv_infoMsgS_TYPE infoMsgS)
 			DataTemp = DataTemp|((0x01)<<6);
 			infoBmsSendMsg.CanData[1] = DataTemp;
 		}
+		if(infoBmsSendMsg.CanData[7]==93)//TMS故障屏蔽
+		{
+			TmsErrorFltTemp = 1;
+			clrbit(infoBmsSendMsg.CanData[4],6);
+			infoBmsSendMsg.CanData[7] = 0;
+		}
+	}
+	if((infoBmsSendMsg.CanID==0x1881D0F3)&& TmsErrorFltTemp)//屏蔽Tms出现的故障等级
+	{
+		uint8 chk = 0;
+		uint8 ErrNum = 0;
+		clrbit(infoBmsSendMsg.CanData[2],5);
+		clrbit(infoBmsSendMsg.CanData[2],6);
+		ErrNum = (infoBmsSendMsg.CanData[7]>>3);
+		ErrNum = (ErrNum-1)<=0?0:(ErrNum-1);
+		infoBmsSendMsg.CanData[7] = (infoBmsSendMsg.CanData[7]&0x03)|(ErrNum<<3);
+		for(uint8 i=1;i<8;i++)
+		{
+			chk = chk^infoBmsSendMsg.CanData[i];
+		}
+		infoVcuSendMsg.CanData[0] = chk;
 	}
 
 	infoMsgS.infoConfS = CANNet_infoMsgTxConfSA[0];