|
@@ -1022,24 +1022,32 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
|
|
|
DebugMsgtoTcpType DebugMsgInfo;
|
|
|
UINT16 DataLen = 0;
|
|
|
UINT16 BufferLen = 0;
|
|
|
- sprintf((char *)rbuf, "{%.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,%d,\
|
|
|
- {%.2f,%.2f,%.2f,%.2f,\
|
|
|
- %d,%d,%d,%d,%d,%d}",
|
|
|
- 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],
|
|
|
-
|
|
|
- returnFreq[1][0], returnFreq[1][1], returnFreq[1][2], returnFreq[1][3], returnFreq[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],
|
|
|
- returnP[2][0], returnP[2][1], returnP[2][2], returnP[2][3], returnP[2][4],tmp,DeviceErrNum,
|
|
|
+// sprintf((char *)rbuf, "{%.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,%d,\
|
|
|
+// {%.2f,%.2f,%.2f,%.2f,\
|
|
|
+// %d,%d,%d,%d,%d,%d}",
|
|
|
+// 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],
|
|
|
+//
|
|
|
+// returnFreq[1][0], returnFreq[1][1], returnFreq[1][2], returnFreq[1][3], returnFreq[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],
|
|
|
+// returnP[2][0], returnP[2][1], returnP[2][2], returnP[2][3], returnP[2][4],tmp,DeviceErrNum,
|
|
|
+// socd_pct_ahSoc,socd_pct_battSoc,socd_pct_bcuSoc,socd_pct_ekfSoc,
|
|
|
+// BBox_TotalCharEngy,BBox_TotalDischarEngy,BBox_TotalBackCharEngy,BBox_TotalCharCapy,BBox_TotalDischarCapy,BBox_TotalBackCharCapy);
|
|
|
+ sprintf((char *)rbuf, "%s,%d,\
|
|
|
+ {%.2f,%.2f,%.2f,%.2f},\
|
|
|
+ {%d,%d,%d,%d,%d,%d},\
|
|
|
+ {%.3f,%.3f,%.3f,%.1f,%d,%d}",
|
|
|
+ tmp,DeviceErrNum,
|
|
|
socd_pct_ahSoc,socd_pct_battSoc,socd_pct_bcuSoc,socd_pct_ekfSoc,
|
|
|
- BBox_TotalCharEngy,BBox_TotalDischarEngy,BBox_TotalBackCharEngy,BBox_TotalCharCapy,BBox_TotalDischarCapy,BBox_TotalBackCharCapy);
|
|
|
+ BBox_TotalCharEngy,BBox_TotalDischarEngy,BBox_TotalBackCharEngy,BBox_TotalCharCapy,BBox_TotalDischarCapy,BBox_TotalBackCharCapy,
|
|
|
+ ihd_V_cellUMax,ihd_V_cellUMin,ihd_V_cellUAvrg,ihd_I_battCurr_T2,BMS_PackSOC,rtev_flg_EESt[3]);
|
|
|
|
|
|
BufferLen = strlen((const char *)rbuf);
|
|
|
*SendLen = BufferLen + sizeof(DebugMsgInfo);
|
|
@@ -1745,6 +1753,42 @@ uint16 tcpUdsFunc(uint8 *Ptr, uint8 *AnsPtr)
|
|
|
return AnsLength;
|
|
|
break;
|
|
|
}
|
|
|
+ case 0x0202: //soh correction did
|
|
|
+ {
|
|
|
+
|
|
|
+ if(udsDataLen == 2)
|
|
|
+ {
|
|
|
+ float sohCorrectionValue = (float)((float)((DataBuffer[0]<<8 | DataBuffer[1])&0xFFFF)*0.1);
|
|
|
+ if(sohCorrectionValue > 0 && sohCorrectionValue<100) //有效修正
|
|
|
+ {
|
|
|
+ BBox_SohCorrectionValue = sohCorrectionValue;
|
|
|
+ sohCorrectionValue = 0;
|
|
|
+ retLength = tcpUdsAnsMsgEncode(true,udsType_SID,DIDBuffer,0x00,udsAnsBuffer);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ sohCorrectionValue = 0;
|
|
|
+ retLength = tcpUdsAnsMsgEncode(false,udsType_SID,DIDBuffer,0x13,udsAnsBuffer);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ retLength = tcpUdsAnsMsgEncode(false,udsType_SID,DIDBuffer,0x13,udsAnsBuffer);
|
|
|
+ }
|
|
|
+
|
|
|
+ *(AnsPtr + 3) = 0x01;
|
|
|
+ memcpy((AnsPtr + 4), (Ptr + 4), BATT_SN_LEN);
|
|
|
+ *(AnsPtr + 21) = TCP_ENCPT_DISABLE;
|
|
|
+ *(AnsPtr + 22) = 0x00;
|
|
|
+ *(AnsPtr + 23) = 0x06 + retLength + 1;
|
|
|
+ memcpy((AnsPtr + 24), (Ptr + 24), 6);
|
|
|
+ *(AnsPtr + 30) = retLength;
|
|
|
+ memcpy((AnsPtr + 31),udsAnsBuffer,retLength);
|
|
|
+ *(AnsPtr + 31 + retLength) = bcc_chk(AnsPtr, 31 + retLength);
|
|
|
+ AnsLength = 32 + retLength;
|
|
|
+ return AnsLength;
|
|
|
+ break;
|
|
|
+ }
|
|
|
default:
|
|
|
retLength = tcpUdsAnsMsgEncode(false,udsType_SID,DIDBuffer,0x31,udsAnsBuffer);
|
|
|
|
|
@@ -1906,18 +1950,30 @@ void Fota_Ftp(uint8 *dataPtrIn)
|
|
|
case 1: // login
|
|
|
{
|
|
|
memset(ATSendDataBuffer, 0x00, sizeof(ATSendDataBuffer));
|
|
|
- sprintf(ATSendDataBuffer, "AT+CFTPSLOGIN=\"%s\",%s,\"%s\",\"%s\",0\r\n", ftpServerIpPtr, ftpServerPort, accountPtr, passwordPtr);
|
|
|
- UART_Send_Data(UART_LPUART1, ATSendDataBuffer, mstrlen(ATSendDataBuffer), pdMS_TO_TICKS(100));
|
|
|
- recvRet = AtcmdDelayRecvFunc(UART_LPUART1, (char *)("+CFTPSLOGIN: 0"), 30000);
|
|
|
- if (recvRet == 0)
|
|
|
- {
|
|
|
- ftp_process++;
|
|
|
+ sprintf(ATSendDataBuffer, "AT+FSDEL=*.*\r\n");
|
|
|
+ recvRet = UART_Query_Data(UART_LPUART1, UART_LPUART1, ATSendDataBuffer, mstrlen(ATSendDataBuffer), UartRecvBuffer, &ReadLen, pdMS_TO_TICKS(5000));
|
|
|
+ if(recvRet == E_OK)
|
|
|
+ {
|
|
|
+ memset(ATSendDataBuffer, 0x00, sizeof(ATSendDataBuffer));
|
|
|
+ sprintf(ATSendDataBuffer, "AT+CFTPSLOGIN=\"%s\",%s,\"%s\",\"%s\",0\r\n", ftpServerIpPtr, ftpServerPort, accountPtr, passwordPtr);
|
|
|
+ UART_Send_Data(UART_LPUART1, ATSendDataBuffer, mstrlen(ATSendDataBuffer), pdMS_TO_TICKS(100));
|
|
|
+ recvRet = AtcmdDelayRecvFunc(UART_LPUART1, (char *)("+CFTPSLOGIN: 0"), 30000);
|
|
|
+ if (recvRet == 0)
|
|
|
+ {
|
|
|
+ ftp_process++;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ DeviceErrNum = 11;
|
|
|
+ ftp_EndFlg = 1;
|
|
|
+ }
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- DeviceErrNum = 11;
|
|
|
+ DeviceErrNum = 9;
|
|
|
ftp_EndFlg = 1;
|
|
|
}
|
|
|
+
|
|
|
break;
|
|
|
}
|
|
|
case 2: // transmit bin file from server to module
|