Browse Source

数据正确,上传网站没显示,休眠后定时换不醒。

CHENJIE-PC\QiXiang_CHENJIE 4 years ago
parent
commit
8986cac2cc
1 changed files with 38 additions and 38 deletions
  1. 38 38
      app.c

+ 38 - 38
app.c

@@ -52,9 +52,9 @@ uint8_t process1SlpHandler     = 0xff;
 uint8_t process2SlpHandler     = 0xff;
 uint8_t process3SlpHandler     = 0xff;
 uint8_t Can_Rece_buffer[8];
-uint16_t Batt_Cell_Num = 14;//默认数值
+uint16_t Batt_Cell_Num = 14;//默认数值14、17
 uint16_t Batt_Cell_Num_2 ;//默认数值
-uint16_t Batt_Temp_Num = 5;//默认数值
+uint16_t Batt_Temp_Num = 5;//默认数值5、7
 int16_t Uart_Rece_BattI;
 uint8_t battbuffer[73];//电池数据都存在此数组中————电压14,温度5
 /**
@@ -165,18 +165,18 @@ uint8_t* Uart_Receive_func(Uart_Receive_Type Uart_Receive_Msg,uint8_t *Uart_Rece
         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);  
         #ifdef USING_PRINTF
-            printf("Uart_Send_buffer:  ");
-            for(int i=0;i<8;i++)
-            {
-            printf("%x ",Uart_Send_buffer[i]);
-            }
-            printf("\n");
-            printf("Uart_Rece_buffer: ");
-            for(int i=0;i<Rece_Data_Len+5;i++)
-            {
-            printf("%x ",*(Uart_Rece_buffer+i));
-            }
-            printf("\n");
+            // printf("Uart_Send_buffer:  ");
+            // for(int i=0;i<8;i++)
+            // {
+            // printf("%x ",Uart_Send_buffer[i]);
+            // }
+            // printf("\n");
+            // printf("Uart_Rece_buffer: ");
+            // for(int i=0;i<Rece_Data_Len+5;i++)
+            // {
+            // printf("%x ",*(Uart_Rece_buffer+i));
+            // }
+            printf("uart_check_pass\n");
         #endif
         if (CRC_Rece_buffer == CRC_chk_buffer)//满足校验
         {
@@ -221,7 +221,7 @@ static void process0AppTask(void* arg)//任务调度程序
     NetSocDisplay(LED_SOC_2,LED_TURN_OFF);
     NetSocDisplay(LED_SOC_3,LED_TURN_OFF);
     FaultDisplay(LED_TURN_OFF);
-
+    NVIC_EnableIRQ(PadWakeup1_IRQn);
     slpManSetPmuSleepMode(true,SLP_HIB_STATE,false);
     slpManApplyPlatVoteHandle("process0slp",&process0SlpHandler);
     slpManPlatVoteDisableSleep(process0SlpHandler, SLP_SLP2_STATE); 
@@ -311,7 +311,7 @@ static void process0AppTask(void* arg)//任务调度程序
                 #ifdef USING_PRINTF
                         printf("ready to sleep \n");
                 #endif
-                slpManDeepSlpTimerStart(DEEPSLP_TIMER_ID7,180000); // create a 60s timer, DeepSleep Timer is always oneshoot
+                slpManDeepSlpTimerStart(7,10000); // create a 60s timer, DeepSleep Timer is always oneshoot
                 while(1)                // now app can enter hib, but ps and phy maybe not, so wait here
                 {
                     osDelay(3000);
@@ -387,14 +387,14 @@ static void process1AppTask(void* arg)
                         Uart_Receive_Msg.Reg_Num_H = Batt_Cell_Num>>8;
                         Uart_Receive_Msg.Reg_Num_L = Batt_Cell_Num;
                         Uart_Reve_Point = Uart_Receive_func(Uart_Receive_Msg,Uart_Rece_buffer);
-                        #ifdef USING_PRINTF
-                            printf("BattCellV: ");
-                            for (size_t i = 0; i < Batt_Cell_Num_2; i++)
-                            {
-                                printf("%x ",*(Uart_Reve_Point+i));
-                            }
-                            printf("\n");
-                        #endif
+                        // #ifdef USING_PRINTF
+                        //     printf("BattCellV: ");
+                        //     for (size_t i = 0; i < Batt_Cell_Num_2; i++)
+                        //     {
+                        //         printf("%x ",*(Uart_Reve_Point+i));
+                        //     }
+                        //     printf("\n");
+                        // #endif
                         battbuffer[30] = Batt_Cell_Num;
                         memcpy(&battbuffer[31],Uart_Reve_Point,Batt_Cell_Num_2);
                         break;
@@ -411,14 +411,14 @@ static void process1AppTask(void* arg)
                         {
                             battbuffer[32+Batt_Cell_Num_2+i] = *(Uart_Reve_Point+2*i+1);
                         }
-                        #ifdef USING_PRINTF
-                            printf("BattCellT: ");
-                            for (size_t i = 0; i < Batt_Temp_Num; i++)
-                            {
-                                printf("%x ",*(Uart_Reve_Point+i));
-                            }
-                            printf("\n");
-                        #endif
+                        // #ifdef USING_PRINTF
+                        //     printf("BattCellT: ");
+                        //     for (size_t i = 0; i < Batt_Temp_Num; i++)
+                        //     {
+                        //         printf("%x ",*(Uart_Reve_Point+2*i+1));
+                        //     }
+                        //     printf("\n");
+                        // #endif
                         break;
                     }
                     case 3://读取总电压,目前保护板只有一个电压
@@ -482,7 +482,6 @@ static void process2AppTask(void* arg)
 	PROC_Can_STATE_SWITCH(PROCESS_STATE_IDLE);
     slpManApplyPlatVoteHandle("process2slp",&process2SlpHandler);
     uint32_t Can_ID;
-    NVIC_EnableIRQ(PadWakeup1_IRQn);
     Can_InitType param;
     Can_TxMsgType Can_TxMsg;
     param.baudrate = CAN_500Kbps;
@@ -608,9 +607,9 @@ static void process2AppTask(void* arg)
                 //     }
                 //     printf("\n");
                 // #endif
-                #ifdef USING_PRINTF
-                        printf("CANsend :%x\n ",Can_ID);
-                #endif
+                // #ifdef USING_PRINTF
+                //         printf("CANsend :%x\n ",Can_ID);
+                // #endif
                 send_index ++;	
                 break;
             }
@@ -765,15 +764,16 @@ static void process3AppTask(void* arg)
                 // #ifdef USING_PRINTF
                 //     printf("[%d]Tcpchk:%#X \r\n",__LINE__,*(TcpSendBuffer+91));
                 // #endif
+                TcpSendID  = tcpipConnectionSend(TcpConnectID,TcpSendBuffer,NB_send_len,PNULL,PNULL,PNULL);
                 #ifdef USING_PRINTF
-                    printf("TcpSend:");
+                    printf("ConnectID:%d,TcpSend:%d,data length:%d,Data:  ",TcpConnectID,TcpSendID,NB_send_len);
                     for (int i = 0; i < NB_send_len; i++)
                     {
                         printf("%x ",*(TcpSendBuffer+i));
                     }
                     printf("\n ");
                 #endif
-                TcpSendID  = tcpipConnectionSend(TcpConnectID,TcpSendBuffer,NB_send_len,PNULL,PNULL,PNULL);
+
                 free(TcpSendBuffer);
                 PROC_NB_STATE_SWITCH(PROCESS_NB_STATE_IDLE);
                 break;