|
@@ -268,8 +268,8 @@ static void TcpDataSendFeqHandFunc(uint8* DataIdx)
|
|
if(timerDelayFlag == 0)
|
|
if(timerDelayFlag == 0)
|
|
{
|
|
{
|
|
TcpDataFeq.BattHighFeqCnt[1] = 10;
|
|
TcpDataFeq.BattHighFeqCnt[1] = 10;
|
|
- TcpDataFeq.BattAlgmMsgFeqCnt[1] = 10;
|
|
|
|
}
|
|
}
|
|
|
|
+ TcpDataFeq.BattAlgmMsgFeqCnt[1] = 10;
|
|
}
|
|
}
|
|
else if(BMS_Mode==2)//放电中
|
|
else if(BMS_Mode==2)//放电中
|
|
{
|
|
{
|
|
@@ -279,8 +279,8 @@ static void TcpDataSendFeqHandFunc(uint8* DataIdx)
|
|
if(timerDelayFlag == 0)
|
|
if(timerDelayFlag == 0)
|
|
{
|
|
{
|
|
TcpDataFeq.BattHighFeqCnt[1] = 30;
|
|
TcpDataFeq.BattHighFeqCnt[1] = 30;
|
|
- TcpDataFeq.BattAlgmMsgFeqCnt[1] = 10;
|
|
|
|
}
|
|
}
|
|
|
|
+ TcpDataFeq.BattAlgmMsgFeqCnt[1] = 10;
|
|
}
|
|
}
|
|
else//没有上高压状态
|
|
else//没有上高压状态
|
|
{
|
|
{
|
|
@@ -290,11 +290,13 @@ static void TcpDataSendFeqHandFunc(uint8* DataIdx)
|
|
if(timerDelayFlag == 0)
|
|
if(timerDelayFlag == 0)
|
|
{
|
|
{
|
|
TcpDataFeq.BattHighFeqCnt[1] = 60;
|
|
TcpDataFeq.BattHighFeqCnt[1] = 60;
|
|
- TcpDataFeq.BattAlgmMsgFeqCnt[1] = 60;
|
|
|
|
}
|
|
}
|
|
|
|
+ TcpDataFeq.BattAlgmMsgFeqCnt[1] = 60;
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
TcpDataFeq.DebugMsgFeqCnt[1] = TcpDataFeq.TrkBattFeqCnt[1];
|
|
TcpDataFeq.DebugMsgFeqCnt[1] = TcpDataFeq.TrkBattFeqCnt[1];
|
|
- if(BMS_PackSOC <=100 && (BMS_PackCurr>=10000-50 && BMS_PackCurr <=10000+50)) //pack soc(0.4,0) ≤ 25% and the abs value of pack current(0.1,-10000) ≤ 5A
|
|
|
|
|
|
+ if(BMS_PackSOC * 0.4 <= 25 && (BMS_PackCurr>=10000-50 && BMS_PackCurr <=10000+50)) //pack soc(0.4,0) ≤ 25% and the abs value of pack current(0.1,-10000) ≤ 5A
|
|
{
|
|
{
|
|
if(timerDelayFlag == 0)
|
|
if(timerDelayFlag == 0)
|
|
{
|
|
{
|
|
@@ -473,10 +475,10 @@ sint8 TcpConnectFunc(sint8 *ConnectId)
|
|
uint8 AtCmdSendTotalLen = 0;
|
|
uint8 AtCmdSendTotalLen = 0;
|
|
*ConnectId = 0;
|
|
*ConnectId = 0;
|
|
/*IP测试更改*/
|
|
/*IP测试更改*/
|
|
- // char *ATCmdSend = (char *)("\"120.26.68.165\"");
|
|
|
|
- // memset(WebSiteIp,0x00,sizeof(WebSiteIp));
|
|
|
|
- // memcpy(WebSiteIp ,ATCmdSend,strlen(ATCmdSend));
|
|
|
|
- // WebSitePort = 14401;
|
|
|
|
|
|
+// char *ATCmdSend = (char *)("\"120.26.68.165\"");
|
|
|
|
+// memset(WebSiteIp,0x00,sizeof(WebSiteIp));
|
|
|
|
+// memcpy(WebSiteIp ,ATCmdSend,strlen(ATCmdSend));
|
|
|
|
+// WebSitePort = 15964;
|
|
/**/
|
|
/**/
|
|
sprintf(AtCmdSend, "AT+CIPOPEN=%d,\"TCP\",%s,%d\r\n", *ConnectId, WebSiteIp, WebSitePort); // 此处需要优化
|
|
sprintf(AtCmdSend, "AT+CIPOPEN=%d,\"TCP\",%s,%d\r\n", *ConnectId, WebSiteIp, WebSitePort); // 此处需要优化
|
|
AtCmdSendTotalLen = mstrlen(AtCmdSend);
|
|
AtCmdSendTotalLen = mstrlen(AtCmdSend);
|
|
@@ -1300,6 +1302,14 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
|
|
*(SendBuffer + 0x22) = (UTC8TimeTcp.hour & 0xFF); // uint8 hour
|
|
*(SendBuffer + 0x22) = (UTC8TimeTcp.hour & 0xFF); // uint8 hour
|
|
*(SendBuffer + 0x23) = (UTC8TimeTcp.minute & 0xFF); // uint8 minute
|
|
*(SendBuffer + 0x23) = (UTC8TimeTcp.minute & 0xFF); // uint8 minute
|
|
*(SendBuffer + 0x24) = (UTC8TimeTcp.second & 0xFF); // uint8 second
|
|
*(SendBuffer + 0x24) = (UTC8TimeTcp.second & 0xFF); // uint8 second
|
|
|
|
+
|
|
|
|
+ BMS_BattVolt = 5678;
|
|
|
|
+ BMS_PackCurr = 35+10000;
|
|
|
|
+ BMS_MaxCellVolt = 4235;
|
|
|
|
+ BMS_MinCellVolt = 4123;
|
|
|
|
+ BMS_MaxCellTemp = 25+50;
|
|
|
|
+ BMS_MinCellTemp = 20+50;
|
|
|
|
+
|
|
*(SendBuffer + 0x25) = (BMS_BattVolt >> 8) & 0xFF; // 电池包总电压
|
|
*(SendBuffer + 0x25) = (BMS_BattVolt >> 8) & 0xFF; // 电池包总电压
|
|
*(SendBuffer + 0x26) = (BMS_BattVolt & 0xFF);
|
|
*(SendBuffer + 0x26) = (BMS_BattVolt & 0xFF);
|
|
*(SendBuffer + 0x27) = ((BMS_PackCurr >> 8) & 0xFF); // uint16 电池包总电流,充电为负值,放电为正值 精度_0.1,偏移量_-1000,单位_A
|
|
*(SendBuffer + 0x27) = ((BMS_PackCurr >> 8) & 0xFF); // uint16 电池包总电流,充电为负值,放电为正值 精度_0.1,偏移量_-1000,单位_A
|
|
@@ -1308,8 +1318,8 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
|
|
*(SendBuffer + 0x2A) = (BMS_MaxCellVolt & 0xFF);
|
|
*(SendBuffer + 0x2A) = (BMS_MaxCellVolt & 0xFF);
|
|
*(SendBuffer + 0x2B) = ((BMS_MinCellVolt >> 8) & 0xFF); // uint16 电池最高单体电压,1mV
|
|
*(SendBuffer + 0x2B) = ((BMS_MinCellVolt >> 8) & 0xFF); // uint16 电池最高单体电压,1mV
|
|
*(SendBuffer + 0x2C) = (BMS_MinCellVolt & 0xFF);
|
|
*(SendBuffer + 0x2C) = (BMS_MinCellVolt & 0xFF);
|
|
- *(SendBuffer + 0x2D) = ((BMS_MaxCellTemp+10) & 0xFF); // uint16 电池最高单体电压,1mV
|
|
|
|
- *(SendBuffer + 0x2E) = ((BMS_MinCellTemp+10) & 0xFF);
|
|
|
|
|
|
+ *(SendBuffer + 0x2D) = ((BMS_MaxCellTemp-10) & 0xFF); // uint16 电池最高单体电压,1mV
|
|
|
|
+ *(SendBuffer + 0x2E) = ((BMS_MinCellTemp-10) & 0xFF);
|
|
*(SendBuffer + 0x2F) = bcc_chk(SendBuffer, 0x2F);
|
|
*(SendBuffer + 0x2F) = bcc_chk(SendBuffer, 0x2F);
|
|
*PtrSendAddr = (uint32)SendBuffer;
|
|
*PtrSendAddr = (uint32)SendBuffer;
|
|
break;
|
|
break;
|
|
@@ -1340,6 +1350,21 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
|
|
*(SendBuffer + 0x22) = (UTC8TimeTcp.hour & 0xFF); // uint8 hour
|
|
*(SendBuffer + 0x22) = (UTC8TimeTcp.hour & 0xFF); // uint8 hour
|
|
*(SendBuffer + 0x23) = (UTC8TimeTcp.minute & 0xFF); // uint8 minute
|
|
*(SendBuffer + 0x23) = (UTC8TimeTcp.minute & 0xFF); // uint8 minute
|
|
*(SendBuffer + 0x24) = (UTC8TimeTcp.second & 0xFF); // uint8 second
|
|
*(SendBuffer + 0x24) = (UTC8TimeTcp.second & 0xFF); // uint8 second
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ BMS_PackSOC = 20/0.4;
|
|
|
|
+ BMS_PackSOH = 95/0.4;
|
|
|
|
+ BBox_PackSOC = 91/0.4;
|
|
|
|
+ BBox_PackSOH = 96;
|
|
|
|
+ BBox_TotalDischarCapy = 12345;
|
|
|
|
+ BBox_TotalCharCapy = 23456;
|
|
|
|
+ BBox_TotalBackCharCapy = 34567;
|
|
|
|
+ BBox_TotalDischarEngy = 45678;
|
|
|
|
+ BBox_TotalCharEngy = 56789;
|
|
|
|
+ BBox_TotalBackCharEngy= 67890;
|
|
|
|
+ BBox_Dq_Dv_MAX = 123456;
|
|
|
|
+ BBox_Dq_Dv_MIN = 111112;
|
|
|
|
+
|
|
*(SendBuffer + 0x25) = (BMS_PackSOC) & 0xFF; // BMS计算SOC
|
|
*(SendBuffer + 0x25) = (BMS_PackSOC) & 0xFF; // BMS计算SOC
|
|
*(SendBuffer + 0x26) = (BMS_PackSOH / 25 * 10) & 0xFF; // SOH 精度1%
|
|
*(SendBuffer + 0x26) = (BMS_PackSOH / 25 * 10) & 0xFF; // SOH 精度1%
|
|
*(SendBuffer + 0x27) = (BBox_PackSOC & 0xFF); // 终端计算SOC
|
|
*(SendBuffer + 0x27) = (BBox_PackSOC & 0xFF); // 终端计算SOC
|
|
@@ -1382,6 +1407,7 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
|
|
*(SendBuffer + 0x47) = ((BBox_Dq_Dv_MIN >> 8) & 0xFF);
|
|
*(SendBuffer + 0x47) = ((BBox_Dq_Dv_MIN >> 8) & 0xFF);
|
|
*(SendBuffer + 0x48) = ((BBox_Dq_Dv_MIN) & 0xFF);
|
|
*(SendBuffer + 0x48) = ((BBox_Dq_Dv_MIN) & 0xFF);
|
|
*(SendBuffer + 0x49) = bcc_chk(SendBuffer, 0x49);
|
|
*(SendBuffer + 0x49) = bcc_chk(SendBuffer, 0x49);
|
|
|
|
+ *PtrSendAddr = (uint32)SendBuffer;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
default:
|
|
default:
|