Procházet zdrojové kódy

版本号为:2.1.0.10,修复Fota升级异常情况不回复问题,修复Gps发送频率问题,增加睡眠不成功重启记录

CHENJIE-PC\QiXiang_CHENJIE před 3 roky
rodič
revize
32cc815c19
4 změnil soubory, kde provedl 84 přidání a 48 odebrání
  1. 1 1
      inc/app.h
  2. 21 0
      src/Fota.c
  3. 3 0
      src/MainTask.c
  4. 59 47
      src/TcpTask.c

+ 1 - 1
inc/app.h

@@ -52,7 +52,7 @@ extern "C" {
 #define	DRVSWVERSION		0x01050000     //驱动层版本号V1.4.0.0  驱动层1.5.0.0,增加了三轴
 //#define	APPSWVERSION		0x01020209     
 //#define	APPSWVERSION		0x02000103
-#define	APPSWVERSION		0x02010009
+#define	APPSWVERSION		0x0201000A
 //--------------------------------------------------------------------------------
 
 #define APP_CONFIG_FILE_LATEST_VERSION 0

+ 21 - 0
src/Fota.c

@@ -131,7 +131,18 @@ void Fota_Func(UINT8 *DataPtr,INT32 connectId)
                 break;
             }
             default:
+            {
+                Fota_Answer[3] = 0x02;
+                memcpy(&Fota_Answer[4],(DataPtr+4),BATT_SN_LEN);
+                Fota_Answer[21] = TCP_ENCPT_DISABLE;
+                Fota_Answer[22] = 0x00;
+                Fota_Answer[23] = 0x12;
+                memcpy(&Fota_Answer[24],(DataPtr+24),18);
+                Fota_Answer[42] =  bcc_chk_fota(Fota_Answer,42);
+                tcpipConnectionSend(connectId,Fota_Answer,43,0,0,0);
                 break;
+            }
+                
         }
     }
     else if(*(DataPtr+30)==0x88)//BMS升级文件存放
@@ -242,7 +253,17 @@ void Fota_Func(UINT8 *DataPtr,INT32 connectId)
                 break;
             }
             default:
+            {
+                Fota_Answer[3] = 0x02;
+                memcpy(&Fota_Answer[4],(DataPtr+4),BATT_SN_LEN);
+                Fota_Answer[21] = TCP_ENCPT_DISABLE;
+                Fota_Answer[22] = 0x00;
+                Fota_Answer[23] = 0x12;
+                memcpy(&Fota_Answer[24],(DataPtr+24),18);
+                Fota_Answer[42] =  bcc_chk_fota(Fota_Answer,42);
+                tcpipConnectionSend(connectId,Fota_Answer,43,0,0,0);
                 break;
+            }
         }
     }
 }

+ 3 - 0
src/MainTask.c

@@ -297,6 +297,9 @@ static void MainTask(void* arg)
                     #endif
                     if(sleeptime_count>10)
                     {
+                        #ifdef DEBUGLOG
+                            Debug_printf("405\n");
+                        #endif
                         EC_SystemReset();
                     }
                 }

+ 59 - 47
src/TcpTask.c

@@ -306,9 +306,11 @@ static void TcpDataInfoAssembleSend()
             break;
         case 0x01:
             GpsSendFreq = AppDataInfo.GpsDisChrgInfoSendFreq/5;
+            BattSendFreq = AppDataInfo.BmsDisChrgInfoSendFreq/5;
             break;
         case 0x02:
             BattSendFreq = AppDataInfo.BmsChrgInfoSendFreq/5;
+            GpsSendFreq = AppDataInfo.GpsChrgInfoSendFreq/5;
             break;
         default:
             BattSendFreq = AppDataInfo.BmsDisChrgInfoSendFreq/5;
@@ -663,59 +665,72 @@ static void TcpDataInfoRecvHandle()
             }
             switch (Tcp_Cmd)
             {
-            case TCP_QUERY_SYM:
-                break;
-            case TCP_SETCMD_SYM:
-                break;
-            case TCP_CONCMD_SYM:
-            {
-                TcpCmdAnswer[2] = TCP_CONCMD_SYM;
-                if(*(Ptr+30)==0x01)//远程升级命令
-                {
-                    Fota_Func(Ptr,socContext.id);
-                }
-                else if(*(Ptr+30)==0x88)//BMS远程升级数据传输命令
-                {
-                    Fota_Func(Ptr,socContext.id);
-                }
-                else if(*(Ptr+30)==0x80)//远程锁定命令
+                case TCP_QUERY_SYM:
+                    break;
+                case TCP_SETCMD_SYM:
+                    break;
+                case TCP_CONCMD_SYM:
                 {
-                    //osMutexAcquire(UartMutex, osWaitForever);
-                    TcpCmdAnswer[3] = 0x01;
-                    memcpy(&TcpCmdAnswer[4],(Ptr+4),BATT_SN_LEN);
-                    TcpCmdAnswer[21] = TCP_ENCPT_DISABLE;
-                    TcpCmdAnswer[22] = 0x00;
-                    TcpCmdAnswer[23] = 0x06;
-                    memcpy(&TcpCmdAnswer[24],(Ptr+24),6);
-                    TcpCmdAnswer[30] = bcc_chk(TcpCmdAnswer,30);
-                    if(*(Ptr+31)==0x01)//0x01代表锁定
+                    TcpCmdAnswer[2] = TCP_CONCMD_SYM;
+                    if(*(Ptr+30)==0x01)//远程升级命令
+                    {
+                        Fota_Func(Ptr,socContext.id);
+                    }
+                    else if(*(Ptr+30)==0x88)//BMS远程升级数据传输命令
                     {
-                        AppNVMData.appDataModify = TRUE;
-                        AppNVMData.isBattLocked = TRUE;
-                        UartWriteCmd.WriteCmd = 0x01;
-                        UartWriteCmd.Data[0] = 0x00;
-                        UartWriteCmd.Data[1] = 0x00;
-                        if(battWorkState ==0x00)
+                        Fota_Func(Ptr,socContext.id);
+                    }
+                    else if(*(Ptr+30)==0x80)//远程锁定命令
+                    {
+                        //osMutexAcquire(UartMutex, osWaitForever);
+                        TcpCmdAnswer[3] = 0x01;
+                        memcpy(&TcpCmdAnswer[4],(Ptr+4),BATT_SN_LEN);
+                        TcpCmdAnswer[21] = TCP_ENCPT_DISABLE;
+                        TcpCmdAnswer[22] = 0x00;
+                        TcpCmdAnswer[23] = 0x06;
+                        memcpy(&TcpCmdAnswer[24],(Ptr+24),6);
+                        TcpCmdAnswer[30] = bcc_chk(TcpCmdAnswer,30);
+                        if(*(Ptr+31)==0x01)//0x01代表锁定
                         {
+                            AppNVMData.appDataModify = TRUE;
+                            AppNVMData.isBattLocked = TRUE;
+                            UartWriteCmd.WriteCmd = 0x01;
+                            UartWriteCmd.Data[0] = 0x00;
+                            UartWriteCmd.Data[1] = 0x00;
+                            if(battWorkState ==0x00)
+                            {
+                                osMessageQueuePut(UartWriteCmdHandle,&UartWriteCmd,0,1000);
+                            }
+                            tcpipConnectionSend(socContext.id,TcpCmdAnswer,31,0,0,0);
+                        }
+                        else                //0x02代表解锁
+                        {
+                            AppNVMData.appDataModify = TRUE;
+                            AppNVMData.isBattLocked = FALSE;
+                            UartWriteCmd.WriteCmd = 0x01;
+                            UartWriteCmd.Data[0] = 0x00;
+                            UartWriteCmd.Data[1] = 0x03;
                             osMessageQueuePut(UartWriteCmdHandle,&UartWriteCmd,0,1000);
+                            tcpipConnectionSend(socContext.id,TcpCmdAnswer,31,0,0,0);
                         }
-                        tcpipConnectionSend(socContext.id,TcpCmdAnswer,31,0,0,0);
+                        //osMutexRelease(UartMutex);
+                        TcpService=0x00;
+                        
                     }
-                    else                //0x02代表解锁
+                    else
                     {
-                        AppNVMData.appDataModify = TRUE;
-                        AppNVMData.isBattLocked = FALSE;
-                        UartWriteCmd.WriteCmd = 0x01;
-                        UartWriteCmd.Data[0] = 0x00;
-                        UartWriteCmd.Data[1] = 0x03;
-                        osMessageQueuePut(UartWriteCmdHandle,&UartWriteCmd,0,1000);
+                        TcpCmdAnswer[3] = 0x0f;
+                        memcpy(&TcpCmdAnswer[4],(Ptr+4),BATT_SN_LEN);
+                        TcpCmdAnswer[21] = TCP_ENCPT_DISABLE;
+                        TcpCmdAnswer[22] = 0x00;
+                        TcpCmdAnswer[23] = 0x06;
+                        memcpy(&TcpCmdAnswer[24],(Ptr+24),6);
+                        TcpCmdAnswer[30] = bcc_chk(TcpCmdAnswer,30);
                         tcpipConnectionSend(socContext.id,TcpCmdAnswer,31,0,0,0);
                     }
-                    //osMutexRelease(UartMutex);
-                    TcpService=0x00;
-                    
+                    break;
                 }
-                else
+                default:
                 {
                     TcpCmdAnswer[3] = 0x0f;
                     memcpy(&TcpCmdAnswer[4],(Ptr+4),BATT_SN_LEN);
@@ -725,11 +740,8 @@ static void TcpDataInfoRecvHandle()
                     memcpy(&TcpCmdAnswer[24],(Ptr+24),6);
                     TcpCmdAnswer[30] = bcc_chk(TcpCmdAnswer,30);
                     tcpipConnectionSend(socContext.id,TcpCmdAnswer,31,0,0,0);
+                    break;
                 }
-                break;
-            }
-            default:
-                break;
             }
         }
     free(TcpRecvData);