提交 f7a88668 作者: 高增攀

编译通过,逻辑流程有待梳理

上级 4a89cb83
......@@ -2107,9 +2107,6 @@
<name>$PROJ_DIR$\..\Src\Drivers\Drv_Dht12.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Drivers\Drv_DtuUsr.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Drivers\Drv_E2rom.c</name>
</file>
<file>
......@@ -2295,18 +2292,69 @@
<group>
<name>Lcd</name>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_BmsInfor.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_BuildComm.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_CardPwd.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_CardSure.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_ChargeScreen.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_ChargeStop.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_ChargeSummary.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_CnctDetect.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_CommInfor.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_ElectLock.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_GetCard.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_LockCard.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_PillarError.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_PutBack.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_SwipeCard.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_BmsInfor.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_BuildComm.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_CardPwd.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_CardSure.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_ChargeScreen.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_ChargeStop.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_ChargeSummary.c</name>
</file>
<file>
......@@ -2331,18 +2379,39 @@
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_FactoryTestTwo.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_GetCard.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_LockCard.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_PillarError.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_PutBack.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_SwipeCard.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_BmsInfor.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_BuildComm.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_CardPwd.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_CardSure.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_ChargeScreen.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_ChargeStop.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_ChargeSummary.c</name>
</file>
<file>
......@@ -2385,12 +2454,18 @@
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_FactoryTestTwo.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_GetCard.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_InforChgRecdLog.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_InforLogClean.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_LockCard.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_MainMenu.c</name>
</file>
<file>
......@@ -2400,12 +2475,18 @@
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_ManageSelect.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_PillarError.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_PutBack.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_SelectDCModule.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_SetCard.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_SetEmployRate.c</name>
</file>
<file>
......@@ -2436,6 +2517,9 @@
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_SetRatio.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_SetReader.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_SetReboot.c</name>
</file>
<file>
......@@ -2453,6 +2537,12 @@
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_SetTimeRate.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_SingleChargeScreen.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_SwipeCard.c</name>
</file>
</group>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Thd_Charge.c</name>
......
......@@ -376,9 +376,6 @@
<name>$PROJ_DIR$\..\Src\Drivers\Drv_Dht12.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Drivers\Drv_DtuUsr.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Drivers\Drv_E2rom.c</name>
</file>
<file>
......@@ -564,18 +561,69 @@
<group>
<name>Lcd</name>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_BmsInfor.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_BuildComm.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_CardPwd.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_CardSure.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_ChargeScreen.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_ChargeStop.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_ChargeSummary.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_CnctDetect.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_CommInfor.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_ElectLock.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_GetCard.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_LockCard.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_PillarError.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_PutBack.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_AB_SwipeCard.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_BmsInfor.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_BuildComm.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_CardPwd.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_CardSure.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_ChargeScreen.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_ChargeStop.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_ChargeSummary.c</name>
</file>
<file>
......@@ -600,18 +648,39 @@
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_FactoryTestTwo.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_GetCard.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_LockCard.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_PillarError.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_PutBack.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_B_SwipeCard.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_BmsInfor.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_BuildComm.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_CardPwd.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_CardSure.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_ChargeScreen.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_ChargeStop.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_ChargeSummary.c</name>
</file>
<file>
......@@ -654,12 +723,18 @@
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_FactoryTestTwo.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_GetCard.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_InforChgRecdLog.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_InforLogClean.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_LockCard.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_MainMenu.c</name>
</file>
<file>
......@@ -669,12 +744,18 @@
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_ManageSelect.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_PillarError.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_PutBack.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_SelectDCModule.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_SetCard.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_SetEmployRate.c</name>
</file>
<file>
......@@ -705,6 +786,9 @@
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_SetRatio.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_SetReader.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_SetReboot.c</name>
</file>
<file>
......@@ -722,6 +806,12 @@
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_SetTimeRate.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_SingleChargeScreen.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Lcd\LcdPro_SwipeCard.c</name>
</file>
</group>
<file>
<name>$PROJ_DIR$\..\Src\Thread\Thd_Charge.c</name>
......
......@@ -307,6 +307,7 @@ extern void RunLedInit(void);
extern void RunLedSet(EnumSwitchStatus Set);
extern void ShortCirCheckSet(EnumSwitchStatus Set);
extern EnumSwitchStatus ACContactorGet(void);
extern EnumSwitchStatus ACContactorSta;
......
......@@ -68,6 +68,7 @@ typedef struct
}StructDcModuleCtrl;
extern StructDcModuleAbility DcModuleAbility;
extern void DcModuleCanInit_B(void);
extern StructDcModuleManage DcModuleManage;
extern StructDcModuleManage DcModuleManage_B;
......
......@@ -35,14 +35,14 @@ void TCURxIrqHandle(void)
{
CanRxMsg RxMsg;
u8 IrSta = 0;
u8 RecvFlag;
//u8 RecvFlag;
StructTCUSend Frame;
Union1939Id Id1939 = {.Mult = 0,};
IrSta = MCP2515_B_ReadStatus();
portBASE_TYPE taskWoken = pdFALSE;
if(IrSta & 0x01)
{
RecvFlag = MCP2515_B_Receive(0, &RxMsg);
MCP2515_B_Receive(0, &RxMsg);
MCP2515_B_BitModify(CANINTF, 0x01, 0x00);
if((CAN_ID_STD == RxMsg.IDE) || (CAN_RTR_REMOTE == RxMsg.RTR))
......@@ -76,27 +76,23 @@ void TCURxIrqHandle(void)
switch(Frame.Pgn)
{
case eCmd_start:// 充电启动帧
eCmd_stop:// 充电停止帧
eCmd_time:// 对时帧
eCmd_versi://版本校验帧
eCmd_param:// 下发充电参数信息帧
eCmd_SerCon:// 充电服务启停控制帧
eCmd_Gun:// 电子锁可控制帧
eCmd_power:// 功率调节控制帧
eCmd_Query:// 充电桩配置信息查询帧
eCmd_verificationAck:,//车辆验证应答帧
case eCmd_stop:// 充电停止帧
case eCmd_time:// 对时帧
case eCmd_versi://版本校验帧
case eCmd_param:// 下发充电参数信息帧
case eCmd_SerCon:// 充电服务启停控制帧
case eCmd_Gun:// 电子锁可控制帧
case eCmd_power:// 功率调节控制帧
case eCmd_Query:// 充电桩配置信息查询帧
case eCmd_verificationAck://车辆验证应答帧
////////////状态帧/////////////////
eCmd_startCompAck:// 充电启动完成应答帧
eCmd_stopCompAck:// 充电停止完成应答帧
case eCmd_startCompAck:// 充电启动完成应答帧
case eCmd_stopCompAck:// 充电停止完成应答帧
///////////数据帧/直流////////////
eCmd_DCTCUMeasu:// 计费单元遥测帧
case eCmd_DCTCUMeasu:// 计费单元遥测帧
///////////心跳帧///////////
eCmd_TcuHeart: // 计费单元心跳
eCmd_TCUErroComm: // 计费单元错误帧
REQ ://请求
ACK ://确认
TPCM ://传输协议--连接管理
TPDT://传输协议--数据传送
case eCmd_TcuHeart: // 计费单元心跳
case eCmd_TCUErroComm: // 计费单元错误帧
Frame.Prio = Id1939.Disp.Prio;
Frame.DP = Id1939.Disp.DP;
Frame.PF = Id1939.Disp.PF;
......@@ -112,11 +108,10 @@ void TCURxIrqHandle(void)
Frame.Data[5] = RxMsg.Data[5];
Frame.Data[6] = RxMsg.Data[6];
Frame.Data[7] = RxMsg.Data[7];
portBASE_TYPE taskWoken = pdFALSE;
if(pdTRUE == xQueueSendFromISR(TCUMsg, &Frame, &taskWoken))
portEND_SWITCHING_ISR(taskWoken);
break;
case ACK:
default:
break;
}
......@@ -125,7 +120,7 @@ void TCURxIrqHandle(void)
if(IrSta & 0x02)
{
RecvFlag = MCP2515_B_Receive(1, &RxMsg);
MCP2515_B_Receive(1, &RxMsg);
MCP2515_B_BitModify(CANINTF, 0x02, 0x00);
if((CAN_ID_STD == RxMsg.IDE) || (CAN_RTR_REMOTE == RxMsg.RTR))
return;
......@@ -157,27 +152,23 @@ void TCURxIrqHandle(void)
switch(Frame.Pgn)
{
eCmd_start:// 充电启动帧
eCmd_stop:// 充电停止帧
eCmd_time:// 对时帧
eCmd_versi://版本校验帧
eCmd_param:// 下发充电参数信息帧
eCmd_SerCon:// 充电服务启停控制帧
eCmd_Gun:// 电子锁可控制帧
eCmd_power:// 功率调节控制帧
eCmd_Query:// 充电桩配置信息查询帧
eCmd_verificationAck:,//车辆验证应答帧
case eCmd_start:// 充电启动帧
case eCmd_stop:// 充电停止帧
case eCmd_time:// 对时帧
case eCmd_versi://版本校验帧
case eCmd_param:// 下发充电参数信息帧
case eCmd_SerCon:// 充电服务启停控制帧
case eCmd_Gun:// 电子锁可控制帧
case eCmd_power:// 功率调节控制帧
case eCmd_Query:// 充电桩配置信息查询帧
case eCmd_verificationAck://车辆验证应答帧
////////////状态帧/////////////////
eCmd_startCompAck:// 充电启动完成应答帧
eCmd_stopCompAck:// 充电停止完成应答帧
case eCmd_startCompAck:// 充电启动完成应答帧
case eCmd_stopCompAck:// 充电停止完成应答帧
///////////数据帧/直流////////////
///////////心跳帧///////////
eCmd_TcuHeart: // 计费单元心跳
eCmd_TCUErroComm: // 计费单元错误帧
REQ ://请求
ACK ://确认
TPCM ://传输协议--连接管理
TPDT://传输协议--数据传送
case eCmd_TcuHeart: // 计费单元心跳
case eCmd_TCUErroComm: // 计费单元错误帧
Frame.Prio = Id1939.Disp.Prio;
Frame.DP = Id1939.Disp.DP;
Frame.PF = Id1939.Disp.PF;
......@@ -193,11 +184,9 @@ void TCURxIrqHandle(void)
Frame.Data[5] = RxMsg.Data[5];
Frame.Data[6] = RxMsg.Data[6];
Frame.Data[7] = RxMsg.Data[7];
portBASE_TYPE taskWoken = pdFALSE;
if(pdTRUE == xQueueSendFromISR(TCUMsg, &Frame, &taskWoken))
portEND_SWITCHING_ISR(taskWoken);
break;
case ACK:
default:
break;
}
......@@ -354,7 +343,7 @@ StructTCUCControl TCUControlInfo =
void TCUSinglePackSendMsg ( u8*pframe,u16 len,EnumTCUCommPgn cmd, u8 Prio )
{
StructChargeSend FrameSend;
u8 Reason = 0x00;
//u8 Reason = 0x00;
FrameSend.Id.Mult = 0;
FrameSend.Id.Disp.Prio =Prio ;
FrameSend.Id.Disp.PF = cmd>>8;
......@@ -384,14 +373,14 @@ void TCUMultiPackSendMsg(u8 *pfram ,u16 len,EnumTCUCommPgn cmd, u8 Prio)
FrameSend.Id.Disp.DA_PS =TCU1939Addr;
FrameSend.Id.Disp.SA =ChargerCont1939Addr;
u16 checkSum = 0;
for(i = 0; i++;i<len)
for(i = 0;i<len;i++)
{
checkSum + =pfram[i];
checkSum += pfram[i];
}
checkSum = checkSum+((len +3 + 2)/7 + 1);
checkSum = checkSum+(u8)len+(u8)(len>>8);
for(i =1; i++; i<((len +3 + 2)/7 + 1))//第一包
for(i =1; i<((len +3 + 2)/7 + 1);i++)//第一包
{
if(i==1)
{
......@@ -511,7 +500,7 @@ void StartMeg ( StructTCUSend* pPgnRecv )
// &&(TCUCurChgRecd_B.TCUChargeEnable !=0)
// )
{
TCUCurChgRecd_B.TCUChgStartNotetrl =1//充电阶段
TCUCurChgRecd_B.TCUChgStartNotetrl =1;//充电阶段
}
}
......@@ -526,7 +515,7 @@ u8 AllowDTUStartCharge(u8 *Reason )
*Reason = 0x02;
else if(TCUCommuStatus.VerChkVaild ==0)
*Reason = 0x03;
else if(TCUCommuStatus.ParamVaild = 0)
else if(TCUCommuStatus.ParamVaild == 0)
*Reason = 0x04;
else if(TCUControlInfo.ChargingServiceFlag==0x01)//服务暂停
*Reason = 0x05;
......@@ -546,12 +535,11 @@ u8 AllowDTUStartCharge(u8 *Reason )
*Reason = 0x0F;
else if((PillarError.Value.Insulation ==1)||(PillarError.Value.ImdDev ==1))
*Reason = 0x010;
return FALSE;
else if( ChargeStopType = eChgStop_PillarReady_BatVoltError)
else if( ChargeStopType == eChgStop_PillarReady_BatVoltError)
*Reason = 0x11;
else if((ChargeStopType ==eChgStop_Imd_BhmTimeOut)||(ChargeStopType ==eChgStop_ComBreak_CommError))
*Reason = 0x12;
else if( PillarError.Value.ACContactor = 1)
else if( PillarError.Value.ACContactor == 1)
*Reason = 0x13;
else if(PillarError.Value.Contactor)
*Reason = 0x17;
......@@ -566,11 +554,11 @@ u8 AllowDTUStartCharge(u8 *Reason )
else
{
*Reason =0x00;
TCUCurChgRecd.StarChgResult== 1;//成功
TCUCurChgRecd.StarChgResult = 1;//成功
return TRUE;
}
TCUCurChgRecd.StarChgResult== 2;//失败
TCUCurChgRecd.StarChgResult= 2;//失败
return FALSE ;
}
u8 AllowDTUStartCharge_B(u8 *Reason )
......@@ -583,7 +571,7 @@ u8 AllowDTUStartCharge_B(u8 *Reason )
*Reason = 0x03;
else if(TCUCommuStatus.ParamVaild ==0)
*Reason = 0x05;
else if(ChargeCtrl_B.CurProcess != eChgPro_ChgIdle;)
else if(ChargeCtrl_B.CurProcess != eChgPro_B_ChgIdle)
*Reason = 0x06;
else if(ChargePauseFlag_B==1)
*Reason = 0x07;
......@@ -599,11 +587,11 @@ u8 AllowDTUStartCharge_B(u8 *Reason )
*Reason = 0x0F;
else if((PillarError.Value.Insulation ==1)||(PillarError.Value.ImdDev ==1))
*Reason = 0x010;
else if( ChargeStopType_B= eChgStop_PillarReady_BatVoltError)
else if( ChargeStopType_B== eChgStop_PillarReady_BatVoltError)
*Reason = 0x11;
else if((ChargeStopType_B==eChgStop_Imd_BhmTimeOut)||(ChargeStopType ==eChgStop_ComBreak_CommError))
*Reason = 0x12;
else if( PillarError_B.Value.ACContactor = 1)
else if( PillarError_B.Value.ACContactor == 1)
*Reason = 0x13;
else if(PillarError_B.Value.Contactor)
*Reason = 0x17;
......@@ -618,11 +606,11 @@ u8 AllowDTUStartCharge_B(u8 *Reason )
else
{
*Reason =0x00;
TCUCurChgRecd_B.StarChgResult== 1;//成功
TCUCurChgRecd_B.StarChgResult= 1;//成功
return TRUE;
}
TCUCurChgRecd_B.StarChgResult== 2;//失败
TCUCurChgRecd_B.StarChgResult= 2;//失败
return FALSE ;
}
......@@ -678,15 +666,15 @@ u8 AllowDTUStartCompCharge(u8 *Reason )
*Reason = 0x04;
else if(PillarError.Value.SPD == 1)
*Reason = 0x05;
else if( PillarError.Value.ACContactor = 1)
else if( PillarError.Value.ACContactor == 1)
*Reason = 0x07;
else if( PillarError.Value.InVolt = 1)
else if( PillarError.Value.InVolt == 1)
*Reason = 0x0A;
else if(PillarError.Value.EleLock ==1)
*Reason = 0x0D;
else if((PillarError.Value.Insulation ==1)||(PillarError.Value.ImdDev ==1))
*Reason = 0x0E;
else if( ChargeStopType = eChgStop_PillarReady_BatVoltError)
else if( ChargeStopType == eChgStop_PillarReady_BatVoltError)
*Reason = 0x0F;
else if(PillarError.Value.Contactor)
*Reason = 0x11;
......@@ -716,7 +704,7 @@ u8 AllowDTUStartCompCharge(u8 *Reason )
*Reason = 0x27;
else if((CemMsg.Cem.Value.Bro!=0)||(ChargeStopType!=0))
*Reason = 0x28;
else if((VerificaInfo.result=1)&&(StartMeg_A.PlugToChgFlag==1))
else if((VerificaInfo.result==1)&&(StartMeg_A.PlugToChgFlag==1))
*Reason = 0x29;
else if(TCUCommuStatus.ErrData.Value.verificationAck==1)
*Reason = 0x30;
......@@ -742,15 +730,15 @@ u8 AllowDTUStartCompCharge_B(u8 *Reason )
*Reason = 0x04;
else if(PillarError_B.Value.SPD == 1)
*Reason = 0x05;
else if( PillarError_B.Value.ACContactor = 1)
else if( PillarError_B.Value.ACContactor == 1)
*Reason = 0x07;
else if( PillarError_B.Value.InVolt = 1)
else if( PillarError_B.Value.InVolt == 1)
*Reason = 0x0A;
else if(PillarError_B.Value.EleLock ==1)
*Reason = 0x0D;
else if((PillarError_B.Value.Insulation ==1)||(PillarError_B.Value.ImdDev ==1))
*Reason = 0x0E;
else if( ChargeStopType_B = eChgStop_PillarReady_BatVoltError)
else if( ChargeStopType_B == eChgStop_PillarReady_BatVoltError)
*Reason = 0x0F;
else if(PillarError_B.Value.Contactor)
*Reason = 0x11;
......@@ -774,13 +762,13 @@ u8 AllowDTUStartCompCharge_B(u8 *Reason )
*Reason = 0x1E;
else if( CemMsg_B.Cem.Value.Brm==1)
*Reason = 0x22;
else if(CemMsg.Cem_B.Value.Bcp==1)
else if(CemMsg_B.Cem.Value.Bcp==1)
*Reason = 0x24;
else if(CemMsg.Cem_B.Value.Bro==1)
else if(CemMsg_B.Cem.Value.Bro==1)
*Reason = 0x27;
else if((CemMsg_B.Cem.Value.Bro!=0)||(ChargeStopType!=0))
*Reason = 0x28;
else if((VerificaInfo_B.result=1)&&(StartMeg_B.PlugToChgFlag==1))
else if((VerificaInfo_B.result==1)&&(StartMeg_B.PlugToChgFlag==1))
*Reason = 0x29;
else if(TCUCommuStatus.ErrData_B.Value.verificationAck==1)
*Reason = 0x30;
......@@ -806,31 +794,31 @@ void startCompSend_A(void)
else
Data[len++] =0x00;
Data[len++]==reason;
Data[len++]=reason;
Data[len++]==0x01;
Data[len++]==0x01;
Data[len++]==0x00;//2015
Data[len++]=0x01;
Data[len++]=0x01;
Data[len++]=0x00;//2015
if(ChgVer == eChgVer_2011)
{
Data[len++]==0x01;
Data[len++]==0x00;
Data[len++]==0x00;
Data[len++]=0x01;
Data[len++]=0x00;
Data[len++]=0x00;
}
else
{
Data[len++]==0x01;
Data[len++]==0x01;
Data[len++]==0x00;
Data[len++]=0x01;
Data[len++]=0x01;
Data[len++]=0x00;
}
if(ChgVer == eChgVer_2011)
Data[len++] ==0x01;
Data[len++] =0x01;
else
Data[len++] ==0x00;
Data[len++] =0x00;
Data[len++] == BrmMsg.BatType;
Data[len++] == BcpMsg.MaxTemp;
Data[len++] = BrmMsg.BatType;
Data[len++] = BcpMsg.MaxTemp;
Data[len++] = (u8)(BcpMsg.ChgMaxVolt>>0);//最高允许充电电压 BIN码 2
Data[len++] = (u8)(BcpMsg.ChgMaxVolt>>8);
......@@ -851,15 +839,15 @@ void startCompSend_A(void)
Data[len++] = (u8)(BcpMsg.StartSoc>>0);// BIN码 2
Data[len++] = (u8)(BcpMsg.StartSoc>>8);//当前荷电状态
Data[len++] = 0x4C// BIN码 2
Data[len++] = 0x4C;// BIN码 2
Data[len++] = 0x1D;//最高输出电压 750
Data[len++] = 0xB8// BIN码 2
Data[len++] = 0xB8;// BIN码 2
Data[len++] = 0x0B;//最低输出电压300
Data[len++] = 0xDC// BIN码 2
Data[len++] = 0xDC;// BIN码 2
Data[len++] = 0x05;// 最大输出电流
Data[len++] = 0xa0// BIN码 2
Data[len++] = 0xa0;// BIN码 2
Data[len++] = 0x0F;//最小输出电流0A
memcpy(&Data[len], BrmMsg.Vin, 17);//车辆识别码 BIN码 17
len += 17;
......@@ -880,31 +868,31 @@ void startCompSend_B(void)
else
Data[len++] =0x00;
Data[len++]==reason;
Data[len++]=reason;
Data[len++]==0x01;
Data[len++]==0x01;
Data[len++]==0x00;//2015
Data[len++]=0x01;
Data[len++]=0x01;
Data[len++]=0x00;//2015
if(ChgVer_B== eChgVer_2011)
{
Data[len++]==0x01;
Data[len++]==0x00;
Data[len++]==0x00;
Data[len++]=0x01;
Data[len++]=0x00;
Data[len++]=0x00;
}
else
{
Data[len++]==0x01;
Data[len++]==0x01;
Data[len++]==0x00;
Data[len++]=0x01;
Data[len++]=0x01;
Data[len++]=0x00;
}
if(ChgVer_B== eChgVer_2011)
Data[len++] ==0x01;
Data[len++] =0x01;
else
Data[len++] ==0x00;
Data[len++] =0x00;
Data[len++] == BrmMsg_B.BatType;
Data[len++] == BcpMsg_B.MaxTemp;
Data[len++] = BrmMsg_B.BatType;
Data[len++] = BcpMsg_B.MaxTemp;
Data[len++] = (u8)(BcpMsg.ChgMaxVolt>>0);//最高允许充电电压 BIN码 2
Data[len++] = (u8)(BcpMsg.ChgMaxVolt>>8);
......@@ -925,15 +913,15 @@ void startCompSend_B(void)
Data[len++] = (u8)(BcpMsg_B.StartSoc>>0);// BIN码 2
Data[len++] = (u8)(BcpMsg_B.StartSoc>>8);//当前荷电状态
Data[len++] = 0x4C// BIN码 2
Data[len++] = 0x4C;// BIN码 2
Data[len++] = 0x1D;//最高输出电压 750
Data[len++] = 0xB8// BIN码 2
Data[len++] = 0xB8;// BIN码 2
Data[len++] = 0x0B;//最低输出电压300
Data[len++] = 0xDC// BIN码 2
Data[len++] = 0xDC;// BIN码 2
Data[len++] = 0x05;// 最大输出电流
Data[len++] = 0xa0// BIN码 2
Data[len++] = 0xa0;// BIN码 2
Data[len++] = 0x0F;//最小输出电流0A
memcpy(&Data[len], BrmMsg_B.Vin, 17);//车辆识别码 BIN码 17
len += 17;
......@@ -1018,7 +1006,7 @@ void GetStopReason_A(u8* stopReason)
*stopReason = 02;
else if(TCUCurChgRecd.TCUChgStopType ==3)
*stopReason = 03;
else else if(TCUCommuStatus.ErrData.ValuestartCompAck ==1)
else if(TCUCommuStatus.ErrData.Value.startCompAck ==1)
*stopReason = 0x04;
else if(ChargeStopType == eChgStop_Run_CcOpen)
*stopReason = 0x05;//控制导引超时//充电过程中充电导引枪连接
......@@ -1052,33 +1040,33 @@ void GetStopReason_A(u8* stopReason)
*stopReason = 0x1F;
else if(CemMsg.Cem.Value.Bcs==1)
*stopReason = 0x20;
else if(CemMsg.Cem.Value.Bsm==1)
*stopReason = 0x21;
//else if(CemMsg.Cem.Value.Bsm==1)
// *stopReason = 0x21;
else if(BsmMsg.BatSta.Value.Volt ==0x01)
*stopReason = 0x22;
else if(BsmMsg.BatSta.Value.Volt ==0x02)
*stopReason = 0x23;
else if(BsmMsg.BatSta.Value.Soc ==0x01)
*stopReason = 0x24;
else if(BsmMsg.BatSta.Value.Soc ==0x02)
*stopReason = 0x25;
else if(BsmMsg.BatSta.Value.Currt ==0x01)
*stopReason = 0x26;
else if(BsmMsg.BatSta.Value.Temp ==0x01)
*stopReason = 0x27;
else if(BsmMsg.ChgSta.Imd ==0x01)
else if(BsmMsg.ChgSta.Value.Imd ==0x01)
*stopReason = 0x28;
else if(BsmMsg.ChgSta.Connect ==0x01)
else if(BsmMsg.ChgSta.Value.Connect ==0x01)
*stopReason = 0x29;
else if(
(BstMsg.StopReason.NeedSoc==0x01)
||(BstMsg.StopReason.SetVolt==0x01)
||(BstMsg.StopReason.PerSetVolt==0x01)
(BstMsg.StopReason.Value.NeedSoc==0x01)
||(BstMsg.StopReason.Value.SetVolt==0x01)
||(BstMsg.StopReason.Value.PerSetVolt==0x01)
)
*stopReason = 0x2A;
else if((BstMsg.StopTruble.Value ! = 0)
||((BstMsg.StopFault&0x0F) != 0))
)
else if( (BstMsg.StopTruble.Mult != 0)||((BstMsg.StopFault.Mult&0x0F) != 0))
*stopReason = 0x2B;
else if(ChargeCtrl.CurProcess == eChgPro_ChgBreak)
*stopReason = 0x2D;
......@@ -1096,7 +1084,7 @@ void GetStopReason_B(u8* stopReason)
*stopReason = 02;
else if(TCUCurChgRecd_B.TCUChgStopType ==3)
*stopReason = 03;
else else if(TCUCommuStatus.ErrData_B.ValuestartCompAck ==1)
else if(TCUCommuStatus.ErrData_B.Value.startCompAck ==1)
*stopReason = 0x04;
else if(ChargeStopType_B == eChgStop_Run_CcOpen)
*stopReason = 0x05;//控制导引超时//充电过程中充电导引枪连接
......@@ -1130,8 +1118,8 @@ void GetStopReason_B(u8* stopReason)
*stopReason = 0x1F;
else if(CemMsg_B.Cem.Value.Bcs==1)
*stopReason = 0x20;
else if(CemMsg_B.Cem.Value.Bsm==1)
*stopReason = 0x21;
//else if(CemMsg_B.Cem.Value.Bsm==1)
// *stopReason = 0x21;
else if(BsmMsg_B.BatSta.Value.Volt ==0x01)
*stopReason = 0x22;
else if(BsmMsg_B.BatSta.Value.Volt ==0x02)
......@@ -1144,21 +1132,22 @@ void GetStopReason_B(u8* stopReason)
*stopReason = 0x26;
else if(BsmMsg_B.BatSta.Value.Temp ==0x01)
*stopReason = 0x27;
else if(BsmMsg_B.ChgSta.Imd ==0x01)
else if(BsmMsg_B.ChgSta.Value.Imd ==0x01)
*stopReason = 0x28;
else if(BsmMsg_B.ChgSta.Connect ==0x01)
else if(BsmMsg_B.ChgSta.Value.Connect ==0x01)
*stopReason = 0x29;
else if(
(BstMsg_B.StopReason.NeedSoc==0x01)
||(BstMsg_B.StopReason.SetVolt==0x01)
||(BstMsg_B.StopReason.PerSetVolt==0x01)
(BstMsg_B.StopReason.Value.NeedSoc==0x01)
||(BstMsg_B.StopReason.Value.SetVolt==0x01)
||(BstMsg_B.StopReason.Value.PerSetVolt==0x01)
)
*stopReason = 0x2A;
else if((BstMsg_B.StopTruble.Value ! = 0)
||((BstMsg_B.StopFault&0x0F) != 0))
else if(
(BstMsg_B.StopTruble.Mult != 0)
||((BstMsg_B.StopFault.Mult&0x0F) != 0)
)
*stopReason = 0x2B;
else if(ChargeCtrl_B.CurProcess == eChgPro_ChgBreak)
else if(ChargeCtrl_B.CurProcess == eChgPro_B_ChgBreak)
*stopReason = 0x2D;
else
*stopReason = 0x2c;
......@@ -1173,21 +1162,23 @@ void stopCompSend_A(void)
u8 Data[64];
u8 len = 0;
u8 reason;
u8 temp = 0;
Data[len++]==0x01;
Data[len++]=0x01;
GetStopReason_A(&reason);
Data[len++]= reason;//成功标识
Data[len++] = 00;
Data[len++]= BstMsg.StopReason;
Data[len++]= BstMsg.StopTruble;
Data[len++]= BstMsg.StopFault;
Data[len++]= BstMsg.StopReason.Mult;
Data[len++]= BstMsg.StopTruble.Mult;
Data[len++]= BstMsg.StopTruble.Mult>>8;
Data[len++]= BstMsg.StopFault.Mult;
Data[len++]= BsdMsg.StopSOC;
Data[len++]= BsdMsg.PerMinVolt;
Data[len++]= BsdMsg.PerMinVolt>>8;
Data[len++]= BsdMsg.PerMaxVolt;
Data[len++]= BsdMsg.PerMaxVolt>>8;
Data[len++]= BsdMsg.MinTemp;
Data[len++]= BsdMsg.MaxTemp;
Data[len++]= CemMsg.Cem
Data[len++]= CemMsg.Cem.Mult;
Data[len++]= BsdMsg.MaxTemp;
Data[len++]=BemMsg.Bem.Value.Crm_00
+(BemMsg.Bem.Value.Crm_AA<<2)
......@@ -1203,9 +1194,9 @@ void stopCompSend_A(void)
+(CemMsg.Cem.Value.Brm<<4)
+((CemMsg.Cem.Value.Bcp)<<6);
Data[len++] =((CemMsg.Cem.Value.Bro)<<0)
+((CemMsg.Cem.Value.Bcs)<<2);
+((CemMsg.Cem.Value.Bcs)<<2)
+(( CemMsg.Cem.Value.Bcl)<<4)
+((CemMsg.Cem.Value.Bst)<<6)
+((CemMsg.Cem.Value.Bst)<<6);
Data[len++] = CemMsg.Cem.Value.Bsd
+((0x3F&CemMsg.Cem.Value.Other)<<2);
TCUMultiPackSendMsg(Data,len,eCmd_stopComp, 4);//多包传输
......@@ -1215,21 +1206,23 @@ void stopCompSend_B(void)
u8 Data[64];
u8 len = 0;
u8 reason;
u8 temp = 0;
Data[len++]==0x01;
Data[len++]=0x01;
GetStopReason_B(&reason);
Data[len++]== reason;
Data[len++]= reason;
Data[len++] = 00;//成功标识
Data[len++]= BstMsg_B.StopReason;
Data[len++]= BstMsg_B.StopTruble;
Data[len++]= BstMsg_B.StopFault;
Data[len++]= BstMsg_B.StopReason.Mult;
Data[len++]= BstMsg_B.StopTruble.Mult;
Data[len++]= BstMsg_B.StopTruble.Mult>>8;
Data[len++]= BstMsg_B.StopFault.Mult;
Data[len++]= BsdMsg_B.StopSOC;
Data[len++]= BsdMsg_B.PerMinVolt;
Data[len++]= BsdMsg_B.PerMinVolt>>8;
Data[len++]= BsdMsg_B.PerMaxVolt;
Data[len++]= BsdMsg_B.PerMaxVolt>>8;
Data[len++]= BsdMsg_B.MinTemp;
Data[len++]= BsdMsg_B.MaxTemp;
Data[len++]= CemMsg_B.Cem
Data[len++]= CemMsg_B.Cem.Mult;
Data[len++]= BsdMsg_B.MaxTemp;
Data[len++]=BemMsg_B.Bem.Value.Crm_00
......@@ -1246,9 +1239,9 @@ void stopCompSend_B(void)
+(CemMsg_B.Cem.Value.Brm<<4)
+((CemMsg_B.Cem.Value.Bcp)<<6);
Data[len++] =((CemMsg_B.Cem.Value.Bro)<<0)
+((CemMsg_B.Cem.Value.Bcs)<<2);
+((CemMsg_B.Cem.Value.Bcs)<<2)
+(( CemMsg_B.Cem.Value.Bcl)<<4)
+((CemMsg_B.Cem.Value.Bst)<<6)
+((CemMsg_B.Cem.Value.Bst)<<6);
Data[len++] = CemMsg_B.Cem.Value.Bsd
+((0x3F&CemMsg_B.Cem.Value.Other)<<2);
......@@ -1316,7 +1309,7 @@ void AckTCUHeartBeat(StructTCUSend* pPgnRecv)
{
TCUCommuStatus.ConnectFlag= 0;
TCUCommuStatus.HeartBeatVaild =0;
memset(TCUCommuStatus,0,sizeof(TCUCommuStatus));//通讯失败通讯初始化
memset(&TCUCommuStatus,0,sizeof(TCUCommuStatus));//通讯失败通讯初始化
}
}
void TCUtimeSet(StructTCUSend* pPgnRecv)
......@@ -1328,7 +1321,7 @@ void TCUtimeSet(StructTCUSend* pPgnRecv)
TCUCommuStatus.TimeRecvTime = GetSystemTick();
TCUCommuStatus.CommStage = TimeStage;
memcpy(time,pPgnRecv->Data[1],7);
memcpy(time,&pPgnRecv->Data[1],7);
TimeBlock.Year = time->year + 2000;
TimeBlock.Mon = time->month;
TimeBlock.Day = time->mday;
......@@ -1348,13 +1341,13 @@ void TCUtimeSetAck(void)
Data[0] = TCUCommuStatus.ChgNum;
StampToTime(RtcGetTime(), &Time);
time->Year = Time.Year-2000;
time->year = Time.Year-2000;
time->month= Time.Mon;
time->mday = Time.Day;
time->hour = Time.Hour;
time->min = Time.Min;
time->msec =(((u16)Time.Sec)*1000);
memcpy(Data[1],time,7);
memcpy(&Data[1],time,7);
TCUSinglePackSendMsg(Data,8,eCmd_timeAck,6);
}
void TCUVersionCheck(StructTCUSend* pPgnRecv)
......@@ -1388,7 +1381,7 @@ void TCUParam(StructTCUSend* pPgnRecv)
{
TCUCommuStatus.ChgNum = pPgnRecv->Data[0];
TCUCommuStatus.CommStage = ChageParamStage;
memcpy(TCUControlInfo.ChargeNum,pPgnRecv->Data[0],8)
memcpy(TCUControlInfo.ChargeNum,&pPgnRecv->Data[0],8);
TCUCommuStatus.ParamRecvTime = GetSystemTick();
TCUCommuStatus.ParamSentTime= 0;//参数发送初始化
}
......@@ -1429,11 +1422,11 @@ void SerConAckAnalysis(StructTCUSend* pPgnRecv)
TCUCommuStatus.ServiceContralVaildValue= 1;//数据合法性校验失败
else if((TCUCommuStatus.ConnectFlag ==0)||(TCUCommuStatus.HeartBeatVaild))
TCUCommuStatus.ServiceContralVaildValue= 2;//通讯超时
else if(TCUControlInfo.VerChkVaild==0)
else if(TCUCommuStatus.VerChkVaild==0)
TCUCommuStatus.ServiceContralVaildValue= 3;//版本校验未完成
else if(TCUCommuStatus.ParamVaild==0)
TCUCommuStatus.ServiceContralVaildValue= 4;//参数下发为未完成
else if((CurChgRecd.RecordValid ==1)||(CurChgRecd_B.RecordValid ==1))
else if((TCUCurChgRecd.TCUChargeEnable==1)||(TCUCurChgRecd_B.TCUChargeEnable==1))
TCUCommuStatus.ServiceContralVaildValue= 05;
else
TCUCommuStatus.ServiceContralVaildValue=0;
......@@ -1451,7 +1444,7 @@ void SerConAck(void)
Data[1] = TCUCommuStatus.ChargingServiceSetValue;
if(TCUCommuStatus.ServiceContralVaildValue==0)
{
Data[2] = 00;//成功 v
Data[2] = 00;//成功
Data[3] = 00;//成功
}
else
......@@ -1477,11 +1470,11 @@ void ElectControlAnalysis(StructTCUSend* pPgnRecv)
TCUCommuStatus.ElectLockVaildValue= 1;//数据合法性校验失败
else if((TCUCommuStatus.ConnectFlag ==0)||(TCUCommuStatus.HeartBeatVaild))
TCUCommuStatus.ElectLockVaildValue= 2;//通讯超时
else if(TCUControlInfo.VerChkVaild==0)
else if(TCUCommuStatus.VerChkVaild==0)
TCUCommuStatus.ElectLockVaildValue= 3;//版本校验未完成
else if(TCUCommuStatus.ParamVaild==0)
TCUCommuStatus.ElectLockVaildValue = 4;//参数下发为未完成
else if((CurChgRecd.RecordValid ==1)||(CurChgRecd_B.RecordValid ==1))
else if((TCUCurChgRecd.TCUChargeEnable ==1)||(TCUCurChgRecd_B.TCUChargeEnable ==1))
TCUCommuStatus.ElectLockVaildValue= 05;
else if(PillarError.Value.EleLock ==1)
TCUCommuStatus.ElectLockVaildValue= 07;//电子锁故障
......@@ -1522,6 +1515,7 @@ void ElectControlAck(void)
if(TCUCommuStatus.ElectLockVaildValue==0)
{
Data[2] = 00;//成功
Data[3] = 00;//成功
}
else
......@@ -1550,7 +1544,7 @@ void PowerControlAnalysis(StructTCUSend* pPgnRecv)
else
{
TCUCommuStatus.PowerControlVaildValue= 0;//数据合法性校验成功
if(pPgnRecv->[0]==01)//a枪
if(pPgnRecv->Data[0]==01)//a枪
{
TCUControlInfo.PowerControl_A.ControlType =pPgnRecv->Data[1];
if(pPgnRecv->Data[1]==01)
......@@ -1562,7 +1556,7 @@ void PowerControlAnalysis(StructTCUSend* pPgnRecv)
TCUControlInfo.PowerControl_A.Percentage = pPgnRecv->Data[3];
}
}
else if(pPgnRecv->[0]==02)//b枪
else if(pPgnRecv->Data[0]==02)//b枪
{
TCUControlInfo.PowerControl_B.ControlType =pPgnRecv->Data[1];
if(pPgnRecv->Data[1]==01)
......@@ -1613,7 +1607,7 @@ void InformationReporting_22_A (void)
u8 Data[128] ={0};
Data[0] = 0x01;
if((ChargeCtrl.CurProcess == eChgPro_ChgIdle)&&(CurChgRecd.RecordValid==0))
if((ChargeCtrl.CurProcess == eChgPro_ChgIdle)&&(TCUCurChgRecd.TCUChargeEnable==0))
{
InformainReport_A.InfRe.workStau=0x00;
}
......@@ -1621,7 +1615,7 @@ void InformationReporting_22_A (void)
{
InformainReport_A.InfRe.workStau=0x01;
}
else if((ChargeCtrl.CurProcess == eChgPro_ChgIdle)&&(CurChgRecd.RecordValid==1))
else if((ChargeCtrl.CurProcess == eChgPro_ChgIdle)&&(TCUCurChgRecd.TCUChargeEnable==1))
{
InformainReport_A.InfRe.workStau=0x02;
}
......@@ -1633,14 +1627,14 @@ void InformationReporting_22_A (void)
InformainReport_A.InfRe.Emergency = PillarError.Value.Emergency ==1;
InformainReport_A.InfRe.smoke =0x00;
InformainReport_A.InfRe.AccContac = 0x00;
InformainReport_A.InfRe.DCOutConn =PillarError.Value.Contactor;
InformainReport_A.InfRe.DCOutConOff =PillarError.Value.Contactor;
InformainReport_A.InfRe.DCFuse =00;
InformainReport_A.InfRe.EleLock = PillarError.Value.EleLock;
InformainReport_A.InfRe.Fan = 00;
InformainReport_A.InfRe.SPD =PillarError.Value.SPD;
InformainReport_A.InfRe.ImdDev =PillarError.Value.ImdDev;
if((ChargeStopType== eChgStop_PillarReady_BatVoltError)&&(CurChgRecd.RecordValid==1))
if((ChargeStopType== eChgStop_PillarReady_BatVoltError)&&(TCUCurChgRecd.TCUChargeEnable==1))
InformainReport_A.InfRe.BattPola =01;
else
InformainReport_A.InfRe.BattPola =0;
......@@ -1648,29 +1642,28 @@ void InformationReporting_22_A (void)
InformainReport_A.InfRe.tempOver =0;
if((BstMsg.StopTruble.Value.ComponentTemp ==0x01)&&(CurChgRecd.RecordValid==1))
if((BstMsg.StopTruble.Value.ComponentTemp ==0x01)&&(TCUCurChgRecd.TCUChargeEnable==1))
InformainReport_A.InfRe.ConnTemp = 0x01;
else
InformainReport_A.InfRe.ConnTemp = 0x00;
InformainReport_A.InfRe.PutBack =PillarError.Value.PutBack;
if(
(
(BemMsg.Bem.Value.Crm_00!=0)
||(BemMsg.Bem.Value.Crm_00!=0)
||(BemMsg.Bem.Value.Crm_AA!=0)
||(BemMsg.Bem.Value.Cml_Cts!=0)
||(BemMsg.Bem.Value.Cro!=0)
||(BemMsg.Bem.Value.Ccs!=0)
||(BemMsg.Bem.Value.Csd!=0)
||(CemMsg.Cem.Value.Brm!=0)
||(CemMsg.Cem.Value.Bcp!=0)
||(CemMsg.Cem.Value.Bro!=0)
||(CemMsg.Cem.Value.Bcs!=0)
||(CemMsg.Cem.Value.Bcl!=0)
||(CemMsg.Cem.Value.Bst!=0)
||(CemMsg.Cem.Value.Bsd!=0)
(0 != BemMsg.Bem.Value.Crm_00)
||(0!=BemMsg.Bem.Value.Crm_AA)
||(0!=BemMsg.Bem.Value.Cml_Cts)
||(0!=BemMsg.Bem.Value.Cro)
||(0!=BemMsg.Bem.Value.Ccs)
||(0!=BemMsg.Bem.Value.Csd)
||(0!=CemMsg.Cem.Value.Brm)
||(0!=CemMsg.Cem.Value.Bcp)
||(0!=CemMsg.Cem.Value.Bro)
||(0!=CemMsg.Cem.Value.Bcs)
||(0!=CemMsg.Cem.Value.Bcl)
||(0!=CemMsg.Cem.Value.Bst)
||(0!=CemMsg.Cem.Value.Bsd)
)
&&(CurChgRecd.RecordValid==1)
&&(TCUCurChgRecd.TCUChargeEnable==1)
)
InformainReport_A.InfRe.BMSComm = 01;
else
......@@ -1679,14 +1672,14 @@ void InformationReporting_22_A (void)
InformainReport_A.InfRe.InVoltHi =00;
InformainReport_A.InfRe.InVoltlo =00;
if((ChargeStopType==eChgStop_Run_VoltOutHighErr)
&&(CurChgRecd.RecordValid==1)
&&(TCUCurChgRecd.TCUChargeEnable==1)
)
InformainReport_A.InfRe.DcVolHi =01;
else
InformainReport_A.InfRe.DcVolHi =0;
if((ChargeStopType==eChgStop_Run_CurrtOutHighErr)
&&(CurChgRecd.RecordValid==1)
&&(TCUCurChgRecd.TCUChargeEnable==1)
)
InformainReport_A.InfRe.DCCurrHi =01;
else
......@@ -1733,7 +1726,7 @@ void InformationReporting_22_A (void)
InformainReport_A.InfRe.sumWarm =01;
else
InformainReport_A.InfRe.sumWarm =00;
memcpy(Data[1],InformainReport_A.data,5);
memcpy(&Data[1],InformainReport_A.data,5);
Data[6] = 0;
Data[7] = 0;
TCUSinglePackSendMsg(Data,8,eCmd_DCConInfor1,4);
......@@ -1744,19 +1737,19 @@ void InformationReporting_22_B (void)
u8 Data[128] ={0};
Data[0] = 0x02;
if((ChargeCtrl_B.CurProcess == eChgPro_ChgIdle)&&(CurChgRecd_B.RecordValid==0))
if((ChargeCtrl_B.CurProcess == eChgPro_B_ChgIdle)&&(TCUCurChgRecd_B.TCUChargeEnable==0))
{
InformainReport_B.InfRe.workStau=0x00;
}
else if((ChargeCtrl_B.CurProcess != eChgPro_ChgIdle)&&(ChargePauseFlag_B!=1))
else if((ChargeCtrl_B.CurProcess != eChgPro_B_ChgIdle)&&(ChargePauseFlag_B!=1))
{
InformainReport_B.InfRe.workStau=0x01;
}
else if((ChargeCtrl_B.CurProcess == eChgPro_ChgIdle)&&(CurChgRecd_B.RecordValid==1))
else if((ChargeCtrl_B.CurProcess == eChgPro_B_ChgIdle)&&(TCUCurChgRecd_B.TCUChargeEnable==1))
{
InformainReport_B.InfRe.workStau=0x02;
}
else if((ChargeCtrl_B.CurProcess != eChgPro_ChgIdle)&&(ChargePauseFlag_B==1))
else if((ChargeCtrl_B.CurProcess != eChgPro_B_ChgIdle)&&(ChargePauseFlag_B==1))
{
InformainReport_B.InfRe.workStau=0x03;
}
......@@ -1764,43 +1757,42 @@ void InformationReporting_22_B (void)
InformainReport_B.InfRe.Emergency = PillarError_B.Value.Emergency ==1;
InformainReport_B.InfRe.smoke =0x00;
InformainReport_B.InfRe.AccContac = 0x00;
InformainReport_B.InfRe.DCOutConn =PillarError_B.Value.Contactor;
InformainReport_B.InfRe.DCOutConOff =PillarError_B.Value.Contactor;
InformainReport_B.InfRe.DCFuse =00;
InformainReport_B.InfRe.EleLock = PillarError_B.Value.EleLock;
InformainReport_B.InfRe.Fan = 00;
InformainReport_B.InfRe.SPD =PillarError_B.Value.SPD;
InformainReport_B.InfRe.ImdDev =PillarError_B.Value.ImdDev;
if((ChargeStopType_B== eChgStop_PillarReady_BatVoltError)&&(CurChgRecd_B.RecordValid==1))
if((ChargeStopType_B== eChgStop_PillarReady_BatVoltError)&&(TCUCurChgRecd_B.TCUChargeEnable==1))
InformainReport_B.InfRe.BattPola =01;
else
InformainReport_B.InfRe.BattPola =0;
InformainReport_B.InfRe.ContGuid =0;//控制导引
InformainReport_B.InfRe.tempOver =0;
if((BstMsg_B.StopTruble.Value.ComponentTemp ==0x01)&&(CurChgRecd_B.RecordValid==1))
if((BstMsg_B.StopTruble.Value.ComponentTemp ==0x01)&&(TCUCurChgRecd_B.TCUChargeEnable==1))
InformainReport_B.InfRe.ConnTemp = 0x01;
else
InformainReport_B.InfRe.ConnTemp = 0x00;
InformainReport_B.InfRe.PutBack =PillarError_B.Value.PutBack;
if(
(
(BemMsg_B.Bem.Value.Crm_00!=0)
||(BemMsg_B.Bem.Value.Crm_00!=0)
||(BemMsg_B.Bem.Value.Crm_AA!=0)
||(BemMsg_B.Bem.Value.Cml_Cts!=0)
||(BemMsg_B.Bem.Value.Cro!=0)
||(BemMsg_B.Bem.Value.Ccs!=0)
||(BemMsg_B.Bem.Value.Csd!=0)
||(CemMsg_B.Cem.Value.Brm!=0)
||(CemMsg_B.Cem.Value.Bcp!=0)
||(CemMsg_B.Cem.Value.Bro!=0)
||(CemMsg_B.Cem.Value.Bcs!=0)
||(CemMsg_B.Cem.Value.Bcl!=0)
||(CemMsg_B.Cem.Value.Bst!=0)
||(CemMsg_B.Cem.Value.Bsd!=0)
(0!= BemMsg_B.Bem.Value.Crm_00)
||(0!=BemMsg_B.Bem.Value.Crm_AA)
||(0!=BemMsg_B.Bem.Value.Cml_Cts)
||(0!=BemMsg_B.Bem.Value.Cro)
||(0!=BemMsg_B.Bem.Value.Ccs)
||(0!=BemMsg_B.Bem.Value.Csd)
||(0!=CemMsg_B.Cem.Value.Brm)
||(0!=CemMsg_B.Cem.Value.Bcp)
||(0!=CemMsg_B.Cem.Value.Bro)
||(0!=CemMsg_B.Cem.Value.Bcs)
||(0!=CemMsg_B.Cem.Value.Bcl)
||(0!=CemMsg_B.Cem.Value.Bst)
||(0!=CemMsg_B.Cem.Value.Bsd)
)
&&(CurChgRecd_B.RecordValid==1)
&&(TCUCurChgRecd_B.TCUChargeEnable ==1)
)
InformainReport_B.InfRe.BMSComm = 01;
else
......@@ -1809,14 +1801,14 @@ void InformationReporting_22_B (void)
InformainReport_B.InfRe.InVoltHi =00;
InformainReport_B.InfRe.InVoltlo =00;
if((ChargeStopType_B==eChgStop_Run_VoltOutHighErr)
&&(CurChgRecd_B.RecordValid==1)
&&(TCUCurChgRecd_B.TCUChargeEnable==1)
)
InformainReport_B.InfRe.DcVolHi =01;
else
InformainReport_B.InfRe.DcVolHi =0;
if((ChargeStopType_B==eChgStop_Run_CurrtOutHighErr)
&&(CurChgRecd_B.RecordValid==1)
&&(TCUCurChgRecd_B.TCUChargeEnable==1)
)
InformainReport_B.InfRe.DCCurrHi =01;
else
......@@ -1862,7 +1854,7 @@ void InformationReporting_22_B (void)
InformainReport_B.InfRe.sumWarm =0x01;
else
InformainReport_B.InfRe.sumWarm =0x00;
memcpy(Data[1],InformainReport_B.data,5);
memcpy(&Data[1],InformainReport_B.data,5);
Data[6] = 0;
Data[7] = 0;
TCUSinglePackSendMsg(Data,8,eCmd_DCConInfor1,4);
......@@ -1874,8 +1866,8 @@ void InformationReporting_23_A (void)
Data[0] = 0x01;
InformainReport2_A.InfRe.Door = PillarError.Value.Door;
InformainReport2_A.InfRe.DCOutConOn =0x01;
if(((ChargeError.Value.IsolateWarn == 1)||(ChargeError.ValueIsolateError == 1))
&&(CurChgRecd.RecordValid==1))
if(((ChargeError.Value.IsolateWarn == 1)||(ChargeError.Value.IsolateError == 1))
&&(TCUCurChgRecd.TCUChargeEnable==1))
InformainReport2_A.InfRe.ImdWarm= 0x01;
else
InformainReport2_A.InfRe.ImdWarm= 0x00;
......@@ -1894,12 +1886,11 @@ void InformationReporting_23_B(void)
{
u8 Data[64];
Data[0] = 0x02;
u8 Data[64];
Data[0] = 0x01;
InformainReport2_A.InfRe.Door = PillarError.Value.Door;
InformainReport2_A.InfRe.DCOutConOn =0x01;
if(((ChargeError.Value.IsolateWarn == 1)||(ChargeError.ValueIsolateError == 1))
&&(CurChgRecd.RecordValid==1))
if(((ChargeError.Value.IsolateWarn == 1)||(ChargeError.Value.IsolateError == 1))
&&(TCUCurChgRecd_B.TCUChargeEnable==1))
InformainReport2_A.InfRe.ImdWarm= 0x01;
else
InformainReport2_A.InfRe.ImdWarm= 0x00;
......@@ -1937,10 +1928,10 @@ void measuringReporting20_A(void)
Data[len++]= BclMsg.NeedCurrt;
Data[len++]= BclMsg.NeedCurrt>>8;
Data[len++]= BclMsg.ChgType;
Data[len++]= BclMsg.BcsMsg.ChgVolt;
Data[len++]= BclMsg.BcsMsg.ChgVolt>>8;//12V
Data[len++]= BcsMsg.BcsMsg.ChgCurrt;
Data[len++]= BcsMsg.BcsMsg.ChgCurrt>>8;
Data[len++]= BcsMsg.ChgVolt;
Data[len++]= BcsMsg.ChgVolt>>8;//12V
Data[len++]= BcsMsg.ChgCurrt;
Data[len++]= BcsMsg.ChgCurrt>>8;
Data[len++]= BcsMsg.RemainMin;
Data[len++]= Adc_Get_a_PTemp()+50;
......@@ -1972,10 +1963,10 @@ void measuringReporting20_B(void)
Data[len++]= BclMsg_B.NeedCurrt;
Data[len++]= BclMsg_B.NeedCurrt>>8;
Data[len++]= BclMsg_B.ChgType;
Data[len++]= BclMsg_B.BcsMsg.ChgVolt;
Data[len++]= BclMsg_B.BcsMsg.ChgVolt>>8;//12V
Data[len++]= BcsMsg_B.BcsMsg.ChgCurrt;
Data[len++]= BcsMsg_B.BcsMsg.ChgCurrt>>8;
Data[len++]= BcsMsg_B.ChgVolt;
Data[len++]= BcsMsg_B.ChgVolt>>8;//12V
Data[len++]= BcsMsg_B.ChgCurrt;
Data[len++]= BcsMsg_B.ChgCurrt>>8;
Data[len++]= BcsMsg_B.RemainMin;
Data[len++]= Adc_Get_a_PTemp()+50;
......@@ -1987,18 +1978,18 @@ void measuringReporting20_B(void)
void ChgInfornQueryAck(void)
{
u8 data[128];
u8 len;
u8 len = 0;
data[len++]=TCUCommuStatus.ChgNum;
memcpy(data[len],TCUControlInfo.ManufacturerCode,4);
memcpy(&data[len],TCUControlInfo.ManufacturerCode,4);
len+=4;
memcpy(data[len],TCUControlInfo.DeviceModel,2);
memcpy(&data[len],TCUControlInfo.DeviceModel,2);
len+=2;
memcpy(data[len],TCUControlInfo.HardwareVersion,2);
memcpy(&data[len],TCUControlInfo.HardwareVersion,2);
len+=2;
memcpy(data[len],TCUControlInfo.SoftwareVersion,2);
memcpy(&data[len],TCUControlInfo.SoftwareVersion,2);
len+=2;
memcpy(data[len],TCUControlInfo.SoftwareData,4);
memcpy(&data[len],TCUControlInfo.SoftwareData,4);
len+=4;
data[len++]=TCUControlInfo.BmsVersion;
......@@ -2016,30 +2007,30 @@ void ChgInfornQueryAck(void)
void verification(void)
{
u8 data[128];
u8 len;
u8 len = 0;
data[len++]=0x01;
memcpy(&data[len],BrmMsg.Vin,17);
len +=17;
memcpy(&data[len],BrmMsg.ChgCount,3);
memcpy(&data[len],&BrmMsg.ChgCount,3);
len +=3;
memcpy(&data[len],BcpMsg.StartSoc,2);
memcpy(&data[len],&BcpMsg.StartSoc,2);
len +=3;
memcpy(&data[len],BcpMsg.StartVolt,2);
memcpy(&data[len],&BcpMsg.StartVolt,2);
len +=2;
TCUMultiPackSendMsg(data,len,eCmd_verification,6);
}
void verification_B(void)
{
u8 data[128];
u8 len;
u8 len = 0;
data[len++]=0x02;
memcpy(&data[len],BrmMsg_B.Vin,17);
len +=17;
memcpy(&data[len],BrmMsg_B.ChgCount,3);
memcpy(&data[len],&BrmMsg_B.ChgCount,3);
len +=3;
memcpy(&data[len],BcpMsg_B.StartSoc,2);
memcpy(&data[len],&BcpMsg_B.StartSoc,2);
len +=3;
memcpy(&data[len],BcpMsg_B.StartVolt,2);
memcpy(&data[len],&BcpMsg_B.StartVolt,2);
len +=2;
TCUMultiPackSendMsg(data,len,eCmd_verification,6);
......@@ -2057,27 +2048,27 @@ void verificationAck(StructTCUSend* pPgnRecv)
VerificaInfo_B.FailReason= pPgnRecv->Data[2];
}
}
void TcuEMMsg( UnionConEM data)
void TcuEMMsg( u8 data)
{
u8 data[8];
data[0] = 0x01;
data[1] = data;
TCUSinglePackSendMsg(data,8,eCmd_ConErroComm,4);
u8 Data[8];
Data[0] = 0x01;
Data[1] =data;
TCUSinglePackSendMsg(Data,8,eCmd_ConErroComm,4);
}
void TcuEMMsg_B( UnionConEM data)
void TcuEMMsg_B( u8 data)
{
u8 data[8];
data[0] = 0x02;
data[1] = data;
TCUSinglePackSendMsg(data,8,eCmd_ConErroComm,4);
u8 Data[8];
Data[0] = 0x02;
Data[1] = data;
TCUSinglePackSendMsg(Data,8,eCmd_ConErroComm,4);
}
void TCUErroCommAnalysis(StructTCUSend* pPgnRecv)
{
if(pPgnRecv->Data[0]==1)
memcpy(&TCUChgContralTCUEM_A.tcuem,pPgnRecv->Data[1],2);
else if(pPgnRecv->Data[0] =2)
memcpy(&TCUChgContralTCUEM_B.tcuem,pPgnRecv->Data[1],2);
memcpy(&TCUChgContralTCUEM_A.tcuem,&pPgnRecv->Data[1],2);
else if(pPgnRecv->Data[0] ==2)
memcpy(&TCUChgContralTCUEM_B.tcuem,&pPgnRecv->Data[1],2);
}
......
......@@ -7,12 +7,14 @@
#include "Memory.h"
#include "Thd_TCU.h"
#include "Drv_MCP2515.h"
#include "Thd_TcuControl.h"
extern u8 TCUSendMsg(StructChargeSend *pMsg);
extern void TCUCanInit_B(void);
extern osMessageQId TCUMsg;
typedef struct
{
u8 ControlType;
......@@ -277,6 +279,8 @@ extern u8 TCUCommInit(void);
extern void StartMeg ( StructTCUSend* pPgnRecv );
extern void StartMegAck_A(void);
extern void StartMegAck_B(void);
extern void AckTCUHeartBeat(StructTCUSend* pPgnRecv);
extern void TCUParamAck(void);
extern void startCompSend_A(void);
extern void startCompSend_B(void);
......@@ -309,8 +313,9 @@ extern void measuringReporting20_B(void);
extern void ChgInfornQueryAck(void);
extern void verification(void);
extern void verificationAck(StructTCUSend* pPgnRecv);
void TcuEMMsg( UnionConEM data);
void TcuEMMsg_B( UnionConEM data);
extern void TcuEMMsg( u8 data);
extern void TcuEMMsg_B(u8 data);
extern void TCUParam(StructTCUSend* pPgnRecv);
extern StructStartMeg StartMeg_A ;
extern StructStartMeg StartMeg_B;
......
......@@ -15,6 +15,20 @@
#define AppCodeSize ((u32)250*1024)
#define McnRomSectionSize ((u32)2*1024)
#define UpdateFlagAddr ((u32)0x08002800)
typedef union
{
u8 Mult;
struct
{
u32 Idle : 1;//
u32 startCompAck :1;//
u32 stopCompAck: 1;//
u32 DCTCUInfor : 1;//
u32 DCTCUMeasu : 1;//
u32 Param : 1;//服务启停
u32 verificationAck : 1;//
}Value;
}UnionConEM;
#ifndef NULL
#define NULL ((void *)0)
......
......@@ -177,10 +177,6 @@ void Thd_Charge(void const *parameter)
osTimerDef(ChargeTimer, ChargeTimeCountCtrl);
ChargeTimer = osTimerCreate(osTimer(ChargeTimer), osTimerPeriodic, (void *)0);
osTimerStart(ChargeTimer, 1000);//һ
osThreadDef(Thd_TestQA, Thd_TestQA, osPriorityHigh, 0, configMINIMAL_STACK_SIZE);
osThreadCreate(osThread(Thd_TestQA), NULL);
osThreadDef(Thd_TestQB, Thd_TestQB, osPriorityHigh, 0, configMINIMAL_STACK_SIZE);
osThreadCreate(osThread(Thd_TestQB), NULL);
ChargeCtrl.CurProcess = eChgPro_ChgIdle;
ChargeCtrl.Param = 0;
......
......@@ -14,19 +14,26 @@
StructTCUCommuStatus TCUCommuStatus =
{
.ChgNum = 0;
.ChgNum = 0,
.CommStage= HeartStage,
.ParamVaild =0;
.ParamVaild =0,
0,
0
};
const StructTCUCommuParam TCUCommuParam =
{
.HeartPeriod = 1,
.HeartErrCntMax = 3,
.HeartTimeout = 1,
.SignInPeriod = 60,
};//后台通信参数
void TCURecvProcess(void)
{
StructTCUSend pPgnRecv;
if(pdTRUE != xQueueReceive(TCUMsg, pPgnRecv, 0))
if(pdTRUE != xQueueReceive(TCUMsg, &pPgnRecv, 0))
return;
switch(pPgnRecv.Pgn)
{
......@@ -55,12 +62,12 @@ void TCURecvProcess(void)
PowerControlAnalysis(&pPgnRecv);
break;
case eCmd_Query:// 充电桩配置信息查询帧
TCUCommuStatus.ChgNum = pPgnRecv->Data[0];
TCUCommuStatus.ChgNum = pPgnRecv.Data[0];
TCUCommuStatus.CommStage =ChgInfornQueryStage;
TCUCommuStatus.ChgInfornQueryRecvTime=GetSystemTick();
TCUCommuStatus.ChgInfornQuerySentTime = 0;
break;
case eCmd_verificationAck:,//车辆验证应答帧
case eCmd_verificationAck://车辆验证应答帧
verificationAck(&pPgnRecv);
break;
////////////状态帧/////////////////
......@@ -73,8 +80,6 @@ void TCURecvProcess(void)
///////////数据帧/直流////////////
case eCmd_DCTCUMeasu:// 计费单元遥测帧
break;
eCmd_DCTCUInfor:// 计费单元遥信帧
break;
///////////心跳帧///////////
case eCmd_TcuHeart: // 计费单元心跳
AckTCUHeartBeat(&pPgnRecv);//心跳解析
......@@ -119,12 +124,12 @@ void DCMeasuring_A(void)
{
if(0 == TCUCommuStatus.DCMeasuRecvTime)//遥测
{
if((GetSystemTick() - TCUCommuStatus.DCMeasuSendTime) > 1000))
if((GetSystemTick() - TCUCommuStatus.DCMeasuSendTime) > 1000)
{
TCUCommuStatus.DCMeasuErrCnt++;
if(TCUCommuStatus.DCMeasuErrCnt > 5)
{
memsect(TCUCommuStatus,0x00,sizeof(TCUCommuStatus));//通讯初始化
memset(&TCUCommuStatus,0x00,sizeof(TCUCommuStatus));//通讯初始化
TCUCommuStatus.ConnectFlag = 0;
TCUCommuStatus.HeartBeatErrCnt = 0;
TCUCommuStatus.HeartBeatVaild =0;//心跳失效
......@@ -152,12 +157,12 @@ void DCMeasuring_B(void)
{
if(0 == TCUCommuStatus.DCMeasuRecvTime_B)//遥测
{
if((GetSystemTick() - TCUCommuStatus.DCMeasuSendTime_B) > 1000))
if((GetSystemTick() - TCUCommuStatus.DCMeasuSendTime_B) > 1000)
{
TCUCommuStatus.DCMeasuErrCnt_B++;
if(TCUCommuStatus.DCMeasuErrCnt_B > 5)
{
memsect(TCUCommuStatus,0x00,sizeof(TCUCommuStatus));//通讯初始化
memset(&TCUCommuStatus,0x00,sizeof(TCUCommuStatus));//通讯初始化
TCUCommuStatus.ConnectFlag = 0;
TCUCommuStatus.HeartBeatErrCnt = 0;
TCUCommuStatus.HeartBeatVaild =0;//心跳失效
......@@ -191,7 +196,7 @@ void ConEMSend(void)
static u32 ConEMSendEcount_B = 0;
if(TCUCommuStatus.ConEMSendFlag ==1)
{
TcuEMMsg(TCUCommuStatus.ErrData.Value);//帧超时
TcuEMMsg(TCUCommuStatus.ErrData.Mult);//帧超时
ConEMSendTick =GetSystemTick();
TCUCommuStatus.ConEMSendFlag =2;
}
......@@ -202,7 +207,7 @@ void ConEMSend(void)
if(ConEMSendEcount < 20)
{
ConEMSendEcount++;
TcuEMMsg(TCUCommuStatus.ErrData.Value);
TcuEMMsg(TCUCommuStatus.ErrData.Mult);
}
else
{
......@@ -223,7 +228,7 @@ void ConEMSend(void)
}
if(TCUCommuStatus.ConEMSendFlag_B==1)
{
TcuEMMsg_B(TCUCommuStatus.ErrData_B.Value);//帧超时
TcuEMMsg_B(TCUCommuStatus.ErrData_B.Mult);//帧超时
ConEMSendTick_B = GetSystemTick();
TCUCommuStatus.ConEMSendFlag_B= 2;
}
......@@ -234,7 +239,7 @@ void ConEMSend(void)
if(ConEMSendEcount_B< 20)
{
ConEMSendEcount_B++;
TcuEMMsg_B(TCUCommuStatus.ErrData_B.Value);
TcuEMMsg_B(TCUCommuStatus.ErrData_B.Mult);
}
else
{
......@@ -301,7 +306,7 @@ void TCUPillarHeartBeat(void)
TCUCommuStatus.HeartBeatErrCnt++;
if(TCUCommuStatus.HeartBeatErrCnt > TCUCommuParam.HeartErrCntMax)
{
memsect(TCUCommuStatus,0x00,sizeof(TCUCommuStatus));//通讯初始化
memset(&TCUCommuStatus,0x00,sizeof(TCUCommuStatus));//通讯初始化
TCUCommuStatus.ConnectFlag = 0;
TCUCommuStatus.HeartBeatErrCnt = 0;
TCUCommuStatus.HeartBeatVaild =0;//心跳失效
......@@ -317,7 +322,7 @@ void TCUPillarHeartBeat(void)
}
else
{//心跳周期
SendTick = ((u32)CommuParam.HeartPeriod*1000);
SendTick = ((u32)TCUCommuParam.HeartPeriod*1000);
if((GetSystemTick() - TCUCommuStatus.HeartBeatSendTime) > SendTick)
{
......@@ -355,7 +360,7 @@ void TCUPillarHeartBeat_B(void)
}
else
{//心跳周期
SendTick = ((u32)CommuParam.HeartPeriod*1000);
SendTick = ((u32)TCUCommuParam.HeartPeriod*1000);
if((GetSystemTick() - TCUCommuStatus.HeartBeatSendTime_B) > SendTick)
{
......@@ -519,7 +524,7 @@ void TCUCurChgRecordInterface_A(void)
{
ChgStartSendTick = 0;
TCUCurChgRecd.TCUChgStartNotetrl =0;//停止发送
ChgStartSendEcount = 0
ChgStartSendEcount = 0;
}
}
}
......@@ -576,7 +581,7 @@ void TCUCurChgRecordInterface_A(void)
{
ChgStopSendTick = 0;
TCUCurChgRecd.TCUChgStopNotetrl =0;//停止发送
ChgStopSendEcount = 0
ChgStopSendEcount = 0;
}
}
}
......@@ -609,8 +614,9 @@ void TCUCurChgRecordInterface_A(void)
else if((TCUCurChgRecd.TCUChgStopCompNotetrl == 3)&&(0 != TCUCurChgRecd.TCUChargeEnable))
{
TCUCurChgRecd.TCUChgStopCompNotetrl = 0;//超时触发
TCUCommuStatus.TCUChargeEnable = 0;//归零
TCUCurChgRecd.TCUChargeEnable = 0;//归零
TCUCurChgRecd.TCUChgStopType = 0;
ChgRecordSendErr = 0;
}
}
......@@ -643,7 +649,7 @@ void TCUCurChgRecordInterface_B(void)
{
ChgStartSendTick = 0;
TCUCurChgRecd_B.TCUChgStartNotetrl =0;//停止发送
ChgStartSendEcount = 0
ChgStartSendEcount = 0;
}
}
}
......@@ -699,7 +705,7 @@ void TCUCurChgRecordInterface_B(void)
{
ChgStopSendTick = 0;
TCUCurChgRecd_B.TCUChgStopNotetrl =0;//停止发送
ChgStopSendEcount = 0
ChgStopSendEcount = 0;
}
}
}
......
......@@ -6,20 +6,6 @@
#include "Thd_TcuControl.h"
typedef union
{
u32 Mult;
struct
{
u32 Idle : 1;//
u32 startCompAck :1;//
u32 stopCompAck: 1;//
u32 DCTCUInfor : 1;//
u32 DCTCUMeasu : 1;//
u32 Param : 1;//服务启停
u32 verificationAck : 1;//
}Value;
}UnionConEM;
typedef enum
{
......@@ -107,13 +93,7 @@ typedef struct
}StructTCUCommuParam;
const StructTCUCommuParam TCUCommuParam =
{
.HeartPeriod = 1,
.HeartErrCntMax = 3,
.HeartTimeout = 1,
.SignInPeriod = 60,
};//后台通信参数
extern StructTCUCommuStatus TCUCommuStatus;
......
......@@ -8,39 +8,39 @@ StructTCUCtrl TCUCtrl;
StructTCUChgRecd TCUCurChgRecd = {0};
StructTCUChgRecd TCUCurChgRecd_B = {0};
EnumLcdProcess GetTCUProcess(EnumLcdProcess LcdPro)
EnumTCUProcess GetTCUProcess(EnumTCUProcess LcdPro)
{
static EnumLcdProcess historyLcdPro = eLcdPro_TCUMainMenu;
static EnumLcdProcess historyLcdPro_B = eLcdPro_TCUMainMenu;
EnumLcdProcess tempLcdProcess = eLcdPro_TCUMainMenu;
static EnumTCUProcess historyLcdPro = eLcdPro_TCUMainMenu;
static EnumTCUProcess historyLcdPro_B = eLcdPro_TCUMainMenu;
EnumTCUProcess tempLcdProcess = eLcdPro_TCUMainMenu;
tempLcdProcess = LcdPro;
switch(LcdPro)
{
case eLcdPro_TCUMainMenu:
if(eLcdPro_ChargeSummary == historyLcdPro)
if(eLcdPro_TCUChargeSummary == historyLcdPro)
{
historyLcdPro_B = eLcdPro_MainMenu;
tempLcdProcess = eLcdPro_ChargeSummary;
historyLcdPro_B = eLcdPro_TCUMainMenu;
tempLcdProcess = eLcdPro_TCUChargeSummary;
}
else if(eLcdPro_B_ChargeSummary == historyLcdPro_B)
else if(eLcdPro_TCUChargeSummary_B == historyLcdPro_B)
{
historyLcdPro = eLcdPro_MainMenu;
tempLcdProcess = eLcdPro_B_ChargeSummary;
historyLcdPro = eLcdPro_TCUMainMenu;
tempLcdProcess = eLcdPro_TCUChargeSummary_B;
}
else
{
historyLcdPro = eLcdPro_MainMenu;
historyLcdPro_B = eLcdPro_MainMenu;
tempLcdProcess = eLcdPro_MainMenu;
historyLcdPro = eLcdPro_TCUMainMenu;
historyLcdPro_B = eLcdPro_TCUMainMenu;
tempLcdProcess = eLcdPro_TCUMainMenu;
}
break;
case eLcdPro_ChargeSummary:
if(eLcdPro_B_ChargeSummary == historyLcdPro_B)
tempLcdProcess = eLcdPro_AB_ChargeSummary;
if(eLcdPro_TCUChargeSummary_B == historyLcdPro_B)
tempLcdProcess = eLcdPro_TCUChargeSummary_AB;
else
tempLcdProcess = eLcdPro_ChargeSummary;
tempLcdProcess = eLcdPro_TCUChargeSummary;
case eLcdPro_PutBack:
......@@ -48,10 +48,10 @@ EnumLcdProcess GetTCUProcess(EnumLcdProcess LcdPro)
break;
case eLcdPro_B_ChargeSummary:
if(eLcdPro_ChargeSummary == historyLcdPro)
tempLcdProcess = eLcdPro_AB_ChargeSummary;
if(eLcdPro_TCUChargeSummary == historyLcdPro)
tempLcdProcess = eLcdPro_TCUChargeSummary_AB;
else
tempLcdProcess = eLcdPro_B_ChargeSummary;
tempLcdProcess = eLcdPro_TCUChargeSummary_B;
case eLcdPro_B_PutBack:
......@@ -83,13 +83,13 @@ void TCUProPrstart(StructTCUCtrl *pLcdCtrl)
if(TCUCurChgRecd.StarChgResult== 1)//允许启动
{
TCUCurChgRecd.TCUChargeEnable = 1;
pLcdCtrl->CurScreen =eLcdPro_TCUBuildComm ;
TCUCurChgRecd.StarChgResult== 0;
pLcdCtrl->CurScreen =eLcdPro_TCUBuildComm;
TCUCurChgRecd.StarChgResult= 0;
}
else (TCUCurChgRecd.StarChgResult== 2)//启动失败
else if(TCUCurChgRecd.StarChgResult== 2)//启动失败
{
pLcdCtrl->CurScreen = GetTCUProcess(eLcdPro_TCUMainMenu);
TCUCurChgRecd.StarChgResult== 0;
TCUCurChgRecd.StarChgResult= 0;
}
if(eLcdPro_TCUPrstart!= pLcdCtrl->CurScreen)
return;
......@@ -104,12 +104,12 @@ void TCUProPrstart_B(StructTCUCtrl *pLcdCtrl)
{
TCUCurChgRecd_B.TCUChargeEnable = 1;
pLcdCtrl->CurScreen = eLcdPro_TCUBuildComm_B;
TCUCurChgRecd_B.StarChgResult== 0;
TCUCurChgRecd_B.StarChgResult= 0;
}
else if(TCUCurChgRecd_B.StarChgResult== 2)//启动失败
{
pLcdCtrl->CurScreen = GetTCUProcess(eLcdPro_TCUMainMenu);
TCUCurChgRecd_B.StarChgResult== 0;
TCUCurChgRecd_B.StarChgResult= 0;
}
if(eLcdPro_TCUPrstart_B!= pLcdCtrl->CurScreen)
return;
......@@ -118,8 +118,6 @@ void TCUProPrstart_B(StructTCUCtrl *pLcdCtrl)
}
void TCUBuildComm(StructTCUCtrl *pLcdCtrl)
{
u32 StarMegSendAcktime = 0;
u32 FirstStarMegSendAcktime =0;
while(1)
{
if(eLcdPro_TCUBuildComm!= pLcdCtrl->CurScreen)
......@@ -491,8 +489,8 @@ void Thd_TCUControl(void const *parameter)
TCUCtrl.Param = 0;
while(1)
{
if(TCUCtrl.CurScreen < eLcdPro_Max)
TCUCtrlHandle[TCUCtrl.CurScreen](&LcdCtrl);
if(TCUCtrl.CurScreen < eLcdPro_TCUMax)
TCUCtrl Handle[TCUCtrl.CurScreen](&TCUCtrl);
else
{
TCUCtrl.CurScreen = eLcdPro_TCUMainMenu;
......
......@@ -50,7 +50,7 @@ typedef void (*pTCUCtrlHandle)(StructTCUCtrl *pTCUCtrl);
#include "Drv_CommuUSART3.h"
typedef struct{
u8 TCUChgStarNotetrl ;//开机标识
u8 TCUChgStartNotetrl ;//开机标识
u8 StarValid;//启动参数是否有效
u8 StarChgType;//开始充电类型//即插即充标识 00非 01 即插即充other:invalid
u8 StarChgResult;//开启充电结果
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论