mirror of
https://github.com/adafruit/Adafruit_GPS.git
synced 2026-10-26 22:10:17 +00:00
Merge pull request #171 from ladyada-eagleclaw/fix-glonass-galileo-sources
Accept GLONASS and Galileo NMEA source IDs
This commit is contained in:
3 files changed
+48
-10
No files matched your search
@@ -82,7 +82,7 @@ void setup() {
|
||||
// connect at 115200 so we can read the GPS fast enough and echo without dropping chars
|
||||
// also spit it out
|
||||
Serial.begin(115200);
|
||||
Serial.println("\r\nUltimate GPSlogger Shield");
|
||||
Serial.println(F("\r\nUltimate GPSlogger Shield"));
|
||||
pinMode(ledPin, OUTPUT);
|
||||
|
||||
// make sure that the default chip select pin is set to
|
||||
@@ -90,7 +90,7 @@ void setup() {
|
||||
pinMode(10, OUTPUT);
|
||||
|
||||
if (!SD.begin(chipSelect)) {
|
||||
Serial.println("Card init. failed!");
|
||||
Serial.println(F("Card init. failed!"));
|
||||
error(2);
|
||||
}
|
||||
char filename[15];
|
||||
@@ -106,11 +106,11 @@ void setup() {
|
||||
|
||||
logfile = SD.open(filename, FILE_WRITE);
|
||||
if( ! logfile ) {
|
||||
Serial.print("Couldnt create ");
|
||||
Serial.print(F("Couldnt create "));
|
||||
Serial.println(filename);
|
||||
error(3);
|
||||
}
|
||||
Serial.print("Writing to ");
|
||||
Serial.print(F("Writing to "));
|
||||
Serial.println(filename);
|
||||
|
||||
// connect to the GPS at the desired rate
|
||||
@@ -135,7 +135,7 @@ void setup() {
|
||||
useInterrupt(true);
|
||||
#endif
|
||||
|
||||
Serial.println("Ready!");
|
||||
Serial.println(F("Ready!"));
|
||||
}
|
||||
|
||||
|
||||
@@ -192,14 +192,14 @@ void loop() {
|
||||
return; // we can fail to parse a sentence in which case we should just wait for another
|
||||
|
||||
// Sentence parsed!
|
||||
Serial.println("OK");
|
||||
Serial.println(F("OK"));
|
||||
if (LOG_FIXONLY && !GPS.fix) {
|
||||
Serial.print("No Fix");
|
||||
Serial.print(F("No Fix"));
|
||||
return;
|
||||
}
|
||||
|
||||
// Rad. lets log it!
|
||||
Serial.println("Log");
|
||||
Serial.println(F("Log"));
|
||||
|
||||
uint8_t stringsize = strlen(stringptr);
|
||||
if (stringsize != logfile.write((uint8_t *)stringptr, stringsize)) //write the string to the SD file
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
#include <Adafruit_GPS.h>
|
||||
|
||||
Adafruit_GPS GPS;
|
||||
bool testsPassed = false;
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
// Wait briefly for the Serial Monitor on native USB boards.
|
||||
while (!Serial && millis() < 5000) {
|
||||
delay(10);
|
||||
}
|
||||
delay(250);
|
||||
Serial.println("Adafruit GPS GNSS source regression");
|
||||
|
||||
char glonass[] = "$GLGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*5B";
|
||||
if (!GPS.parse(glonass) || strcmp(GPS.lastSource, "GL")) {
|
||||
Serial.println("FAIL: GLONASS sentence was not parsed with source GL");
|
||||
return;
|
||||
}
|
||||
Serial.println("PASS: GLONASS sentence was parsed with source GL");
|
||||
|
||||
char galileo[] = "$GAGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*56";
|
||||
if (!GPS.parse(galileo) || strcmp(GPS.lastSource, "GA")) {
|
||||
Serial.println("FAIL: Galileo sentence was not parsed with source GA");
|
||||
return;
|
||||
}
|
||||
Serial.println("PASS: Galileo sentence was parsed with source GA");
|
||||
testsPassed = true;
|
||||
}
|
||||
|
||||
void loop() {
|
||||
if (testsPassed) {
|
||||
Serial.println("PASS: GNSS source regression");
|
||||
} else {
|
||||
Serial.println("FAIL: GNSS source regression");
|
||||
}
|
||||
delay(2000);
|
||||
}
|
||||
+2
-2
@@ -254,8 +254,8 @@ private:
|
||||
bool isEmpty(char *pStart);
|
||||
|
||||
// used by check() for validity tests, room for future expansion
|
||||
const char *sources[7] = {"II", "WI", "GP", "PG",
|
||||
"GN", "P", "ZZZ"}; ///< valid source ids
|
||||
const char *sources[9] = {"II", "WI", "GP", "PG", "GL",
|
||||
"GA", "GN", "P", "ZZZ"}; ///< valid source ids
|
||||
#ifdef NMEA_EXTENSIONS
|
||||
const char *sentences_parsed[21] = {"GGA", "GLL", "GSA", "RMC", "DBT", "HDM",
|
||||
"HDT", "MDA", "MTW", "MWV", "RMB", "TOP",
|
||||
|
||||
Reference in new issue
Block a user