Browse Source

【测试】屏蔽NB发送,进行睡眠测试,发现不睡眠。

CHENJIE-PC\QiXiang_CHENJIE 4 years ago
parent
commit
f527f3167e
1 changed files with 25 additions and 14 deletions
  1. 25 14
      src/app.c

+ 25 - 14
src/app.c

@@ -220,7 +220,7 @@ uint8_t* Uart_Receive_func(Uart_Receive_Type Uart_Receive_Msg,uint8_t *Uart_Rece
     }
     if (isRecvComplete == true)
     {
-        Rece_Data_Len = *(Uart_Rece_buffer+2);
+        //Rece_Data_Len = *(Uart_Rece_buffer+2);
         isRecvComplete = false;
         CRC_Rece_buffer =*(Uart_Rece_buffer+Rece_Data_Len+4)<<8|*(Uart_Rece_buffer+Rece_Data_Len+3);
         CRC_chk_buffer = crc_chk(Uart_Rece_buffer,Rece_Data_Len+3);  
@@ -255,6 +255,7 @@ uint8_t* Uart_Receive_func(Uart_Receive_Type Uart_Receive_Msg,uint8_t *Uart_Rece
         osDelay(1000);
         return Uart_Rece_buffer;
     }
+    memset(Uart_Rece_buffer,0x00,Rece_Data_Len+5);
     return Uart_Rece_buffer;
 }
 void USART_callback(uint32_t event)
@@ -328,7 +329,6 @@ static void process0AppTask(void* arg)//任务调度程序
                 sleep_index++;
                 if(sleep_index>=50)
                 {
-                    NetSocDisplay(LED_SOC_0,LED_TURN_OFF);
                     sleep_index=0;
                     PROC_Task_STATE_SWITCH(PROCESS_STATE_SLEEP);
                 }
@@ -350,7 +350,7 @@ static void process0AppTask(void* arg)//任务调度程序
                     PROC_Can_STATE_SWITCH(PROCESS_STATE_WORK);
                     Can_index = 0;
                 }
-                if (NB_index >=1000)//NB 10s 调用一次
+                if (NB_index >=100)//NB 10s 调用一次
                 {
                     PROC_NB_STATE_SWITCH(PROCESS_NB_STATE_CONNECT);
                     NB_index = 0;
@@ -405,7 +405,13 @@ static void process0AppTask(void* arg)//任务调度程序
                 #endif
                 FaultDisplay(LED_TURN_ON);
                 slpManDeepSlpTimerStart(deepslpTimerID,60000); 
-                while(1);
+                //osDelay(60000/portTICK_PERIOD_MS);
+                while(1)
+                {
+                    osDelay(3000);
+                }
+                PROC_Task_STATE_SWITCH(PROCESS_STATE_IDLE);
+                break;
             }
         }
     }
@@ -571,11 +577,13 @@ static void process1AppTask(void* arg)
             {	
 			    free(Uart_Rece_buffer); 
                 slpManPlatVoteEnableSleep(process1SlpHandler, SLP_SLP2_STATE);  
-                while (1)
+                //osDelay(60000);      
+                //此处休眠
+                while(1);
                 {
-                    ;
+                    osDelay(3000);
                 }
-                
+                PROC_Uart_STATE_SWITCH(PROCESS_Uart_STATE_IDLE);
                 break;
             }
         }
@@ -771,11 +779,12 @@ static void process2AppTask(void* arg)
             case PROCESS_STATE_SLEEP:
             {   
                 slpManPlatVoteEnableSleep(process2SlpHandler, SLP_SLP2_STATE); 
-                while (1)
+                //osDelay(60000);
+                while(1)
                 {
-                    ;
-                }
-                                    
+                    osDelay(3000);
+                }          
+                PROC_Can_STATE_SWITCH(PROCESS_STATE_IDLE);                        
                 break;
             }
         }
@@ -870,7 +879,7 @@ static void process3AppTask(void* arg)
     CHAR SN[] = "GYTEST00000000003";
     CHAR   serverip[] = "47.97.127.222";
     UINT16 serverport = 8712;
-    int TcpConnectID = -1;
+    int TcpConnectID = 1;
     int TcpSendID = -1;
     int NB_send_len=59+Batt_Cell_Num_2+Batt_Temp_Num;//设定网络发送最大数值
     slpManApplyPlatVoteHandle("pro3",&process3SlpHandler);
@@ -892,7 +901,7 @@ static void process3AppTask(void* arg)
                 while(TcpConnectID<0)
                 {
                     
-                    TcpConnectID = tcpipConnectionCreate(1,PNULL,PNULL,serverip,serverport,TcpCallBack);
+                    //TcpConnectID = tcpipConnectionCreate(1,PNULL,PNULL,serverip,serverport,TcpCallBack);
                     osDelay(100);
                     #ifdef USING_PRINTF
                         printf("ConnectID:%d\n ",TcpConnectID);
@@ -934,7 +943,7 @@ static void process3AppTask(void* arg)
                 //     printf("[%d]Tcpchk:%#X \r\n",__LINE__,*(TcpSendBuffer+91));
                 // #endif
 
-                TcpSendID  = tcpipConnectionSend(TcpConnectID,TcpSendBuffer,NB_send_len,PNULL,PNULL,PNULL);
+                //TcpSendID  = tcpipConnectionSend(TcpConnectID,TcpSendBuffer,NB_send_len,PNULL,PNULL,PNULL);
                 // #ifdef USING_PRINTF
                 //     printf("ConnectID:%d,TcpSend:%d,data length:%d,Data:  ",TcpConnectID,TcpSendID,NB_send_len);
                 //     for (int i = 0; i < NB_send_len; i++)
@@ -952,7 +961,9 @@ static void process3AppTask(void* arg)
                 posGGAServiceStop();
 				free(TcpSendBuffer);
                 slpManPlatVoteEnableSleep(process3SlpHandler, SLP_SLP2_STATE);  // cancel the prohibition of sleep2
+                //osDelay(60000);
                 while(1);
+                PROC_NB_STATE_SWITCH(PROCESS_NB_STATE_IDLE);
                 break;                                     
             }
         }