瀏覽代碼

GPS测试,写入文件

CHENJIE-PC\QiXiang_CHENJIE 4 年之前
父節點
當前提交
66533ef0ee
共有 2 個文件被更改,包括 43 次插入39 次删除
  1. 33 32
      src/app.c
  2. 10 7
      src/hal_module_adapter.c

+ 33 - 32
src/app.c

@@ -725,7 +725,7 @@ static void Can_Task(void* arg)
     volatile bool Can_Flag=false;
     PROC_CAN_STATE_SWITCH(PROCESS_CAN_STATE_IDLE);
     posGGAServiceStart(GGACallBack);
-
+    posGGAReset();
     while(1)
     {
         switch(gProcess_Can_Task)
@@ -746,10 +746,11 @@ static void Can_Task(void* arg)
 	            }
                 osMessageQueueGet(gpsMsgQueue, &Gps_Data, 0, 1000);
                 #ifdef USING_PRINTF	
-                    printf("Gpsmsgqueue: %d,%d,%d,%d\r\n\n",Gps_Data.latitude,Gps_Data.longitude,Gps_Data.speed,Gps_Data.direction);
+                    printf("Gpsmsgqueue: %d,%d,%d,%d\r\n",Gps_Data.latitude,Gps_Data.longitude,Gps_Data.speed,Gps_Data.direction);
                 #endif 
-
-                
+                #ifdef BL_FILE_LOG
+	                bluejoy_printf(BL_LEVEL3,"Gpsmsgqueue: %d,%d,%d,%d\r\n",Gps_Data.latitude,Gps_Data.longitude,Gps_Data.speed,Gps_Data.direction);
+                #endif
                 //can采用先接收后发送的策略
                 HAL_Can_Receive(Can_Rece_buffer);
                 if (Can_Rece_buffer[0]!=0xff)//满足can发送使能
@@ -1232,7 +1233,7 @@ static void Tcp_Task(void* arg)
                                 printf("TCP connect unresolved dns\n");
                             #endif
                             #ifdef BL_FILE_LOG
-	                            bluejoy_printf(BL_LEVEL3,"TCP connect unresolved dns\n");
+	                            //bluejoy_printf(BL_LEVEL3,"TCP connect unresolved dns\n");
                             #endif
                         }
                         Tcp_statuts=2;
@@ -1250,7 +1251,7 @@ static void Tcp_Task(void* arg)
                                 printf("socket create error\n");
                             #endif
                             #ifdef BL_FILE_LOG
-	                            bluejoy_printf(BL_LEVEL3,"socket create error\n");
+	                            //bluejoy_printf(BL_LEVEL3,"socket create error\n");
                             #endif
                             Tcp_statuts=1;
                         }
@@ -1277,7 +1278,7 @@ static void Tcp_Task(void* arg)
                             if(Reconnect_Num>=20)
                             {
                                 #ifdef BL_FILE_LOG
-	                                bluejoy_printf(BL_LEVEL3,"20 Connect failed!%d,Reconnect:%d\n",TcpconnectID,Reconnect_Num);
+	                                //bluejoy_printf(BL_LEVEL3,"20 Connect failed!%d,Reconnect:%d\n",TcpconnectID,Reconnect_Num);
                                 #endif
                                 appSetCFUN(0);
                                 osDelay(10);
@@ -1339,29 +1340,29 @@ static void Tcp_Task(void* arg)
                             *(TcpSendBuffer+23) = data_index;//数据长度
                             memcpy(TcpSendBuffer+24,battbuffer,data_index);
                             *(TcpSendBuffer+NB_send_len-1) = bcc_chk(TcpSendBuffer,NB_send_len-1);
-                            #ifdef USING_PRINTF
-                                printf("battbuffer:");
-                                for (int i = 0; i < data_index; i++)
-                                {
-                                    printf("%x ",battbuffer[i]);
-                                }
-                                printf("\n");
-                            #endif
+                            // #ifdef USING_PRINTF
+                            //     printf("battbuffer:");
+                            //     for (int i = 0; i < data_index; i++)
+                            //     {
+                            //         printf("%x ",battbuffer[i]);
+                            //     }
+                            //     printf("\n");
+                            //#endif
                             TcpsendID = send(sockfd, TcpSendBuffer, NB_send_len, 0 );
                             //发送失败
-                            #ifdef USING_PRINTF
-                                printf("ConnectID:%d,TcpSend:%d,data length:%d,Data:  ",sockfd,TcpsendID,NB_send_len);
-                                for (int i = 0; i < NB_send_len; i++)
-                                {
-                                    printf("%x ",*(TcpSendBuffer+i));
-                                }
-                                printf("\n");
-                            #endif
+                           // #ifdef USING_PRINTF
+                            //     printf("ConnectID:%d,TcpSend:%d,data length:%d,Data:  ",sockfd,TcpsendID,NB_send_len);
+                            //     for (int i = 0; i < NB_send_len; i++)
+                            //     {
+                            //         printf("%x ",*(TcpSendBuffer+i));
+                            //     }
+                            //     printf("\n");
+                            // #endif
                             free(TcpSendBuffer);
                             if (TcpsendID<0)
                             {
                                 #ifdef BL_FILE_LOG
-	                                bluejoy_printf(BL_LEVEL3,"send failed,ConnectID:%d,TcpSend:%d,data length:%d\n",sockfd,TcpsendID,NB_send_len);
+	                                //bluejoy_printf(BL_LEVEL3,"send failed,ConnectID:%d,TcpSend:%d,data length:%d\n",sockfd,TcpsendID,NB_send_len);
                                 #endif
                                 closesocket(sockfd);
                                 TcpconnectID = -1;
@@ -1391,14 +1392,14 @@ static void Tcp_Task(void* arg)
                             *(TcpSendBuffer+23) = data_index;//数据长度     
                             memcpy(TcpSendBuffer+24,gpsbuffer,data_index);
                             *(TcpSendBuffer+NB_send_len-1) = bcc_chk(TcpSendBuffer,NB_send_len-1);
-                            #ifdef USING_PRINTF
-                                printf("ConnectID:%d,TcpSend:%d,data length:%d,Data:  ",sockfd,TcpsendID,NB_send_len);
-                                for (int i = 0; i < NB_send_len; i++)
-                                {
-                                    printf("%x ",*(TcpSendBuffer+i));
-                                }
-                                printf("\n");
-                            #endif
+                            // #ifdef USING_PRINTF
+                            //     printf("ConnectID:%d,TcpSend:%d,data length:%d,Data:  ",sockfd,TcpsendID,NB_send_len);
+                            //     for (int i = 0; i < NB_send_len; i++)
+                            //     {
+                            //         printf("%x ",*(TcpSendBuffer+i));
+                            //     }
+                            //     printf("\n");
+                            // #endif
                             TcpsendID = send(sockfd, TcpSendBuffer, NB_send_len, 0 );
                             free(TcpSendBuffer);
                             if (TcpsendID<0)

+ 10 - 7
src/hal_module_adapter.c

@@ -2021,17 +2021,20 @@ static void GpsProcess(void* arg)
     {
 		//char temp[] = "$GNGGA,082626.00,2939.91801,N,10637.09500,E,1,03,2.34,-20.3,M,,M,,*40";
 		char temp[] = "$GNRMC,082626.000,A,2939.91801,N,10637.09500,E,0.543,30.254,261120,,,A,V*17";
-		osMessageQueueGet(gpsMsgHandle, &msg, 0, 5000);
+		osMessageQueueGet(gpsMsgHandle, &msg, 0, osWaitForever);
 		if (msg.dataPtr)
 		{		
 			void  *msgtemp = msg.dataPtr;//取指针
-			// #ifdef USING_PRINTF	
-			// 	printf("\nGpsProcess msgptr data:%s\r\n",msg.dataPtr);
-			// #endif
+			#ifdef USING_PRINTF	
+				//printf("\nGpsProcess msgptr data:%s\r\n",msg.dataPtr);
+			#endif
 			p = strtok(msg.dataPtr,delim);//将信息进行分割
-			// #ifdef USING_PRINTF	
-			// 	printf("\nP msgptr data:%s\r\n",p);
-			// #endif
+			#ifdef USING_PRINTF	
+				printf("\nP msgptr data:%s\r\n",p);
+			#endif
+			#ifdef BL_FILE_LOG
+	            bluejoy_printf(BL_LEVEL3,"\nP msgptr data:%s\r\n",p);
+            #endif
 			int i=0;
 			p = strtok(p,",");//只取第1行的信息RMC
 			//p = strtok(temp,",");//模拟测试