From 11cb409ead7d4579caf6a1dfd78e17a77cd2270c Mon Sep 17 00:00:00 2001 From: Tony DiCola Date: Thu, 7 Aug 2014 12:00:36 -0700 Subject: [PATCH] Fix #22 by adding 1hz and 5hz position fix update commands. Update echo example to show command usage. --- Adafruit_GPS.h | 6 ++++++ examples/echo/echo.pde | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/Adafruit_GPS.h b/Adafruit_GPS.h index 4788133..375cc6d 100755 --- a/Adafruit_GPS.h +++ b/Adafruit_GPS.h @@ -29,9 +29,15 @@ All text above must be included in any redistribution #endif // 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_5HZ "$PMTK220,200*2C" #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" diff --git a/examples/echo/echo.pde b/examples/echo/echo.pde index 0ca6641..42e7f26 100644 --- a/examples/echo/echo.pde +++ b/examples/echo/echo.pde @@ -70,12 +70,18 @@ void setup() //GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_ALLDATA); // 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 //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) 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) + // 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_API_SET_FIX_CTL_5HZ); // Request updates on antenna status, comment out to keep quiet GPS.sendCommand(PGCMD_ANTENNA);