|
@@ -49,7 +49,9 @@ void Fota_Ftp(uint8 *dataPtrIn);
|
|
void tcpUdsFunc(uint8 *Ptr, uint8 *AnsPtr);
|
|
void tcpUdsFunc(uint8 *Ptr, uint8 *AnsPtr);
|
|
static void vTimer1000msCallback(TimerHandle_t pxTimer);
|
|
static void vTimer1000msCallback(TimerHandle_t pxTimer);
|
|
|
|
|
|
-volatile TcpFeq_type TcpDataFeq={{0x01,60*60*2,0},{0x86,60*60,0},{0x91,1,0},{0x82,1,0},{0x90,60,0},{0x92,60,0},{0x8C,10,0}};//默认发送频率
|
|
|
|
|
|
+volatile TcpFeq_type TcpDataFeq={
|
|
|
|
+ {0x01,60*60*2,0},{0x86,60*60,0},{0x91,10,0},
|
|
|
|
+ {0x82,10,0},{0x90,60,0},{0x92,60,0},{0x8C,10,0}};//默认发送频率
|
|
static UTC8TimeType UTC8TimeTcp;//全局真实时间存储
|
|
static UTC8TimeType UTC8TimeTcp;//全局真实时间存储
|
|
extern boolean waitForSleepFlag;
|
|
extern boolean waitForSleepFlag;
|
|
boolean Uart_4G_Task_Sleep_FLag = false;
|
|
boolean Uart_4G_Task_Sleep_FLag = false;
|
|
@@ -145,7 +147,7 @@ void Uart_4G_Task(void *pvParameters)
|
|
uint8 DataSendIdx = 0;
|
|
uint8 DataSendIdx = 0;
|
|
//发送判定
|
|
//发送判定
|
|
TcpDataSendFeqHandFunc(&DataSendIdx);
|
|
TcpDataSendFeqHandFunc(&DataSendIdx);
|
|
- if(DataSendIdx!=0)//有数据发送
|
|
|
|
|
|
+ if(DataSendIdx!=0)//有数据处理
|
|
{
|
|
{
|
|
SendRet = TcpDataSendFunc(SocketId,DataSendIdx);//发送函数
|
|
SendRet = TcpDataSendFunc(SocketId,DataSendIdx);//发送函数
|
|
if (SendRet == 0)
|
|
if (SendRet == 0)
|
|
@@ -249,9 +251,6 @@ sint8 TcpDataSendFunc(sint8 ConnectId,uint8 DataSendIdxIn)
|
|
uint32 pSendDataAddr = 0;
|
|
uint32 pSendDataAddr = 0;
|
|
uint16 DataSendLen = 0;
|
|
uint16 DataSendLen = 0;
|
|
TcpDataEncode(DataSendIdxIn,&pSendDataAddr, &DataSendLen); // 数据组包,malloc申请在里面,pSendData指向申请的地址
|
|
TcpDataEncode(DataSendIdxIn,&pSendDataAddr, &DataSendLen); // 数据组包,malloc申请在里面,pSendData指向申请的地址
|
|
-#ifdef SEGGER_RTT_PRINTF
|
|
|
|
- SEGGER_RTT_printf("sendFeq:T_%d,Idx_%02X,Len_%d\n",TimerCounter,DataSendIdxIn,DataSendLen);
|
|
|
|
-#endif
|
|
|
|
if(DataSendLen==0)//长度为0 不调用发送数据函数
|
|
if(DataSendLen==0)//长度为0 不调用发送数据函数
|
|
{
|
|
{
|
|
outValue = 0;
|
|
outValue = 0;
|
|
@@ -301,9 +300,6 @@ sint8 tcpipConnectionSend(uint8 TcpConnectId, uint8 *SendDataPtr, uint16 SendDat
|
|
sendErrConuter++;
|
|
sendErrConuter++;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-#ifdef SEGGER_RTT_PRINTF
|
|
|
|
- SEGGER_RTT_printf("[%d]-%d-%d-%d\n",__LINE__,TimerCounter,sendErrConuter,SendDataLen);
|
|
|
|
-#endif
|
|
|
|
return outValue;
|
|
return outValue;
|
|
}
|
|
}
|
|
sint8 TcpConnectFunc(sint8 *ConnectId)
|
|
sint8 TcpConnectFunc(sint8 *ConnectId)
|
|
@@ -938,6 +934,8 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
|
|
case DebugMsg:
|
|
case DebugMsg:
|
|
{
|
|
{
|
|
char rbuf[512]={0};
|
|
char rbuf[512]={0};
|
|
|
|
+ char tmp[13] = {0};
|
|
|
|
+ memcpy(tmp,BMS_SN,12);
|
|
DebugMsgtoTcpType DebugMsgInfo;
|
|
DebugMsgtoTcpType DebugMsgInfo;
|
|
UINT16 DataLen = 0;
|
|
UINT16 DataLen = 0;
|
|
UINT16 BufferLen = 0;
|
|
UINT16 BufferLen = 0;
|
|
@@ -946,7 +944,7 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
|
|
{%.2f,%.2f,%.2f,%.2f,%.2f;\
|
|
{%.2f,%.2f,%.2f,%.2f,%.2f;\
|
|
%.2f,%.2f,%.2f,%.2f,%.2f,}\
|
|
%.2f,%.2f,%.2f,%.2f,%.2f,}\
|
|
{%.2f,%.2f,%.2f,%.2f,%.2f;\
|
|
{%.2f,%.2f,%.2f,%.2f,%.2f;\
|
|
- %.2f,%.2f,%.2f,%.2f,%.2f,}",
|
|
|
|
|
|
+ %.2f,%.2f,%.2f,%.2f,%.2f,},%s",
|
|
returnFreq[0][0], returnFreq[0][1], returnFreq[0][2], returnFreq[0][3], returnFreq[0][4],
|
|
returnFreq[0][0], returnFreq[0][1], returnFreq[0][2], returnFreq[0][3], returnFreq[0][4],
|
|
returnP[0][0], returnP[0][1], returnP[0][2], returnP[0][3], returnP[0][4],
|
|
returnP[0][0], returnP[0][1], returnP[0][2], returnP[0][3], returnP[0][4],
|
|
|
|
|
|
@@ -954,7 +952,7 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
|
|
returnP[1][0], returnP[1][1], returnP[1][2], returnP[1][3], returnP[1][4],
|
|
returnP[1][0], returnP[1][1], returnP[1][2], returnP[1][3], returnP[1][4],
|
|
|
|
|
|
returnFreq[2][0], returnFreq[2][1], returnFreq[2][2], returnFreq[2][3], returnFreq[2][4],
|
|
returnFreq[2][0], returnFreq[2][1], returnFreq[2][2], returnFreq[2][3], returnFreq[2][4],
|
|
- returnP[2][0], returnP[2][1], returnP[2][2], returnP[2][3], returnP[2][4]);
|
|
|
|
|
|
+ returnP[2][0], returnP[2][1], returnP[2][2], returnP[2][3], returnP[2][4],tmp);
|
|
|
|
|
|
BufferLen = strlen((const char *)rbuf);
|
|
BufferLen = strlen((const char *)rbuf);
|
|
*SendLen = BufferLen + sizeof(DebugMsgInfo);
|
|
*SendLen = BufferLen + sizeof(DebugMsgInfo);
|
|
@@ -1056,6 +1054,11 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
|
|
}
|
|
}
|
|
case 0x91:
|
|
case 0x91:
|
|
{
|
|
{
|
|
|
|
+ if(BMS_CellRecvCounter<128)
|
|
|
|
+ {
|
|
|
|
+ *SendLen = 0; // 不发送,长度为0
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
GetCSQValue(&CSQValue);
|
|
GetCSQValue(&CSQValue);
|
|
*SendLen = 0x54 + min(BMS_CellTotal, BMS_CELL_MAX_NUM) * 2 + min(BMS_TempTotal, BMS_TEMP_MAX_NUM);
|
|
*SendLen = 0x54 + min(BMS_CellTotal, BMS_CELL_MAX_NUM) * 2 + min(BMS_TempTotal, BMS_TEMP_MAX_NUM);
|
|
SendBuffer = pvPortMalloc(*SendLen);
|
|
SendBuffer = pvPortMalloc(*SendLen);
|
|
@@ -1327,9 +1330,6 @@ static void TcpDataInfoRecvHandle(uint8 *DataRecv, uint16 DataRecvLen)
|
|
uint8 TcpCmdAnswer[50] = {0};
|
|
uint8 TcpCmdAnswer[50] = {0};
|
|
uint16 TcpDataLen = 0;
|
|
uint16 TcpDataLen = 0;
|
|
uint16 NumCalTemp = 1;
|
|
uint16 NumCalTemp = 1;
|
|
-#ifdef SEGGER_RTT_PRINTF
|
|
|
|
- SEGGER_RTT_printf("[%d]-%s\r\n",__LINE__,DataRecv);
|
|
|
|
-#endif
|
|
|
|
retptr = (uint8 *)strstr((char *)DataRecv, (char *)("\r\n##"));
|
|
retptr = (uint8 *)strstr((char *)DataRecv, (char *)("\r\n##"));
|
|
if (retptr == NULL || DataRecvLen < 5)
|
|
if (retptr == NULL || DataRecvLen < 5)
|
|
return;
|
|
return;
|