提交 dc6920ae 作者: wysheng

协议测试;中兴模块

上级 245b1af3
......@@ -4,7 +4,7 @@
#include "Global.h"
#define DcModule_ZhongXing 0
#define DcModule_ZhongXing 1
#define DcModule_BaudRate (250)
......@@ -101,7 +101,7 @@ typedef struct
u16 Currt;//0.1A/Bit;
u16 State;
u32 RecvTime;
EnumModuStatus ModStatus;
u16 ModStatus;
}StructDcModuleStatus;
extern StructDcModuleAbility DcModuleAbility;
......
......@@ -278,6 +278,8 @@ typedef enum
eChgStop_BmsReady_Meter = 96,
eChgStop_PillarReady_Meter = 97,
eChgStop_Imd_Short = 98,
eChgStop_Imd_xx = 99,
}EnumChgStopType;
......
......@@ -113,7 +113,8 @@ void DcModuleManageProcess_SmartAllocation(void)
Flag = Flag << 1;
}
#if (DcModule_ZhongXing == 0)
if(0x0002 & DcModuleManage_All.OnlineFlag)
{
static u32 GetAcVoltTick = 0;
......@@ -124,6 +125,7 @@ void DcModuleManageProcess_SmartAllocation(void)
}
}
#endif
for (i = 0; i < DcModuleGroupSize; i++)
{
......@@ -960,7 +962,7 @@ void SendCheckToDcModule_ZhongXing(void)
u16 addr = 0;
static u32 StaticTick = 0;
if ((GetSystemTick() -StaticTick) > 1000)
if ((GetSystemTick() -StaticTick) > 2000)
{
StaticTick = GetSystemTick();
......@@ -969,7 +971,7 @@ void SendCheckToDcModule_ZhongXing(void)
if(DcModuleStatus_ALL[i].Temp == 0)//未分组
{
DcModuleSetGroupNum();
return;//continue;
//return;//continue;
}
for (u8 j = 0; j < DcModuleGroup[i].num; j++)
......@@ -1072,7 +1074,7 @@ u8 DcModuleGetStatus_Incre(u8 addr)
u8 DcModuleGetStatus_ZhongXing(u8 addr)
{
if(0x0000 != (DcModuleStatus_ALL[addr].State & 0xFE10))
if(0x0010 != (DcModuleStatus_ALL[addr].State & 0x0010))
{
return TRUE;
}
......@@ -1086,9 +1088,9 @@ u8 DcModuleGetStatus_ZhongXing(u8 addr)
u8 DcModuleGetStatus(u8 addr)
{
#if DcModule_ZhongXing
return DcModuleGetStatus_Incre(addr);
#else
return DcModuleGetStatus_ZhongXing(addr);
#else
return DcModuleGetStatus_Incre(addr);
#endif
}
......@@ -1100,23 +1102,26 @@ void DcModuleSetGroupNum(void) //中兴模块分组设置
for(u8 i=0;i<DcModuleGroupSize;i++)
{
addr = DcModuleGroup[i].modules[0].addr;
DataSend.Id = 0x180460A0 | (addr<<8);
DataSend.Len = 8;
DataSend.Data[0] = 0x28;
DataSend.Data[1] = i + 1;
DataSend.Data[2] = 0x02;
DataSend.Data[3] = 0x60 | DcModuleGroup[i].modules[0].addr;
DataSend.Data[4] = 0x60 | DcModuleGroup[i].modules[1].addr;
DataSend.Data[5] = 0x00;
DataSend.Data[6] = 0x00;
DataSend.Data[7] = 0x00;
//DcModuleSendMsg(&DataSend);
//放入队列
if (pdTRUE != xQueueSend(DcModeMsg, &DataSend, 0))
for(u8 j=0;j<DcModuleGroup[i].num;j++)
{
//osDelay(10);
addr = DcModuleGroup[i].modules[j].addr;
DataSend.Id = 0x180460A0 | (addr<<8);
DataSend.Len = 8;
DataSend.Data[0] = 0x28;
DataSend.Data[1] = i + 1;
DataSend.Data[2] = 0x02;
DataSend.Data[3] = 0x60 | DcModuleGroup[i].modules[0].addr;
DataSend.Data[4] = 0x60 | DcModuleGroup[i].modules[1].addr;
DataSend.Data[5] = 0x00;
DataSend.Data[6] = 0x00;
DataSend.Data[7] = 0x00;
//DcModuleSendMsg(&DataSend);
//放入队列
if (pdTRUE != xQueueSend(DcModeMsg, &DataSend, 0))
{
//osDelay(10);
}
}
}
}
......
......@@ -733,13 +733,13 @@ void DcModuleMsgReceive_ZhongXing(CanRxMsg* RxMsg)
u8 addr = 0;
if ((0x1801A060 == (RxMsg->ExtId & 0xFFFFA060))) //心跳应答
{
addr = (u8)(RxMsg->ExtId&0x000000FF);
DcModuleManage_All.OnlineFlag |= ((long long) 1 << (addr&0x0f));
//addr = (u8)(RxMsg->ExtId&0x000000FF);
//DcModuleManage_All.OnlineFlag |= ((long long) 1 << (addr&0x0f));
}
else if ((0x1804A060 == (RxMsg->ExtId & 0xFFFFA060))) //分组应答
{
addr = (u8)(RxMsg->ExtId&0x000000FF);
if(RxMsg->Data[0] == 0xA8 && RxMsg->Data[1] == 0x00)
//addr = (u8)(RxMsg->ExtId&0x000000FF);
//if(RxMsg->Data[0] == 0xA8 && RxMsg->Data[1] == 0x00)
{
//分组成功
}
......@@ -792,3 +792,5 @@ void DcModuleMsgReceive(CanRxMsg* RxMsg)
#endif
}
......@@ -34,6 +34,7 @@ void ChgProCommError(StructChargeCtrl *pChargeCtrl)
DcModuleSet(eSwSta_Off, DcModuleAbility.MinVolt, DcModuleAbility.MinCurrt*DcModuleManage.ValidNum);
CstSendCnt = 0;
if(ChargeStopType != eChgStop_Imd_xx)
CST_Send(&CstMsg);
CST_SendTick = GetSystemTick();
......@@ -46,7 +47,7 @@ void ChgProCommError(StructChargeCtrl *pChargeCtrl)
while(1)
{
if((0== CemMsg.Cem.Value.Bst)&&(0 != CST_SendTick) && ((GetSystemTick() - CST_SendTick) > 7))
if((ChargeStopType != eChgStop_Imd_xx)&&(0== CemMsg.Cem.Value.Bst)&&(0 != CST_SendTick) && ((GetSystemTick() - CST_SendTick) > 7))
{
CST_Send(&CstMsg);
CST_SendTick = GetSystemTick();
......
......@@ -39,6 +39,7 @@ void ChgProWaitPillarReady(StructChargeCtrl *pChargeCtrl)
u32 CcStatusChkTick = 0;
u32 VoltReadyTick = 0;
u32 Bro_00_Tick = 0;
u8 Bro_00_flg =0;
BemMsg.Valid = 0;
BmsCanInit();
osDelay(20);
......@@ -84,6 +85,29 @@ void ChgProWaitPillarReady(StructChargeCtrl *pChargeCtrl)
ChgPgnRecv(&PgnRecv);
if((Bro_00_flg == 0)&&(0 != BroMsg.Valid) && (0x00 == BroMsg.Status))
{
Bro_00_Tick =GetSystemTick();
Bro_00_flg =1;
}
else if(Bro_00_flg ==0)
Bro_00_Tick =GetSystemTick();
if((GetSystemTick() -Bro_00_Tick >= MsgTimeout_1S))
{
/*VoltReadyTick = 0;
pChargeCtrl->CurProcess = eChgPro_ChgStart;
pChargeCtrl->Param = 0;*/
//CstMsg.StopReason.Value.Truble = 1;
// CstMsg.StopTruble.Value.Other = 1;
// CstMsg.StopFault.Value.Volt = 1;
CemMsg.Cem.Mult = 0;
DcOutSet(eSwSta_Off);
SendDataToDcModule_A(eSwSta_Off, DcModuleAbility.MinVolt, DcModuleAbility.MinCurrt*DcModuleManage.ValidNum);
ChargeStopType = eChgStop_Imd_xx;
pChargeCtrl->CurProcess = eChgPro_CommError;
pChargeCtrl->Param = 0;
}
if((eChgVer_2011 != UserParam.ChgVer) && (eChgVer_2011 != ChgVer))
{
......@@ -190,27 +214,7 @@ void ChgProWaitPillarReady(StructChargeCtrl *pChargeCtrl)
pChargeCtrl->CurProcess = eChgPro_CommBreak;
pChargeCtrl->Param = 0;
}
#if 1
if(0x00== BroMsg.Status)
Bro_00_Tick =GetSystemTick();
else
Bro_00_Tick =GetSystemTick();
if( GetSystemTick() -Bro_00_Tick >= MsgTimeout_1S)
{
/*VoltReadyTick = 0;
pChargeCtrl->CurProcess = eChgPro_ChgStart;
pChargeCtrl->Param = 0;*/
//CstMsg.StopReason.Value.Truble = 1;
// CstMsg.StopTruble.Value.Other = 1;
// CstMsg.StopFault.Value.Volt = 1;
CemMsg.Cem.Mult = 0;
DcOutSet(eSwSta_Off);
SendDataToDcModule_A(eSwSta_Off, DcModuleAbility.MinVolt, DcModuleAbility.MinCurrt*DcModuleManage.ValidNum);
ChargeStopType = eChgStop_Conf_ChgMaxVoltLessPillarMinVolt;
pChargeCtrl->CurProcess = eChgPro_CommError;
pChargeCtrl->Param = 0;
}
#endif
if(0 == TCUCurChgRecd.TCUChargeEnable)
{//外部控制结束充电
SendDataToDcModule_A(eSwSta_Off, DcModuleAbility.MinVolt, DcModuleAbility.MinCurrt*DcModuleManage.ValidNum);
......
......@@ -11,7 +11,7 @@
#define CC_CheckTick (100)
#define MsgTimeout_1S (1000+200)
#define MsgTimeout_5S (5000+500)
#define MsgTimeout_10S (10*1000+3000)
#define MsgTimeout_10S (10*1000)
#define MsgTimeout_60S (60*1000+3000)
#define MsgTimeout_10M (10*60*1000+3000)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论