cosmicpi-arduino_V1.6/gps_reading.ino
James Devine 4223aa4973
fixed some bugs before shipping
You need to connect the raspberry pi over a cable! Otherwise the EMC breaks events.
2019-08-06 19:55:58 +02:00

50 lines
1.8 KiB
C++

// WARNING: One up the spout !!
// The GPS chip puts the next nmea string in its output buffer
// only if its been read, IE its empty.
// So if you read infrequently the string in the buffer is old and
// has the WRONG time !!! The string lies around like a bullet in
// the breach waiting for some mug.
//I don't know who wrote that comment.. I'm guessing it was Julian!
boolean pipeGPS() {
while (GPS.available()) {
char c[2];
c[0] = GPS.read();
c[1]='\0'; //null character for termination required.
//Serial.print(c);
WriteToOutputBuff(c);
}
}
// GPS setup
void GpsSetup() {
// definitions for different outputs
// only one of these strings can be used at a time
// otherwise they will overwrite each other
// for more information take a look at the QUECTEL L70 protocoll specification: http://docs-europe.electrocomponents.com/webdocs/147d/0900766b8147dbdd.pdf
#define RMCGGA "$PMTK314,0,1,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*28" // RCM & GGA
#define ZDA "$PMTK314,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0*29" // ZDA
#define GGAZDA "$PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0*28" // GGA & ZDA
#define GGA "$PMTK314,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29" // GGA
// gets the firmware version
#define FMWVERS "$PMTK605*31" // PMTK_Q_RELEASE
// Sets the update intervall
#define NORMAL "$PMTK220,1000*1F" // PMTK_SET_NMEA_UPDATE_1HZ
// disables updates for the antenna status (only Adafruit ultimate GPS?)
#define NOANTENNA "$PGCMD,33,0*6D" // PGCMD_NOAN
delay(5000); //added delay to give GPS time to boot.
GPS.println(NOANTENNA);
GPS.println(GGAZDA);
GPS.println(NORMAL);
GPS.println(FMWVERS);
delay(10000); //wait a bit longer and repeat just in case it hasn't booted
GPS.println(NOANTENNA);
GPS.println(GGAZDA);
GPS.println(NORMAL);
GPS.println(FMWVERS);
}