Skip to content

Commit b4c8e29

Browse files
Support for HDOP in its true decimal form: ddd.xx
1 parent f63678c commit b4c8e29

4 files changed

Lines changed: 17 additions & 10 deletions

File tree

examples/FullExample/FullExample.ino

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ void setup()
2424
Serial.print(F("Testing TinyGPS++ library v. ")); Serial.println(TinyGPSPlus::libraryVersion());
2525
Serial.println(F("by Mikal Hart"));
2626
Serial.println();
27-
Serial.println(F("Sats HDOP Latitude Longitude Fix Date Time Date Alt Course Speed Card Distance Course Card Chars Sentences Checksum"));
28-
Serial.println(F(" (deg) (deg) Age Age (m) --- from GPS ---- ---- to London ---- RX RX Fail"));
29-
Serial.println(F("---------------------------------------------------------------------------------------------------------------------------------------"));
27+
Serial.println(F("Sats HDOP Latitude Longitude Fix Date Time Date Alt Course Speed Card Distance Course Card Chars Sentences Checksum"));
28+
Serial.println(F(" (deg) (deg) Age Age (m) --- from GPS ---- ---- to London ---- RX RX Fail"));
29+
Serial.println(F("----------------------------------------------------------------------------------------------------------------------------------------"));
3030
}
3131

3232
void loop()
3333
{
3434
static const double LONDON_LAT = 51.508131, LONDON_LON = -0.128002;
3535

3636
printInt(gps.satellites.value(), gps.satellites.isValid(), 5);
37-
printInt(gps.hdop.value(), gps.hdop.isValid(), 5);
37+
printFloat(gps.hdop.hdop(), gps.hdop.isValid(), 6, 1);
3838
printFloat(gps.location.lat(), gps.location.isValid(), 11, 6);
3939
printFloat(gps.location.lng(), gps.location.isValid(), 12, 6);
4040
printInt(gps.location.age(), gps.location.isValid(), 5);
@@ -156,4 +156,4 @@ static void printStr(const char *str, int len)
156156
for (int i=0; i<len; ++i)
157157
Serial.print(i<slen ? str[i] : ' ');
158158
smartDelay(0);
159-
}
159+
}

examples/KitchenSink/KitchenSink.ino

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,10 @@ void loop()
139139
{
140140
Serial.print(F("HDOP Fix Age="));
141141
Serial.print(gps.hdop.age());
142-
Serial.print(F("ms Value="));
143-
Serial.println(gps.hdop.value());
142+
Serial.print(F("ms raw="));
143+
Serial.print(gps.hdop.value());
144+
Serial.print(F(" hdop="));
145+
Serial.println(gps.hdop.hdop());
144146
}
145147

146148
else if (millis() - last > 5000)

examples/UsingCustomFields/UsingCustomFields.ino

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
/*
55
This sample demonstrates TinyGPS++'s capacity for extracting custom
66
fields from any NMEA sentence. TinyGPS++ has built-in facilities for
7-
extracting latitude, longitude, altitude, etc., from the $GPGLL and
7+
extracting latitude, longitude, altitude, etc., from the $GPGGA and
88
$GPRMC sentences. But with the TinyGPSCustom type, you can extract
99
other NMEA fields, even from non-standard NMEA sentences.
1010

src/TinyGPS++.h

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
3131
#endif
3232
#include <limits.h>
3333

34-
#define _GPS_VERSION "1.0.1" // software version of this library
34+
#define _GPS_VERSION "1.0.2" // software version of this library
3535
#define _GPS_MPH_PER_KNOT 1.15077945
3636
#define _GPS_MPS_PER_KNOT 0.51444444
3737
#define _GPS_KMPH_PER_KNOT 1.852
@@ -184,6 +184,11 @@ struct TinyGPSAltitude : TinyGPSDecimal
184184
double feet() { return _GPS_FEET_PER_METER * value() / 100.0; }
185185
};
186186

187+
struct TinyGPSHDOP : TinyGPSDecimal
188+
{
189+
double hdop() { return value() / 100.0; }
190+
};
191+
187192
class TinyGPSPlus;
188193
class TinyGPSCustom
189194
{
@@ -225,7 +230,7 @@ class TinyGPSPlus
225230
TinyGPSCourse course;
226231
TinyGPSAltitude altitude;
227232
TinyGPSInteger satellites;
228-
TinyGPSDecimal hdop;
233+
TinyGPSHDOP hdop;
229234

230235
static const char *libraryVersion() { return _GPS_VERSION; }
231236

0 commit comments

Comments
 (0)