|
@@ -161,6 +161,11 @@ void Uart_4G_Task(void *pvParameters)
|
|
PROC_TCP_STATE_SWITCH(PROCESS_TCP_ERROR);
|
|
PROC_TCP_STATE_SWITCH(PROCESS_TCP_ERROR);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ if(Fota_error_flag==1)
|
|
|
|
+ {
|
|
|
|
+ SocketId = -1;
|
|
|
|
+ PROC_TCP_STATE_SWITCH(PROCESS_TCP_ERROR);
|
|
|
|
+ }
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
case PROCESS_TCP_RECV: // 网络数据接收,100ms空闲状态下即可接收
|
|
case PROCESS_TCP_RECV: // 网络数据接收,100ms空闲状态下即可接收
|
|
@@ -190,13 +195,14 @@ void Uart_4G_Task(void *pvParameters)
|
|
{
|
|
{
|
|
vTaskDelay(pdMS_TO_TICKS(1000));
|
|
vTaskDelay(pdMS_TO_TICKS(1000));
|
|
tcpErrorCounter++;
|
|
tcpErrorCounter++;
|
|
- if (tcpErrorCounter > 60 || TcpSysReboot == 1) // 无法驻网或者联网
|
|
|
|
|
|
+ if (tcpErrorCounter > 60 || TcpSysReboot == 1||Fota_error_flag == 1) // 无法驻网或者联网或者FTP失败
|
|
{
|
|
{
|
|
Dio_WriteChannel(DioConf_DioChannel_PTA7_GPIO_OUT_MCU_4G_PWRKEY, STD_ON);
|
|
Dio_WriteChannel(DioConf_DioChannel_PTA7_GPIO_OUT_MCU_4G_PWRKEY, STD_ON);
|
|
vTaskDelay(pdMS_TO_TICKS(2500));
|
|
vTaskDelay(pdMS_TO_TICKS(2500));
|
|
Dio_WriteChannel(DioConf_DioChannel_PTA7_GPIO_OUT_MCU_4G_PWRKEY, STD_OFF);
|
|
Dio_WriteChannel(DioConf_DioChannel_PTA7_GPIO_OUT_MCU_4G_PWRKEY, STD_OFF);
|
|
vTaskDelay(pdMS_TO_TICKS(2500));
|
|
vTaskDelay(pdMS_TO_TICKS(2500));
|
|
tcpErrorCounter = 0;
|
|
tcpErrorCounter = 0;
|
|
|
|
+ Fota_error_flag = 0;
|
|
PROC_TCP_STATE_SWITCH(PROCESS_TCP_INIT);
|
|
PROC_TCP_STATE_SWITCH(PROCESS_TCP_INIT);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
@@ -944,7 +950,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,},%s",
|
|
|
|
|
|
+ %.2f,%.2f,%.2f,%.2f,%.2f,},%s,%d",
|
|
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],
|
|
|
|
|
|
@@ -952,7 +958,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],tmp);
|
|
|
|
|
|
+ returnP[2][0], returnP[2][1], returnP[2][2], returnP[2][3], returnP[2][4],tmp,DeviceErrNum);
|
|
|
|
|
|
BufferLen = strlen((const char *)rbuf);
|
|
BufferLen = strlen((const char *)rbuf);
|
|
*SendLen = BufferLen + sizeof(DebugMsgInfo);
|
|
*SendLen = BufferLen + sizeof(DebugMsgInfo);
|
|
@@ -1085,8 +1091,8 @@ void TcpDataEncode(uint8 DataIdx,uint32 *PtrSendAddr, uint16 *SendLen)
|
|
*(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
|
|
*(SendBuffer + 0x25) = (CSQValue & 0xFF); // uint8 csq
|
|
*(SendBuffer + 0x25) = (CSQValue & 0xFF); // uint8 csq
|
|
- *(SendBuffer + 0x26) = (BMS_Mode & 0xFF); // uint8 电池管理系统工作状态,0-初始化 1-自检完成允许上电 2-运行状态 3-高压切断 4-故障状态,精度_1,偏移量_0,单位_
|
|
|
|
- *(SendBuffer + 0x27) = (BMS_CharGunSt & 0xFF); // uint8 直流充电枪连接状态,0-未连接 1-单枪连接 2-双枪连接 3-无效,精度_1,偏移量_0,单位_
|
|
|
|
|
|
+ *(SendBuffer + 0x26) = (BMS_Mode & 0xFF); // uint8 BMS当前状态,0:预留;1:高压上电;2:高压下电;3:无效;,Re-1,Off-0,
|
|
|
|
+ *(SendBuffer + 0x27) = (BMS_CharGunSt & 0xFF); // uint8 直流充电枪连接状态,0:未连接1 : 连接, Re - 1, Off - 0,
|
|
*(SendBuffer + 0x28) = (BMS_FtLvl & 0xFF); // uint8 当前最高故障等级,0-正常 1-1级 轻微故障 2-2级 较严重故障 3-3级 最严重故障,精度_1,偏移量_0,单位_
|
|
*(SendBuffer + 0x28) = (BMS_FtLvl & 0xFF); // uint8 当前最高故障等级,0-正常 1-1级 轻微故障 2-2级 较严重故障 3-3级 最严重故障,精度_1,偏移量_0,单位_
|
|
*(SendBuffer + 0x29) = (BMS_FtCode & 0xFF); // uint8 故障码,见BMS_ErrCode,精度_1,偏移量_0,单位_
|
|
*(SendBuffer + 0x29) = (BMS_FtCode & 0xFF); // uint8 故障码,见BMS_ErrCode,精度_1,偏移量_0,单位_
|
|
*(SendBuffer + 0x2A) = (BMS_ReqHVOff & 0xFF); // uint8 BMS下高压请求,0-无效 1-请求下高压 2-不请求下高压 3-无效,精度_1,偏移量_0,单位_
|
|
*(SendBuffer + 0x2A) = (BMS_ReqHVOff & 0xFF); // uint8 BMS下高压请求,0-无效 1-请求下高压 2-不请求下高压 3-无效,精度_1,偏移量_0,单位_
|
|
@@ -1581,6 +1587,7 @@ void Fota_Ftp(uint8 *dataPtrIn)
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
|
|
+ DeviceErrNum = 10;
|
|
ftp_EndFlg = 1;
|
|
ftp_EndFlg = 1;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -1597,6 +1604,7 @@ void Fota_Ftp(uint8 *dataPtrIn)
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
|
|
+ DeviceErrNum = 11;
|
|
ftp_EndFlg = 1;
|
|
ftp_EndFlg = 1;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -1613,6 +1621,7 @@ void Fota_Ftp(uint8 *dataPtrIn)
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
|
|
+ DeviceErrNum = 12;
|
|
ftp_EndFlg = 1;
|
|
ftp_EndFlg = 1;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -1629,6 +1638,7 @@ void Fota_Ftp(uint8 *dataPtrIn)
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
|
|
+ DeviceErrNum = 13;
|
|
ftp_EndFlg = 1;
|
|
ftp_EndFlg = 1;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
@@ -1758,16 +1768,19 @@ void Fota_Ftp(uint8 *dataPtrIn)
|
|
if (getDataLenErrCount < 50 && Hal_FlsCheckIsTransferSucceed() == TRUE)
|
|
if (getDataLenErrCount < 50 && Hal_FlsCheckIsTransferSucceed() == TRUE)
|
|
{
|
|
{
|
|
ftp_process++;
|
|
ftp_process++;
|
|
|
|
+ Fota_update_flag = 1;
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
ftp_process++;
|
|
ftp_process++;
|
|
|
|
+ DeviceErrNum = 15;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
ftp_process++;
|
|
ftp_process++;
|
|
|
|
+ DeviceErrNum = 14;
|
|
}
|
|
}
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
@@ -1777,7 +1790,6 @@ void Fota_Ftp(uint8 *dataPtrIn)
|
|
sprintf(ATSendDataBuffer, "AT+FSDEL=*.*\r\n");
|
|
sprintf(ATSendDataBuffer, "AT+FSDEL=*.*\r\n");
|
|
UART_Query_Data(UART_LPUART1, UART_LPUART1, ATSendDataBuffer, mstrlen(ATSendDataBuffer), UartRecvBuffer, &ReadLen, pdMS_TO_TICKS(5000));
|
|
UART_Query_Data(UART_LPUART1, UART_LPUART1, ATSendDataBuffer, mstrlen(ATSendDataBuffer), UartRecvBuffer, &ReadLen, pdMS_TO_TICKS(5000));
|
|
ftp_process++;
|
|
ftp_process++;
|
|
- Fota_update_flag = TRUE;
|
|
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
default:
|
|
default:
|
|
@@ -1785,7 +1797,7 @@ void Fota_Ftp(uint8 *dataPtrIn)
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- if (ftp_process < 6)
|
|
|
|
|
|
+ if (Fota_update_flag==0)
|
|
{
|
|
{
|
|
Fota_error_flag = 1;
|
|
Fota_error_flag = 1;
|
|
}
|
|
}
|