@@ -67,83 +67,52 @@ void setup()
6767 // myGPS.setAutoPVT(true); // Tell the GPS to "send" each solution automatically
6868 // myGPS.setAutoHPPOSLLH(false); // Library will poll each reading
6969
70- // This combination causes the PVT data to be overwritten by HPPOSLLH.
71- // But that's OK. Both sets of readings are still extracted OK.
7270 // myGPS.setAutoPVT(false); // Library will poll each reading
7371 // myGPS.setAutoHPPOSLLH(true); // Tell the GPS to "send" each hi res solution automatically
7472
7573 myGPS.setAutoPVT (true ); // Tell the GPS to "send" each solution automatically
7674 myGPS.setAutoHPPOSLLH (true ); // Tell the GPS to "send" each hi res solution automatically
77-
7875}
7976
8077void loop ()
8178{
82- Serial.println ();
83-
84- // PVT first
79+ // Calling getHPPOSLLH returns true if there actually is a fresh navigation solution available.
80+ // Calling getPVT returns true if there actually is a fresh navigation solution available.
81+ if ((myGPS.getHPPOSLLH ()) || (myGPS.getPVT ()))
82+ {
83+ Serial.println ();
84+
85+ long highResLatitude = myGPS.getHighResLatitude ();
86+ Serial.print (F (" Hi Res Lat: " ));
87+ Serial.print (highResLatitude);
8588
86- long latitude = myGPS.getLatitude ();
87- Serial.print (F (" Lat: " ));
88- Serial.print (latitude);
89-
90- long longitude = myGPS.getLongitude ();
91- Serial.print (F (" Long: " ));
92- Serial.print (longitude);
93-
94- long highResLatitude = myGPS.getHighResLatitude ();
95- Serial.print (F (" Hi Res Lat: " ));
96- Serial.print (highResLatitude);
97-
98- int highResLatitudeHp = myGPS.getHighResLatitudeHp ();
99- Serial.print (F (" " ));
100- Serial.print (highResLatitudeHp);
101-
102- long highResLongitude = myGPS.getHighResLongitude ();
103- Serial.print (F (" Hi Res Long: " ));
104- Serial.print (highResLongitude);
105-
106- int highResLongitudeHp = myGPS.getHighResLongitudeHp ();
107- Serial.print (F (" " ));
108- Serial.print (highResLongitudeHp);
109-
110- unsigned long horizAccuracy = myGPS.getHorizontalAccuracy ();
111- Serial.print (F (" Horiz accuracy: " ));
112- Serial.println (horizAccuracy);
113-
114- delay (750 );
115-
116- Serial.println ();
117-
118- // HPPOSLLH first
89+ int highResLatitudeHp = myGPS.getHighResLatitudeHp ();
90+ Serial.print (F (" " ));
91+ Serial.print (highResLatitudeHp);
11992
120- highResLatitude = myGPS.getHighResLatitude ();
121- Serial.print (F (" Hi Res Lat: " ));
122- Serial.print (highResLatitude);
123-
124- highResLatitudeHp = myGPS.getHighResLatitudeHp ();
125- Serial.print (F (" " ));
126- Serial.print (highResLatitudeHp);
127-
128- highResLongitude = myGPS.getHighResLongitude ();
129- Serial.print (F (" Hi Res Long: " ));
130- Serial.print (highResLongitude);
131-
132- highResLongitudeHp = myGPS.getHighResLongitudeHp ();
133- Serial.print (F (" " ));
134- Serial.print (highResLongitudeHp);
135-
136- horizAccuracy = myGPS.getHorizontalAccuracy ();
137- Serial.print (F (" Horiz accuracy: " ));
138- Serial.print (horizAccuracy);
139-
140- latitude = myGPS.getLatitude ();
141- Serial.print (F (" Lat: " ));
142- Serial.print (latitude);
143-
144- longitude = myGPS.getLongitude ();
145- Serial.print (F (" Long: " ));
146- Serial.println (longitude);
147-
148- delay (750 );
93+ long highResLongitude = myGPS.getHighResLongitude ();
94+ Serial.print (F (" Hi Res Long: " ));
95+ Serial.print (highResLongitude);
96+
97+ int highResLongitudeHp = myGPS.getHighResLongitudeHp ();
98+ Serial.print (F (" " ));
99+ Serial.print (highResLongitudeHp);
100+
101+ unsigned long horizAccuracy = myGPS.getHorizontalAccuracy ();
102+ Serial.print (F (" Horiz accuracy: " ));
103+ Serial.print (horizAccuracy);
104+
105+ long latitude = myGPS.getLatitude ();
106+ Serial.print (F (" Lat: " ));
107+ Serial.print (latitude);
108+
109+ long longitude = myGPS.getLongitude ();
110+ Serial.print (F (" Long: " ));
111+ Serial.println (longitude);
112+ }
113+ else
114+ {
115+ Serial.print (" ." );
116+ delay (50 );
117+ }
149118}
0 commit comments