Browse Source

增加换电程序控制(ready未识别)

CHENJIE-PC\QiXiang_CHENJIE 2 years ago
parent
commit
3796e8bb96

+ 20 - 11
System/Vehicle/AppFunc.c

@@ -58,22 +58,22 @@ void LockAndUnlockCtrl()
 			CtrlFlg = Unlock;
 			CtrlFlg = Unlock;
 		}
 		}
 	}
 	}
-	else //正常工作模式,暂时为空
+	else //正常工作模式
 	{
 	{
 		switch(ebcd_st_ebcWork)
 		switch(ebcd_st_ebcWork)
 		{
 		{
-		case 0://行车状态,自动进入,默认状态
+		case DriveMode://行车状态,自动进入,默认状态
 		{
 		{
 			PSwtDrv_Interface(_PSWT_INDEX_EBCLEDCONTROL,0);//行车状态换电指示灯关闭
 			PSwtDrv_Interface(_PSWT_INDEX_EBCLEDCONTROL,0);//行车状态换电指示灯关闭
 			if(bled_flg_handShake==1)
 			if(bled_flg_handShake==1)
 			{
 			{
-				ebcd_st_ebcWork = 1;
+				ebcd_st_ebcWork = CommuMode;//进入通讯状态
 				bled_flg_handShake = 0;
 				bled_flg_handShake = 0;
 				break;
 				break;
 			}
 			}
 			break;
 			break;
 		}
 		}
-		case 1://通讯状态,握手才能进入
+		case CommuMode://通讯状态,握手才能进入
 		{
 		{
 			BleConCounter = BleConCounter + 10;
 			BleConCounter = BleConCounter + 10;
 			if((BleConCounter%1000)<500)//换电指示灯闪烁
 			if((BleConCounter%1000)<500)//换电指示灯闪烁
@@ -87,16 +87,15 @@ void LockAndUnlockCtrl()
 
 
 			if(BleConCounter>=60*1000||bled_flg_backToDrv == 1)
 			if(BleConCounter>=60*1000||bled_flg_backToDrv == 1)
 			{
 			{
-				ebcd_st_ebcWork = 0;//切换到行车状态
+				ebcd_st_ebcWork = DriveMode;//切换到行车状态
 				BleConCounter = 0;
 				BleConCounter = 0;
 				bled_flg_backToDrv = 0;
 				bled_flg_backToDrv = 0;
 				break;
 				break;
 			}
 			}
-			else if(BattCD_stWakeupU.B.bLogic==0&&(bled_flg_toSwapMod==1 || BattCD_stWakeupU.B.bWkpSig1==1))
+			else if(BattCD_stWakeupU.B.bLogic==0 && BattCD_stWakeupU.B.bWkpSig1==1)
 			{
 			{
-				ebcd_st_ebcWork = 2;//切换到换电状态
+				ebcd_st_ebcWork = SwapMode;//切换到换电状态
 				BleConCounter = 0;
 				BleConCounter = 0;
-				bled_flg_toSwapMod = 0;
 				break;
 				break;
 			}
 			}
 			if(bled_st_dataTrans==1)
 			if(bled_st_dataTrans==1)
@@ -106,19 +105,19 @@ void LockAndUnlockCtrl()
 			}
 			}
 			break;
 			break;
 		}
 		}
-		case 2://换电状态
+		case SwapMode://换电状态
 		{
 		{
 			PSwtDrv_Interface(_PSWT_INDEX_EBCLEDCONTROL,1);//换电状态换电指示灯常亮
 			PSwtDrv_Interface(_PSWT_INDEX_EBCLEDCONTROL,1);//换电状态换电指示灯常亮
 			battSwpeModeCounter = battSwpeModeCounter + 10;
 			battSwpeModeCounter = battSwpeModeCounter + 10;
 			if(bled_flg_swapBattDone==1)
 			if(bled_flg_swapBattDone==1)
 			{
 			{
 				bled_flg_swapBattDone = 0;
 				bled_flg_swapBattDone = 0;
-				ebcd_st_ebcWork = 1; //切换到通讯状态
+				ebcd_st_ebcWork = CommuMode; //切换到通讯状态
 				break;
 				break;
 			}
 			}
 			else if(battSwpeModeCounter>=60*1000)
 			else if(battSwpeModeCounter>=60*1000)
 			{
 			{
-				battSwpeModeCounter = 0;//切换到行车状态
+				battSwpeModeCounter = DriveMode;//切换到行车状态
 				ebcd_st_ebcWork = 0;
 				ebcd_st_ebcWork = 0;
 				break;
 				break;
 			}
 			}
@@ -127,6 +126,16 @@ void LockAndUnlockCtrl()
 				battSwpeModeCounter = 0;
 				battSwpeModeCounter = 0;
 				bled_st_dataTrans = 0;
 				bled_st_dataTrans = 0;
 			}
 			}
+			if(bled_flg_unlockCmdForce)
+			{
+				CtrlFlg = Unlock;
+				bled_flg_unlockCmdForce = 0;
+			}
+			if(bled_flg_lockCmdForce)
+			{
+				CtrlFlg = Lock;
+				bled_flg_lockCmdForce = 0;
+			}
 			break;
 			break;
 		}
 		}
 		}
 		}

+ 1 - 0
System/Vehicle/AppFunc.h

@@ -21,6 +21,7 @@ void GetDIOState(void);
 void GetAIOValue(void);
 void GetAIOValue(void);
 void LockAndUnlockCtrl();
 void LockAndUnlockCtrl();
 uint16 Look1_u32u8(uint32 u0, uint32 *bp0, uint8 *table, uint16 MaxLen);
 uint16 Look1_u32u8(uint32 u0, uint32 *bp0, uint8 *table, uint16 MaxLen);
+
 #ifdef _APP_TEST_CODE
 #ifdef _APP_TEST_CODE
 void TestDeviceFun(void);
 void TestDeviceFun(void);
 #endif
 #endif

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

@@ -709,7 +709,7 @@ uint8 ebcd_flg_LockErr = 0;			 //
 uint8 ebcd_flg_dChrgLockErr = 0;	 //放电互锁故障状态
 uint8 ebcd_flg_dChrgLockErr = 0;	 //放电互锁故障状态
 uint8 ebcd_flg_chrgLockErr = 0;		 //充电互锁故障状态
 uint8 ebcd_flg_chrgLockErr = 0;		 //充电互锁故障状态
 uint8 ebcd_flg_dChgCnctOverTemp = 0; //放电连接器过温标志
 uint8 ebcd_flg_dChgCnctOverTemp = 0; //放电连接器过温标志
-uint8 ebcd_st_ebcWork = 0;			 // Ebc当前状态 0-行车,1-通讯(握手才进入通讯状态),2-换电
+uint8 ebcd_st_ebcWork = DriveMode;	 // Ebc当前状态 0-行车,1-通讯(握手才进入通讯状态),2-换电
 uint8 ebcd_Nr_errMax;				 //故障等级:当前故障最大等级
 uint8 ebcd_Nr_errMax;				 //故障等级:当前故障最大等级
 uint8 ebcd_Num_faultCode;			 // ebc故障码,未定义
 uint8 ebcd_Num_faultCode;			 // ebc故障码,未定义
 uint8 ebcd_st_chargingMod;			 //充电模式,1-车载充电,2-换电站充电
 uint8 ebcd_st_chargingMod;			 //充电模式,1-车载充电,2-换电站充电

+ 6 - 1
System/Vehicle/Communication/CanVar.h

@@ -542,6 +542,12 @@ extern uint8 bled_flg_bleConn;            // ble
 extern uint8 bled_flg_bleDisconn;         // ble蓝牙断开状态
 extern uint8 bled_flg_bleDisconn;         // ble蓝牙断开状态
 extern uint8 bled_st_dataTrans;			  //蓝牙数据传输状态
 extern uint8 bled_st_dataTrans;			  //蓝牙数据传输状态
 //正式变量
 //正式变量
+typedef enum
+{
+	DriveMode = 0,
+	CommuMode = 1,
+	SwapMode = 2
+}WorkType;
 extern uint8 ebcd_flg_Can2SendEnbale;
 extern uint8 ebcd_flg_Can2SendEnbale;
 extern uint8 ebcd_st_toBleAns;
 extern uint8 ebcd_st_toBleAns;
 extern uint8 ebcd_P_airSensor;
 extern uint8 ebcd_P_airSensor;
@@ -561,7 +567,6 @@ extern uint8 ebdc_st_ConnecState; //
 extern uint8 m_flg_HVlock1;//互锁状态1
 extern uint8 m_flg_HVlock1;//互锁状态1
 extern uint8 m_flg_HVlock2;//互锁状态2
 extern uint8 m_flg_HVlock2;//互锁状态2
 extern uint16 Test_LockPressure;
 extern uint16 Test_LockPressure;
-
 #define EEPDATA_START_SEC_VAR
 #define EEPDATA_START_SEC_VAR
 #include "MemMap.h"
 #include "MemMap.h"
 extern uint8 ebcd_flg_ebcManCtrlEn;		 // EBC手动控制使能
 extern uint8 ebcd_flg_ebcManCtrlEn;		 // EBC手动控制使能