Skip to content

Commit b101bd1

Browse files
committed
[GPS] support for fix quality and fix mode
Applied this PR: [support for fix quality and fix mode](mikalhart/TinyGPSPlus#38)
1 parent db6f022 commit b101bd1

3 files changed

Lines changed: 15 additions & 2 deletions

File tree

lib/TinyGPSPlus-1.0.2/library.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "TinyGPSPlus",
3-
"version": "1.0.0",
3+
"version": "1.0.2",
44
"keywords": "gps,NMEA",
55
"description": "A new, customizable Arduino NMEA parsing library",
66
"repository":

lib/TinyGPSPlus-1.0.2/src/TinyGPS++.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,7 @@ bool TinyGPSPlus::endOfTermHandler()
261261
break;
262262
case COMBINE(GPS_SENTENCE_GPGGA, 6): // Fix data (GPGGA)
263263
sentenceHasFix = term[0] > '0';
264+
location.newFixQuality = sentenceHasFix ? (FixQuality)(term[0] - '0') : Invalid;
264265
break;
265266
case COMBINE(GPS_SENTENCE_GPGGA, 7): // Satellites used (GPGGA)
266267
satellites.set(term);
@@ -271,6 +272,9 @@ bool TinyGPSPlus::endOfTermHandler()
271272
case COMBINE(GPS_SENTENCE_GPGGA, 9): // Altitude (GPGGA)
272273
altitude.set(term);
273274
break;
275+
case COMBINE(GPS_SENTENCE_GPRMC, 12):
276+
location.newFixMode = (FixMode)term[0];
277+
break;
274278
}
275279

276280
// Set custom values as needed
@@ -338,6 +342,8 @@ void TinyGPSLocation::commit()
338342
{
339343
rawLatData = rawNewLatData;
340344
rawLngData = rawNewLngData;
345+
fixQuality = newFixQuality;
346+
fixMode = newFixMode;
341347
lastCommitTime = millis();
342348
valid = updated = true;
343349
}

lib/TinyGPSPlus-1.0.2/src/TinyGPS++.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ struct RawDegrees
5050
{}
5151
};
5252

53+
enum FixQuality { Invalid = 0, GPS = 1, DGPS = 2, PPS = 3, RTK = 4, FloatRTK = 5, Estimated = 6, Manual = 7, Simulated = 8 };
54+
enum FixMode { N = 'N', A = 'A', D = 'D', E = 'E'};
55+
5356
struct TinyGPSLocation
5457
{
5558
friend class TinyGPSPlus;
@@ -61,8 +64,10 @@ struct TinyGPSLocation
6164
const RawDegrees &rawLng() { updated = false; return rawLngData; }
6265
double lat();
6366
double lng();
67+
FixQuality Quality() { updated = false; return fixQuality; }
68+
FixMode Mode() { updated = false; return fixMode; }
6469

65-
TinyGPSLocation() : valid(false), updated(false)
70+
TinyGPSLocation() : valid(false), updated(false), fixQuality(Invalid), newFixQuality(Invalid), fixMode(N), newFixMode(N)
6671
{}
6772

6873
private:
@@ -72,6 +77,8 @@ struct TinyGPSLocation
7277
void commit();
7378
void setLatitude(const char *term);
7479
void setLongitude(const char *term);
80+
FixQuality fixQuality, newFixQuality;
81+
FixMode fixMode, newFixMode;
7582
};
7683

7784
struct TinyGPSDate

0 commit comments

Comments
 (0)