Skip to content

Commit

Permalink
[GPS] support for fix quality and fix mode
Browse files Browse the repository at this point in the history
Applied this PR:
[support for fix quality and fix mode](mikalhart/TinyGPSPlus#38)
  • Loading branch information
TD-er committed Dec 21, 2018
1 parent 346ff67 commit 36a44ca
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/TinyGPSPlus-1.0.2/library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "TinyGPSPlus",
"version": "1.0.0",
"version": "1.0.2",
"keywords": "gps,NMEA",
"description": "A new, customizable Arduino NMEA parsing library",
"repository":
Expand Down
6 changes: 6 additions & 0 deletions lib/TinyGPSPlus-1.0.2/src/TinyGPS++.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,7 @@ bool TinyGPSPlus::endOfTermHandler()
break;
case COMBINE(GPS_SENTENCE_GPGGA, 6): // Fix data (GPGGA)
sentenceHasFix = term[0] > '0';
location.newFixQuality = sentenceHasFix ? (FixQuality)(term[0] - '0') : Invalid;
break;
case COMBINE(GPS_SENTENCE_GPGGA, 7): // Satellites used (GPGGA)
satellites.set(term);
Expand All @@ -271,6 +272,9 @@ bool TinyGPSPlus::endOfTermHandler()
case COMBINE(GPS_SENTENCE_GPGGA, 9): // Altitude (GPGGA)
altitude.set(term);
break;
case COMBINE(GPS_SENTENCE_GPRMC, 12):
location.newFixMode = (FixMode)term[0];
break;
}

// Set custom values as needed
Expand Down Expand Up @@ -338,6 +342,8 @@ void TinyGPSLocation::commit()
{
rawLatData = rawNewLatData;
rawLngData = rawNewLngData;
fixQuality = newFixQuality;
fixMode = newFixMode;
lastCommitTime = millis();
valid = updated = true;
}
Expand Down
9 changes: 8 additions & 1 deletion lib/TinyGPSPlus-1.0.2/src/TinyGPS++.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ struct RawDegrees
{}
};

enum FixQuality { Invalid = 0, GPS = 1, DGPS = 2, PPS = 3, RTK = 4, FloatRTK = 5, Estimated = 6, Manual = 7, Simulated = 8 };
enum FixMode { N = 'N', A = 'A', D = 'D', E = 'E'};

struct TinyGPSLocation
{
friend class TinyGPSPlus;
Expand All @@ -61,8 +64,10 @@ struct TinyGPSLocation
const RawDegrees &rawLng() { updated = false; return rawLngData; }
double lat();
double lng();
FixQuality Quality() { updated = false; return fixQuality; }
FixMode Mode() { updated = false; return fixMode; }

TinyGPSLocation() : valid(false), updated(false)
TinyGPSLocation() : valid(false), updated(false), fixQuality(Invalid), newFixQuality(Invalid), fixMode(N), newFixMode(N)
{}

private:
Expand All @@ -72,6 +77,8 @@ struct TinyGPSLocation
void commit();
void setLatitude(const char *term);
void setLongitude(const char *term);
FixQuality fixQuality, newFixQuality;
FixMode fixMode, newFixMode;
};

struct TinyGPSDate
Expand Down

0 comments on commit 36a44ca

Please sign in to comment.