Skip to content

Commit 2eea4fe

Browse files
committed
Correct the Lat/Lon printing in Examples 15 & 16
1 parent a5da8a2 commit 2eea4fe

File tree

2 files changed

+12
-22
lines changed

2 files changed

+12
-22
lines changed

examples/SARA-R5_Example15_GNSS_NTRIP_Caster_With_Callbacks/GNSS_Callbacks.ino

+6-11
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,17 @@ void pushGPGGA(NMEA_GGA_data_t nmeaData)
3030
// | | |
3131
void printPVTdata(UBX_NAV_PVT_data_t ubxDataStruct)
3232
{
33-
long latitude = ubxDataStruct.lat; // Print the latitude
33+
double latitude = ubxDataStruct.lat; // Print the latitude
3434
Serial.print(F("Lat: "));
35-
Serial.print(latitude / 10000000L);
36-
Serial.print(F("."));
37-
Serial.print(abs(latitude % 10000000L));
35+
Serial.print(latitude / 10000000.0, 7);
3836

39-
long longitude = ubxDataStruct.lon; // Print the longitude
37+
double longitude = ubxDataStruct.lon; // Print the longitude
4038
Serial.print(F(" Long: "));
41-
Serial.print(longitude / 10000000L);
42-
Serial.print(F("."));
43-
Serial.print(abs(longitude % 10000000L));
39+
Serial.print(longitude / 10000000.0, 7);
4440

45-
long altitude = ubxDataStruct.hMSL; // Print the height above mean sea level
41+
double altitude = ubxDataStruct.hMSL; // Print the height above mean sea level
4642
Serial.print(F(" Height: "));
47-
Serial.print(altitude);
48-
Serial.print(F(" (mm)"));
43+
Serial.print(altitude / 1000.0, 3);
4944

5045
uint8_t fixType = ubxDataStruct.fixType; // Print the fix type
5146
Serial.print(F(" Fix: "));

examples/SARA-R5_Example16_GNSS_NTRIP_Caster__Polling/SARA-R5_NTRIP_Client.ino

+6-11
Original file line numberDiff line numberDiff line change
@@ -220,22 +220,17 @@ bool checkConnection(int theSocket, bool connectionIsOpen)
220220
// See if new PVT data is available
221221
if (myGNSS.getPVT()) // getPVT will return true if fresh data is available
222222
{
223-
long latitude = myGNSS.getLatitude(); // Print the latitude
223+
double latitude = (double)myGNSS.getLatitude(); // Print the latitude
224224
Serial.print(F("checkConnection: Lat: "));
225-
Serial.print(latitude / 10000000L);
226-
Serial.print(F("."));
227-
Serial.print(abs(latitude % 10000000L));
225+
Serial.print(latitude / 10000000.0, 7);
228226

229-
long longitude = myGNSS.getLongitude(); // Print the longitude
227+
double longitude = (double)myGNSS.getLongitude(); // Print the longitude
230228
Serial.print(F(" Long: "));
231-
Serial.print(longitude / 10000000L);
232-
Serial.print(F("."));
233-
Serial.print(abs(longitude % 10000000L));
229+
Serial.print(longitude / 10000000.0, 7);
234230

235-
long altitude = myGNSS.getAltitudeMSL(); // Print the height above mean sea level
231+
double altitude = (double)myGNSS.getAltitudeMSL(); // Print the height above mean sea level
236232
Serial.print(F(" Height: "));
237-
Serial.print(altitude);
238-
Serial.print(F(" (mm)"));
233+
Serial.print(altitude / 1000.0, 3);
239234

240235
uint8_t fixType = myGNSS.getFixType(); // Print the fix type
241236
Serial.print(F(" Fix: "));

0 commit comments

Comments
 (0)