Forráskód Böngészése

GPS线程测试
1.数据在HAL文件中
2.定位没开启,数据无效

CHENJIE-PC\QiXiang_CHENJIE 4 éve
szülő
commit
a32f327413
1 módosított fájl, 31 hozzáadás és 16 törlés
  1. 31 16
      src/app.c

+ 31 - 16
src/app.c

@@ -330,14 +330,14 @@ uint8_t* Uart_Receive_func(Uart_Receive_Type Uart_Receive_Msg,uint8_t* Uart_Rece
     Uart_Send_buffer[7] = CRC_chk_buffer>>8;
     uint32_t timeout = 0x00000000;
     USARTdrv->Send(Uart_Send_buffer,8);
-    #ifdef USING_PRINTF
-    printf("Uart_Send_buffer:  ");
-    for(int i=0;i<8;i++)
-    {
-        printf("%x ",Uart_Send_buffer[i]);
-    }
-     printf("\n");
-    #endif
+    // #ifdef USING_PRINTF
+    // printf("Uart_Send_buffer:  ");
+    // for(int i=0;i<8;i++)
+    // {
+    //     printf("%x ",Uart_Send_buffer[i]);
+    // }
+    //  printf("\n");
+    // #endif
     USARTdrv->Receive(Uart_Rece_buffer,Data_Len);
     while((isRecvTimeout == false) && (isRecvComplete == false))
     {
@@ -356,14 +356,14 @@ uint8_t* Uart_Receive_func(Uart_Receive_Type Uart_Receive_Msg,uint8_t* Uart_Rece
         isRecvComplete = false;
         CRC_Rece_buffer =*(Uart_Rece_buffer+Data_Len-1)<<8|*(Uart_Rece_buffer+Data_Len-2);
         CRC_chk_buffer = crc_chk(Uart_Rece_buffer,Data_Len-2);
-        #ifdef USING_PRINTF
-            printf("Uart_Rece_buffer: ");
-            for(int i=0;i<Data_Len;i++)
-            {
-            printf("%x ",*(Uart_Rece_buffer+i));
-            }
-            printf("crcchk:%x,%x\n ",CRC_chk_buffer,CRC_Rece_buffer);
-        #endif
+        // #ifdef USING_PRINTF
+        //     printf("Uart_Rece_buffer: ");
+        //     for(int i=0;i<Data_Len;i++)
+        //     {
+        //     printf("%x ",*(Uart_Rece_buffer+i));
+        //     }
+        //     printf("crcchk:%x,%x\n ",CRC_chk_buffer,CRC_Rece_buffer);
+        // #endif
         if (CRC_Rece_buffer == CRC_chk_buffer)//满足校验
         {
             return Uart_Rece_buffer;//此处指针移位出现重启问题
@@ -383,6 +383,14 @@ uint8_t* Uart_Receive_func(Uart_Receive_Type Uart_Receive_Msg,uint8_t* Uart_Rece
     }
 
 
+}
+void GGACallBack(UINT8 res, UINT8 * params)
+{
+#ifdef USING_PRINTF	
+	printf("GPS:len=%d,data=%s\r\n",res,params);
+#else
+       ECOMM_STRING(UNILOG_PLA_STRING, GPS_DATA, P_INFO, "gps:%s", params);
+#endif
 }
 //Uart线程
 static void Uart_Task(void* arg)
@@ -437,8 +445,13 @@ static void Uart_Task(void* arg)
             case PROCESS_UART_STATE_WORK:
             {
                 NetSocDisplay(LED_SOC_1,LED_TURN_ON);
+                #ifdef USING_PRINTF
+                        printf("Uart work!\n");
+                #endif
+                posGGAServiceStart(GGACallBack);
                 Uart_task = false;
                 Uart_Rece_buffer = (uint8_t *)malloc(Uart_Rece_LEN);
+                
                 while(!Uart_task)
                 {
                     switch (Rece_index)
@@ -551,6 +564,7 @@ static void Uart_Task(void* arg)
             }
             case PROCESS_UART_STATE_SLEEP:
             {
+                posGGAServiceStop();
                 slpManPlatVoteEnableSleep(UartSlpHandler, SLP_SLP2_STATE);
                 while(true)
                 {
@@ -840,6 +854,7 @@ void appInit(void *arg)
     Main_Task_Init();
     Uart_Task_Init();
     Can_Task_Init();
+    GpsTaskInit();
 }
 //主函数入口
 void main_entry(void) {