Fix #22 by adding 1hz and 5hz position fix update commands. Update echo example to show command usage.

This commit is contained in:
Tony DiCola 2014-08-07 12:00:36 -07:00
parent deef2c00ff
commit 11cb409ead
2 changed files with 12 additions and 0 deletions

View File

@ -29,9 +29,15 @@ All text above must be included in any redistribution
#endif #endif
// different commands to set the update rate from once a second (1 Hz) to 10 times a second (10Hz) // different commands to set the update rate from once a second (1 Hz) to 10 times a second (10Hz)
// Note that these only control the rate at which the position is echoed, to actually speed up the
// position fix you must also send one of the position fix rate commands below too.
#define PMTK_SET_NMEA_UPDATE_1HZ "$PMTK220,1000*1F" #define PMTK_SET_NMEA_UPDATE_1HZ "$PMTK220,1000*1F"
#define PMTK_SET_NMEA_UPDATE_5HZ "$PMTK220,200*2C" #define PMTK_SET_NMEA_UPDATE_5HZ "$PMTK220,200*2C"
#define PMTK_SET_NMEA_UPDATE_10HZ "$PMTK220,100*2F" #define PMTK_SET_NMEA_UPDATE_10HZ "$PMTK220,100*2F"
// Position fix update rate commands.
#define PMTK_API_SET_FIX_CTL_1HZ "$PMTK300,1000,0,0,0,0*1C"
#define PMTK_API_SET_FIX_CTL_5HZ "$PMTK300,200,0,0,0,0*2F"
// Can't fix position faster than 5 times a second!
#define PMTK_SET_BAUD_57600 "$PMTK251,57600*2C" #define PMTK_SET_BAUD_57600 "$PMTK251,57600*2C"

View File

@ -70,12 +70,18 @@ void setup()
//GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_ALLDATA); //GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_ALLDATA);
// Set the update rate // Set the update rate
// Note you must send both commands below to change both the output rate (how often the position
// is written to the serial line), and the position fix rate.
// 1 Hz update rate // 1 Hz update rate
//GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ); //GPS.sendCommand(PMTK_SET_NMEA_UPDATE_1HZ);
//GPS.sendCommand(PMTK_API_SET_FIX_CTL_1HZ);
// 5 Hz update rate- for 9600 baud you'll have to set the output to RMC or RMCGGA only (see above) // 5 Hz update rate- for 9600 baud you'll have to set the output to RMC or RMCGGA only (see above)
GPS.sendCommand(PMTK_SET_NMEA_UPDATE_5HZ); GPS.sendCommand(PMTK_SET_NMEA_UPDATE_5HZ);
GPS.sendCommand(PMTK_API_SET_FIX_CTL_5HZ);
// 10 Hz update rate - for 9600 baud you'll have to set the output to RMC only (see above) // 10 Hz update rate - for 9600 baud you'll have to set the output to RMC only (see above)
// Note the position can only be updated at most 5 times a second so it will lag behind serial output.
//GPS.sendCommand(PMTK_SET_NMEA_UPDATE_10HZ); //GPS.sendCommand(PMTK_SET_NMEA_UPDATE_10HZ);
//GPS.sendCommand(PMTK_API_SET_FIX_CTL_5HZ);
// Request updates on antenna status, comment out to keep quiet // Request updates on antenna status, comment out to keep quiet
GPS.sendCommand(PGCMD_ANTENNA); GPS.sendCommand(PGCMD_ANTENNA);