Skip to content

Commit

Permalink
Merge pull request #4 from fu-hsi/develop
Browse files Browse the repository at this point in the history
1.1.0
  • Loading branch information
fu-hsi authored Nov 29, 2018
2 parents 0117ff5 + 2ee2647 commit c6f5963
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 8 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,9 @@ I tested on that I had, it means GY-NEO6MV2 and below modules.
| Arduino Pro or Pro Mini w/ ATmega328P (3.3V, 8 MHz) | YES |
| Arduino Pro or Pro Mini w/ ATmega328P (5V, 16 MHz) | YES |
| ESP8266 | YES | WeMos D1 mini.<br>I had to implemenent my own strsep() function.
| ESP32 | ? | Waiting for shipment from AliExpress ;-)
| ESP32 | YES | DOIT ESP32 DEVKIT V1

*My library support also ESP8266 and ESP32, but referenced libraries don't have to!*

## Developing
I would rather not complicate the library by adding too many functionalities.
Expand Down
1 change: 1 addition & 0 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ parseDateTime KEYWORD2
toDecimal KEYWORD2
sendCommand KEYWORD2
getField KEYWORD2
getFieldCount KEYWORD2
getMessageId KEYWORD2
getSentenceId KEYWORD2
hasFix KEYWORD2
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=FuGPS Library
version=1.0.0
version=1.1.0
author=Mariusz Kacki <[email protected]>
maintainer=Mariusz Kacki <[email protected]>
sentence=Arduino library for parsing NMEA 0183 (GPS) messages.
Expand Down
9 changes: 8 additions & 1 deletion src/FuGPS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ unsigned int FuGPS::gga_counter = 0;
unsigned int FuGPS::rmc_counter = 0;
#endif

FuGPS::FuGPS(const Stream & _stream) :
FuGPS::FuGPS(Stream & _stream) :
_stream(_stream), _state(0), _tokensCount(0), _fix(false), _lastRead(0),
Quality(0), Satellites(0), Accuracy(0), Altitude(0), Latitude(0), Longitude(0), Speed(0), Course(0)
{
Expand Down Expand Up @@ -93,6 +93,11 @@ const char * FuGPS::getField(byte index)
}
}

byte FuGPS::getFieldCount() const
{
return _tokensCount;
}

bool FuGPS::hasFix()
{
return _fix;
Expand Down Expand Up @@ -201,6 +206,8 @@ void FuGPS::process()
if (*pString == ',')
{
*pString = '\0';
if (_tokensCount >= FUGPS_MAX_TOKENS - 1) break;

_tokens[_tokensCount++] = pStart;
pStart = pString + 1;
}
Expand Down
13 changes: 8 additions & 5 deletions src/FuGPS.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#define _FUGPS_h

#if defined(ARDUINO) && ARDUINO >= 100
#include "arduino.h"
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
Expand Down Expand Up @@ -45,6 +45,7 @@
// Uncomment for debug
// #define FUGPS_DEBUG

// From larryd, Arduino Forum
#ifdef FUGPS_DEBUG
#define DPRINT(...) Serial.print(__VA_ARGS__)
#define DPRINTLN(...) Serial.println(__VA_ARGS__)
Expand All @@ -56,7 +57,7 @@
class FuGPS
{
private:
const Stream & _stream;
Stream & _stream;

char _currentBuff[FUGPS_NMEA_BUFFER_LENGTH + 1];
char _sentenceBuff[FUGPS_NMEA_BUFFER_LENGTH + 1];
Expand All @@ -77,7 +78,7 @@ class FuGPS
static unsigned int rmc_counter;
#endif

FuGPS(const Stream & _stream);
FuGPS(Stream & _stream);

static byte checksum(const char * sentence);
static void parseDateTime(float data, byte & val1, byte & val2, byte & val3);
Expand All @@ -88,7 +89,9 @@ class FuGPS
// Comma separated fields (Zero-based numbering)
const char * getField(byte index);

// E.g. GRRMC
byte getFieldCount() const;

// E.g. GPRMC
const char * getMessageId();

// E.g. RMC
Expand All @@ -97,7 +100,7 @@ class FuGPS
// Based on GGA and RMC messages data
bool hasFix();

// Checks if module still sends valid data (no matter what message)
// Checks whether module still sends valid data (no matter what message)
bool isAlive(unsigned int timeout = 10000);

// Checks if we have valid NMEA message (see isAlive())
Expand Down

0 comments on commit c6f5963

Please sign in to comment.