SSLM1 / 2_GPS_GMS6-CR6

Dependents:   2-1_GMS6-CR6 5_flightmode 5-2_thrustermode 5-3_thruster_depressmode ... more

Revision:
1:cefba0edfdd3
Parent:
0:e504e33078a7
Child:
2:98e44a8cca1d
diff -r e504e33078a7 -r cefba0edfdd3 GMS6_CR6.cpp
--- a/GMS6_CR6.cpp	Mon Jul 13 07:16:30 2020 +0000
+++ b/GMS6_CR6.cpp	Mon Jul 13 10:14:44 2020 +0000
@@ -23,7 +23,7 @@
     char  gps_data[256];
     memset(gps_data, '\0', 256);
     
-    int   cnt_gps;
+    int cnt_gps = 0;
     
     float world_time;
     int rlock, sat_num;
@@ -33,7 +33,7 @@
     float lat_north = 0;
     int i = 0;
     
-    while(lat_north < 20 && i < 1000000)                        //緯度が20度以上と測定されるまたは一定回数ループが回ると抜ける
+    while(lat_north < 20 && i < 100000)                        //緯度が20度以上と測定されるまたは一定回数ループが回ると抜ける
     {   
         if(gps.readable())
         {
@@ -63,14 +63,14 @@
         i++;
     }
         
-    if(lat_north > 20 && lon_east > 100)           //緯度が正常な値のときのみ値を返す
+    if(lat_north > 20 && lat_north < 90 && lon_east > 90 && lon_east < 180)           //緯度が正常な値のときのみ値を返す
     {
         *G = lat_north;
         *(G+1) = lon_east;
     }
     else
     {
-        *G = 0;
-        *(G+1) = 0;
+        *G = 4;
+        *(G+1) = 4;
     }
 }
\ No newline at end of file