소스 검색

1.增加了主负继电器延迟发送代码(已开启)
2.增加了EBC强制BMS上电代码(未开启)
华菱整车已可进入Ready状态,此版本为可用版本

陈杰 2 년 전
부모
커밋
5802231ad0

+ 6 - 0
System/Vehicle/Communication/BleCanProtocolFunc.c

@@ -930,6 +930,12 @@ void Uds_Service(uint8 *Data)
                 UdsPosAns(UdsAns);
                 break;
             }
+            case 0x04:
+            {
+            	BattHvCtl = *(Data + 2);
+            	UdsPosAns(UdsAns);
+            	break;
+            }
             default:
                 UdsNegAns(UdsAns);
                 break;

+ 38 - 6
System/Vehicle/Communication/CANNet.c

@@ -95,12 +95,27 @@ void CANNet_RecvMsgCAN0(MCANDrv_infoMsgS_TYPE infoMsgS)
 	infoVcuSendMsg.CanID = infoMsgS.infoConfS.infoMsgIDUI;
 	memcpy(infoVcuSendMsg.CanData,infoMsgS.datMsgUBA,8);
 	VcuSendFlg = TRUE;
+	if((infoVcuSendMsg.CanID&0x0000FFFF)==0x0000F3D0||(infoVcuSendMsg.CanID&0x0000FFFF)==0x000015F6||(infoVcuSendMsg.CanID&0x0000FFFF)==0x000051ED)
+	{
+		CANNet_infoMsgTxConfSA[1].infoMsgIDUI = infoVcuSendMsg.CanID;
+		infoMsgS.infoConfS = CANNet_infoMsgTxConfSA[1];
+		memset(infoMsgS.datMsgUBA, 0x00, 8);
+		if((infoVcuSendMsg.CanID==0x1802F3D0)&& 0)
+		{
+			static uint8 VcuLife = 0;
+			uint8 chk = 0;
+			VcuLife = (VcuLife+1)>14?0:(VcuLife+1);
+			infoVcuSendMsg.CanData[1] = (BattHvCtl<<4)|(VcuLife&0x0F);
+			for(uint8 i=1;i<8;i++)
+			{
+				chk = chk^infoVcuSendMsg.CanData[i];
+			}
+			infoVcuSendMsg.CanData[0] = chk;
+		}
+		memcpy(infoMsgS.datMsgUBA,infoVcuSendMsg.CanData,8);
+		MCANDrv_SendMsg(infoMsgS);
+	}
 
-	CANNet_infoMsgTxConfSA[1].infoMsgIDUI = infoVcuSendMsg.CanID;
-	infoMsgS.infoConfS = CANNet_infoMsgTxConfSA[1];
-	memset(infoMsgS.datMsgUBA, 0x00, 8);
-	memcpy(infoMsgS.datMsgUBA,infoVcuSendMsg.CanData,8);
-	MCANDrv_SendMsg(infoMsgS);
 }
 // CAN1接收消息处理函数
 void CANNet_RecvMsgCAN1(MCANDrv_infoMsgS_TYPE infoMsgS)
@@ -109,8 +124,25 @@ void CANNet_RecvMsgCAN1(MCANDrv_infoMsgS_TYPE infoMsgS)
 	infoBmsSendMsg.CanID = infoMsgS.infoConfS.infoMsgIDUI;
 	memcpy(infoBmsSendMsg.CanData,infoMsgS.datMsgUBA,8);
 	BmsSendFlg = TRUE;
-
 	CANNet_infoMsgTxConfSA[0].infoMsgIDUI = infoBmsSendMsg.CanID;
+
+	if((infoBmsSendMsg.CanID==0x1880D0F3)&& 1)//主负继电器状态和主正一起发出
+	{
+		uint8 DataTemp = 0x00;
+		if(((infoBmsSendMsg.CanData[1]>>4)&0x03)==0x02)
+		{
+			DataTemp = infoBmsSendMsg.CanData[1]&0x3F;
+			DataTemp = DataTemp|((0x02)<<6);
+			infoBmsSendMsg.CanData[1] = DataTemp;
+		}
+		else
+		{
+			DataTemp = infoBmsSendMsg.CanData[1]&0x3F;
+			DataTemp = DataTemp|((0x01)<<6);
+			infoBmsSendMsg.CanData[1] = DataTemp;
+		}
+	}
+
 	infoMsgS.infoConfS = CANNet_infoMsgTxConfSA[0];
 	memset(infoMsgS.datMsgUBA, 0x00, 8);
 	memcpy(infoMsgS.datMsgUBA,infoBmsSendMsg.CanData,8);

+ 1 - 1
System/Vehicle/Communication/CanVar.c

@@ -387,7 +387,7 @@ uint8 m_flg_HVlock2 = 0;			 //
 uint16 Test_LockPressure = 0;		 //锁紧力测试
 uint8 ebcd_flg_ebcManCtrlEn = 0;	 // EBC手动控制使能
 uint8 ebcd_flg_ebcManCtrlMode = 0;	 // EBC手动控制模式
-
+uint8 BattHvCtl = 0;
 #define EEPDATA_START_SEC_VAR
 #include "MemMap.h"
 uint16 ebcd_Nr_swapBatt;	//换电次数

+ 4 - 0
System/Vehicle/Communication/CanVar.h

@@ -363,6 +363,10 @@ extern uint8 ebdc_st_ConnecState;		//
 extern uint8 m_flg_HVlock1;				//互锁状态1
 extern uint8 m_flg_HVlock2;				//互锁状态2
 extern uint16 Test_LockPressure;
+extern uint8 BattHvCtl;
+
+
+
 #define EEPDATA_START_SEC_VAR
 #include "MemMap.h"
 extern uint16 ebcd_Nr_swapBatt;		  //换电次数