diff --git a/src/Adafruit_GPS.cpp b/src/Adafruit_GPS.cpp index 786db49..b05870c 100644 --- a/src/Adafruit_GPS.cpp +++ b/src/Adafruit_GPS.cpp @@ -323,7 +323,9 @@ boolean Adafruit_GPS::parseFix(char *p) { @return nmea_float_t value in seconds since last fix. */ /**************************************************************************/ -nmea_float_t Adafruit_GPS::secondsSinceFix() { return (millis() - lastFix) / 1000.; } +nmea_float_t Adafruit_GPS::secondsSinceFix() { + return (millis() - lastFix) / 1000.; + } /**************************************************************************/ /*! @@ -332,7 +334,9 @@ nmea_float_t Adafruit_GPS::secondsSinceFix() { return (millis() - lastFix) / 100 @return nmea_float_t value in seconds since last GPS time. */ /**************************************************************************/ -nmea_float_t Adafruit_GPS::secondsSinceTime() { return (millis() - lastTime) / 1000.; } +nmea_float_t Adafruit_GPS::secondsSinceTime() { + return (millis() - lastTime) / 1000.; + } /**************************************************************************/ /*! @@ -341,7 +345,9 @@ nmea_float_t Adafruit_GPS::secondsSinceTime() { return (millis() - lastTime) / 1 @return nmea_float_t value in seconds since last GPS date. */ /**************************************************************************/ -nmea_float_t Adafruit_GPS::secondsSinceDate() { return (millis() - lastDate) / 1000.; } +nmea_float_t Adafruit_GPS::secondsSinceDate() { + return (millis() - lastDate) / 1000.; + } /**************************************************************************/ /*! diff --git a/src/Adafruit_GPS.h b/src/Adafruit_GPS.h index e78d633..1e20815 100644 --- a/src/Adafruit_GPS.h +++ b/src/Adafruit_GPS.h @@ -53,10 +53,10 @@ #if (defined(__AVR__) || defined(ESP8266)) && defined(USE_SW_SERIAL) #include #endif -#include -#include #include #include +#include +#include /// type for resulting code from running check() typedef enum { @@ -105,7 +105,7 @@ public: nmea_float_t secondsSinceTime(); nmea_float_t secondsSinceDate(); void resetSentTime(); - + boolean wakeup(void); boolean standby(void); @@ -129,10 +129,10 @@ public: uint8_t month; ///< GMT month uint8_t day; ///< GMT day - nmea_float_t latitude; ///< Floating point latitude value in degrees/minutes as - ///< received from the GPS (DDMM.MMMM) - nmea_float_t longitude; ///< Floating point longitude value in degrees/minutes as - ///< received from the GPS (DDDMM.MMMM) + nmea_float_t latitude; ///< Floating point latitude value in degrees/minutes + ///< as received from the GPS (DDMM.MMMM) + nmea_float_t longitude; ///< Floating point longitude value in degrees/minutes + ///< as received from the GPS (DDDMM.MMMM) /** Fixed point latitude and longitude value with degrees stored in units of 1/100000 degrees, and minutes stored in units of 1/100000 degrees. See pull @@ -147,17 +147,17 @@ public: nmea_float_t altitude; ///< Altitude in meters above MSL nmea_float_t speed; ///< Current speed over ground in knots nmea_float_t angle; ///< Course in degrees from true north - nmea_float_t magvariation; ///< Magnetic variation in degrees (vs. true north) - nmea_float_t HDOP; ///< Horizontal Dilution of Precision - relative accuracy of - ///< horizontal position - nmea_float_t VDOP; ///< Vertical Dilution of Precision - relative accuracy of - ///< vertical position - nmea_float_t PDOP; ///< Position Dilution of Precision - Complex maths derives a - ///< simple, single number for each kind of DOP - char lat = 'X'; ///< N/S - char lon = 'X'; ///< E/W - char mag = 'X'; ///< Magnetic variation direction - boolean fix; ///< Have a fix? + nmea_float_t magvariation; ///< Magnetic variation in degrees (vs. true north) + nmea_float_t HDOP; ///< Horizontal Dilution of Precision - relative accuracy + ///< of horizontal position + nmea_float_t VDOP; ///< Vertical Dilution of Precision - relative accuracy + ///< of vertical position + nmea_float_t PDOP; ///< Position Dilution of Precision - Complex maths derives + ///< a simple, single number for each kind of DOP + char lat = 'X'; ///< N/S + char lon = 'X'; ///< E/W + char mag = 'X'; ///< Magnetic variation direction + boolean fix; ///< Have a fix? uint8_t fixquality; ///< Fix quality (0, 1, 2 = Invalid, GPS, DGPS) uint8_t fixquality_3d; ///< 3D fix quality (1, 3, 3 = Nofix, 2D fix, 3D fix) uint8_t satellites; ///< Number of satellites in use diff --git a/src/NMEA_data.h b/src/NMEA_data.h index e10d855..5749d85 100644 --- a/src/NMEA_data.h +++ b/src/NMEA_data.h @@ -14,7 +14,7 @@ #define NMEA_MAX_SOURCE_ID \ 3 ///< maximum length of a source ID name, including terminating 0 -/************************************************************************* +/************************************************************************* doubles and floats are identical on AVR processors like the UNO where space is tight. doubles avoid the roundoff errors that led to the fixed point mods in https://github.com/adafruit/Adafruit-GPS-Library/pull/13, provided the @@ -40,18 +40,18 @@ typedef double can be converted back to an approximate float value with X = I / scale + offset - Only some tags have history in order to save memory. Most of the memory + Only some tags have history in order to save memory. Most of the memory cost is directly in the array. 192 history values taken every 20 seconds covers just over an hour. **************************************************************************/ typedef struct { - int16_t *data = NULL; ///< array of ints, oldest first - unsigned n = 0; ///< number of history array elements - uint32_t lastHistory = 0; ///< millis() when history was last updated - uint16_t historyInterval = 20; ///< seconds between history updates - nmea_float_t scale = 1.0; ///< history = (smoothed - offset) * scale - nmea_float_t offset = 0.0; ///< value = (float) history / scale + offset + int16_t *data = NULL; ///< array of ints, oldest first + unsigned n = 0; ///< number of history array elements + uint32_t lastHistory = 0; ///< millis() when history was last updated + uint16_t historyInterval = 20; ///< seconds between history updates + nmea_float_t scale = 1.0; ///< history = (smoothed - offset) * scale + nmea_float_t offset = 0.0; ///< value = (float) history / scale + offset } nmea_history_t; /**************************************************************************/ @@ -85,7 +85,7 @@ typedef enum { /**************************************************************************/ /*! Struct to contain all the details associated with an NMEA data value that - can be tracked through time to see how it changes, carries a label, units, + can be tracked through time to see how it changes, carries a label, units, and a format string to determine how it is displayed. Memory footprint of about 32 bytes per data value, so not tenable in small memory spaces. */ @@ -93,18 +93,16 @@ typedef enum { typedef struct { nmea_float_t latest = 0.0; ///< the most recently obtained value nmea_float_t smoothed = - 0.0; ///< smoothed value based on weight of dt/response - uint32_t lastUpdate = 0; ///< millis() when latest was last set - uint16_t response = - 1000; ///< time constant in millis for smoothing + 0.0; ///< smoothed value based on weight of dt/response + uint32_t lastUpdate = 0; ///< millis() when latest was last set + uint16_t response = 1000; ///< time constant in millis for smoothing nmea_value_type_t type = NMEA_SIMPLE_FLOAT; ///< type of float data value represented - byte ockam = - 0; ///< the corresponding Ockam Instruments tag number, 0-128 + byte ockam = 0; ///< the corresponding Ockam Instruments tag number, 0-128 nmea_history_t *hist = NULL; ///< pointer to history, if any - char *label = NULL; ///< pointer to quantity label, if any - char *unit = NULL; ///< pointer to units label, if any - char *fmt = NULL; ///< pointer to format string, if any + char *label = NULL; ///< pointer to quantity label, if any + char *unit = NULL; ///< pointer to units label, if any + char *fmt = NULL; ///< pointer to format string, if any } nmea_datavalue_t; /**************************************************************************/ diff --git a/src/NMEA_parse.cpp b/src/NMEA_parse.cpp index 120a4bd..f48cee0 100644 --- a/src/NMEA_parse.cpp +++ b/src/NMEA_parse.cpp @@ -228,5 +228,4 @@ boolean Adafruit_GPS::parse(char *nmea) { strcpy(lastSentence, thisSentence); lastUpdate = millis(); return true; -} - +} \ No newline at end of file