Giter Club home page Giter Club logo

adafruit_gps's Introduction

Adafruit_GPS Build Status Documentation

Warning

This library assumes that only valid, supported NMEA sentences are parsed. Parsing invalid or unsupported NMEA sentences may result in memory corruption and/or unhandled faults & exceptions!

This is the Adafruit GPS library - the ultimate GPS library for the ultimate GPS module!

Tested and works great with the Adafruit Ultimate GPS module using MTK33x9 chipset ------> http://www.adafruit.com/products/746

These modules use TTL serial to communicate, 2 pins are required to interface.

Adafruit invests time and resources providing this open source code, please support Adafruit and open-source hardware by purchasing products from Adafruit!

Written by Limor Fried/Ladyada for Adafruit Industries. BSD license, check license.txt for more information All text above must be included in any redistribution

To install, use the Arduino Library Manager to search for 'Adafruit GPS' and install the library.

adafruit_gps's People

Contributors

basrijn avatar brunob45 avatar caternuson avatar devtty1er avatar djix123 avatar drak7 avatar driverblock avatar dygear avatar edgar-bonet avatar evaherrada avatar foodini avatar hobobandy avatar hoffmannjan avatar hunnybear avatar ladyada avatar makermelissa avatar mrmoose avatar nubok avatar optorres avatar paintyourdragon avatar petrkr avatar plattrap avatar sellensq avatar sellensr avatar siddacious avatar srob1 avatar stoph avatar tdicola avatar tyeth avatar wijnanb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

adafruit_gps's Issues

SoftwareSerial, NewSoftSerial is required to be defined even if not used

SoftwareSerial, NewSoftSerial is required to be defined even if not used.

There should be a way to specify the use of only Hardware serial, and not be forced to include unused libraries. This causes an error for Arduino version 23 if you don't have NewSoftSerial enabled.

This allows the Arduino Mega or boards that have multiple hardware serial to use the library.

idDigit() and isAlpha() undefined

the two functions are undefined

/home/phieber/Downloads/arduino-1.6.5/libraries/Adafruit-GPS-Library/Adafruit_GPS.cpp: In member function 'boolean Adafruit_GPS::LOCUS_ReadStatus()':
/home/phieber/Downloads/arduino-1.6.5/libraries/Adafruit-GPS-Library/Adafruit_GPS.cpp:454:20: error: 'isDigit' was not declared in this scope
if (isDigit(c))
^
/home/phieber/Downloads/arduino-1.6.5/libraries/Adafruit-GPS-Library/Adafruit_GPS.cpp:463:24: error: 'isAlpha' was not declared in this scope
if (isAlpha(parsed[2])) {
^
Error compiling

The consts for update rates are misleading/missing

Hi,

I am using the this library along with the Ultimate GPS breakout board. I would like to run it at 5Hz and I used the string in the library to do so:

define PMTK_SET_NMEA_UPDATE_5HZ "$PMTK220,200*2C"

And while that changes the nmea output speed to 5Hz, the actual gps fix rate is still only 1Hz. So I get five equal GPS readings, then it changes, then fine equal readings...

As far as I can see, you also need to send the following string to update the fix rate to 5Hz:
$PMTK300,200,0,0,0,0*2F
If I use that, the actual GPS readings seem to change at 5Hz.

Perhaps this could be included in the library to save others some headache :)

Parsing of the record (for issue GPGGA) with empty values brings not actual values for HDOP and some other positions.

  • Arduino board: Genuino/UNO

  • Arduino IDE version (found in Arduino -> About Arduino menu): 1.8.9

i'm requesting the record only for GGA :
GPS.sendCommand(PMTK_SET_NMEA_OUTPUT_GGAONLY);

if i receive complete record like this:
$GPGGA,185526.000,4810.5543,N,01139.0849,E,1,05,1.52,488.0,M,47.5,M,,*65
everything works fine and i get correct values

GPS.satellites = 5;
GPS.HDOP = 1.52;

But if after that commes a record wih empty values like
$GPGGA,184426.000,,,,,0,04,,,M,,M,,*71
i will get the last read value for HDOP. It is not correct for me:
GPS.satellites = 4; GPS.HDOP = 1.52;

i'm not a c++ developer, but i think, the reason is on this point:
from line 121 in Adafruit_GPS.cpp:

  p = strchr(p, ',')+1;
    if (',' != *p)
    {
      HDOP = atof(p);
    }
// from hear is my code:
	else
	{
		HDOP = 0.00;
	}	


could you please take a look at this case?
i have a workaround, i parse a record myself to take a HDOP at it's position.
But it would be better to have suitable version from original ))

Thank you in advance

Getting fix false all the time

Arduino IDE 1.8.5 . Using example
Time: 0:0:0.0 AdafruitGPSLibrary -> parsing
left over 1 hour still not getting FIX to true
Even though

  if (strstr(nmea, "$GPRMC")) {
         // found RMC
          char *p = nmea;
       // get time
        p = strchr(p, ',')+1;
        float timef = atof(p);
        uint32_t time = timef;
        hour = time / 10000;
    minute = (time % 10000) / 100;
    seconds = (time % 100);

    milliseconds = fmod(timef, 1.0) * 1000;

    p = strchr(p, ',')+1;
    // Serial.println(p);
    if (p[0] == 'A') 
      fix = true;
    else if (p[0] == 'V')
      fix = false;
    else
      return false;`

so if there is an A fix should be true and you can see from serial output A instead of V

Date: 0/0/200
Fix: 0 quality: 0
$GPRMC,055009.00,A,4011.39535,N,04434.36519,E,0.495,,090718,,,A*7C
$GPVTG,,T,,M,0.495,N,0.917,K,A*24
$GPGGA,055009.00,4011.39535,N,04434.36519,E,1,05,2.08,1158.8,M,8.6,M,,*5B
$GPGSA,A,3,19,17,24,15,12,,,,,,,,3.88,2.08,3.27*02
$GPGSV,3,1,09,02,19,169,,06,38,126,21,12,35,288,43,13,17,196,*77
$GPGSV,3,2,09,15,25,23423,1,47,47,2619,74058,1,2459,31,40*D
$PGSV3,3,0,28,1,081,1*41
$GPGL,402.3535,N,4429.6519E,05009.0,A,*6A
$GPRMC,055010.00,A,4012.35513,N,04429.86543,E,0.177,,090718,,,A*76
$GPVTG,,T,,M,0.177,N,0.327,K,A*24
$GPGGA,055010.00,4012.35513,N,04429.86543,E,1,05,2.08,1158.4,M,8.6,M,,*54
$GPGSA,A,3,19,17,24,15,12,,,,,,,,3.88,2.08,3.27*02
$GPGSV,3,1,09,02,19,169,,06,38,126,20,12,35,288,43,13,17,196,*76
$GPGSV,3,2,09,15,25,34,2,17,4,047,7,19,4,05821,2459,31,407B
$PGSV3,3,9,28,3,08112*4
$GGLL,012.5513N,0429.8643,E,5501000,AA*69
$GPRMC,055011.00,A,4012.35440,N,04429.86566,E,0.400,,090718,,,A*72
$GPVTG,,T,,M,0.400,N,0.742,K,A*26
$GPGGA,055011.00,4012.35440,N,04429.86566,E,1,05,2.08,1158.2,M,8.6,M,,*53
$GPGSA,A,3,19,17,24,15,12,,,,,,,,3.88,2.08,3.27*02
$GPGSV,3,1,09,02,19,169,,06,38,126,21,12,35,288,43,13,17,196,*77
$GPGSV,3,2,09,15,25,234,2,17,4,047,8,19,4,05821,2459,30,40*7
$GGSV,,3,0928,13081,1*44
GPGL,401.3540,N,0429.6566E,05011.0,A,A68

shield_sdlog.ino doesn't compile for Arduino Zero

I noticed that shield_sdlog.ino is written for avr-based Arduino's.
With some help I inforporated teh changes to run this example on Arduino Zero.
How to proceed to incorporate these small changes?

GPS.wakeup() hangs

It looks like the v3 GPS module wakeup method isn't working correctly. The data sheet says to send an arbitrary byte to the module to take it out of sleep mode. The Adafruit library is doing that but is also waiting for a response message. I don't believe the GPS module sends a response when coming out of sleep mode. Can you verify?

Serial setting in leo_echo_test

Hey there,

Tried the leo_echo code on the Ultimate GPS Logger but had to change the serial.begin line as follows:

Serial.begin(9600); // this baud rate doesn't actually matter!

Leaving it as per the current commit meant that the Serial debug was garbled.

lon/lat minutes are malformed when there's less than 4 decimals

I used a NMEA simulator ( https://chrome.google.com/webstore/detail/nmea-simulator/dfhcgoinjchfcfnnkecjpjcnknlipcll ) to test my setup, but it outputs minutes with 3 decimals instead of the expected 4.
This messed up my coordinates so I dug into the library and found that it always expects at least 4 decimals (on line 77, 106, 190 and 219).
Also, more precise coordinates (5 or more decimals) will be truncated.

I tried comming up with a solution but I need some sleep first. Hopefully I'll get back to this.

B

Thank you for opening an issue on an Adafruit Arduino library repository. To
improve the speed of resolution please review the following guidelines and
common troubleshooting steps below before creating the issue:

  • Do not use GitHub issues for troubleshooting projects and issues. Instead use
    the forums at http://forums.adafruit.com to ask questions and troubleshoot why
    something isn't working as expected. In many cases the problem is a common issue
    that you will more quickly receive help from the forum community. GitHub issues
    are meant for known defects in the code. If you don't know if there is a defect
    in the code then start with troubleshooting on the forum first.

  • If following a tutorial or guide be sure you didn't miss a step. Carefully
    check all of the steps and commands to run have been followed. Consult the
    forum if you're unsure or have questions about steps in a guide/tutorial.

  • For Arduino projects check these very common issues to ensure they don't apply:

    • For uploading sketches or communicating with the board make sure you're using
      a USB data cable and not a USB charge-only cable. It is sometimes
      very hard to tell the difference between a data and charge cable! Try using the
      cable with other devices or swapping to another cable to confirm it is not
      the problem.

    • Be sure you are supplying adequate power to the board. Check the specs of
      your board and plug in an external power supply. In many cases just
      plugging a board into your computer is not enough to power it and other
      peripherals.

    • Double check all soldering joints and connections. Flakey connections
      cause many mysterious problems. See the guide to excellent soldering for examples of good solder joints.

    • Ensure you are using an official Arduino or Adafruit board. We can't
      guarantee a clone board will have the same functionality and work as expected
      with this code and don't support them.

If you're sure this issue is a defect in the code and checked the steps above
please fill in the following fields to provide enough troubleshooting information.
You may delete the guideline and text above to just leave the following details:

  • Arduino board: INSERT ARDUINO BOARD NAME/TYPE HERE

  • Arduino IDE version (found in Arduino -> About Arduino menu): INSERT ARDUINO
    VERSION HERE

  • List the steps to reproduce the problem below (if possible attach a sketch or
    copy the sketch code in too): LIST REPRO STEPS BELOW

Library support for ESP8266

The library has no support for the Wifi module ESP8266.
It seems not to work for the SoftwareSerial.
This is my code:
#include <Adafruit_GPS.h>
#include <SoftwareSerial.h>

SoftwareSerial mySerial(3, 2);
//HardwareSerial mySerial = Serial1;

Adafruit_GPS GPS(&mySerial);

void setup()
{
GPS.begin(9600);
}

void loop() // run over and over again
{
}

Getting following error:
error: no matching function for call to 'Adafruit_GPS::Adafruit_GPS(SoftwareSerial*)'

Missing documentation about how to decode `latitude_fixed` and `longitude_fixed`

The library includes a high precision integer encoded value for latitude and longitude in the form of latitude_fixed and longitude_fixed. While it is possible to reverse engineer the encoding from the source code, there is no documentation or example on how to decode those values.

The forum contains this example using string manipulation (probably not ideal).
https://forums.adafruit.com/viewtopic.php?f=57&t=110423&p=551739&hilit=longitude_fixed#p551856

csum char could be 0xA in Adafruit_GPS::read

Just playing with your library and noted something that doesn't seem right to me.

char Adafruit_GPS::read(void) function will prematurely commit to double buffer if csum value = 0xA ("\n")

csum is a bytewise xor so it can potentially take any byte value including 0xD and 0xA.

Packet suffix format is "*/r/n" so checking for /r/n should be sufficient to resolve this.

eg something along the lines of changing line 227: if (c == '\n' ) {
to 227: if (lineidx>0 and c == '\n' and currentline[lineidx]=='\r') {

Tarek

waitForSentence assumes you are not using interrupts to read from the GPS

The waitForSentence method of the Adafruit_GPS class invokes read() which assumes that you are not using interrupts to read from the GPS.

It should probably have a third argument so that it doesn't invoke read() when is true.

Something like this:

//
/*!
@brief Wait for a specified sentence from the device
@param wait4me Pointer to a string holding the desired response
@param max How long to wait, default is MAXWAITSENTENCE
@param usingInterrupts True if using interrupts to read from the GPS (default is false)
@return True if we got what we wanted, false otherwise
*/
/
/
boolean Adafruit_GPS::waitForSentence(const char *wait4me, uint8_t max, boolean usingInterrupts) {
uint8_t i=0;
while (i < max) {
if (!usingInterrupts)
read();

if (newNMEAreceived()) {
  char *nmea = lastNMEA();
  i++;

  if (strStartsWith(nmea, wait4me))
      return true;
}

}

return false;
}

In this version I have also eliminated the copying of the start of the NMEA sentence to a local buffer which is unnecessary and inefficient. The strStartsWith utility very efficiently checks for the desired prefix on the NMEA sentence. (This assumes that the other bugs I've reported about the read routine returning NMEA sentences starting with LF characters from the previous NMEA sentence have been fixed.)

The strStartsWith routine looks like this:

//
/*!
@brief Checks whether a string starts with a specified prefix
@param str Pointer to a string
@param prefix Pointer to the prefix
@return True if str starts with prefix, false otherwise
*/
/
/
boolean strStartsWith(const char* str, const char* prefix)
{
while (*prefix) {
if (*prefix++ != *str++)
return false;
}
return true;
}

error: ‘class SoftwareSerial’ has no member named ‘available’

so: ubuntu 14.10 64bits
arduino v: 1:1.0.5+dfsg2-2
sketch: https://github.com/adafruit/Adafruit-GPS-Library/blob/master/examples/echo/echo.pde
libraries:
~/sketchbook/libraries/Adafruit_GPS/Adafruit_GPS/Adafruit_GPS.h
~/sketchbook/libraries/Adafruit_GPS/Adafruit_GPS/Adafruit_GPS.cpp
~/sketchbook/libraries/Adafruit_GPS/SoftwareSerial/SoftwareSerial.h
~/sketchbook/libraries/Adafruit_GPS/SoftwareSerial/SoftwareSerial.cpp

Arduino output:

/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/home/iban/sketchbook/libraries/Adafruit_GPS -I/home/iban/sketchbook/libraries/SoftwareSerial /tmp/build3132701668445898727.tmp/GPS.cpp -o /tmp/build3132701668445898727.tmp/GPS.cpp.o 
/usr/share/arduino/hardware/tools/avr/bin/avr-g++ -c -g -Os -Wall -fno-exceptions -ffunction-sections -fdata-sections -mmcu=atmega328p -DF_CPU=16000000L -MMD -DUSB_VID=null -DUSB_PID=null -DARDUINO=105 -D__PROG_TYPES_COMPAT__ -I/usr/share/arduino/hardware/arduino/cores/arduino -I/usr/share/arduino/hardware/arduino/variants/standard -I/home/iban/sketchbook/libraries/Adafruit_GPS -I/home/iban/sketchbook/libraries/SoftwareSerial -I/home/iban/sketchbook/libraries/Adafruit_GPS/utility /home/iban/sketchbook/libraries/Adafruit_GPS/Adafruit_GPS.cpp -o /tmp/build3132701668445898727.tmp/Adafruit_GPS/Adafruit_GPS.cpp.o 
/home/iban/sketchbook/libraries/Adafruit_GPS/Adafruit_GPS.cpp: In member function ‘char Adafruit_GPS::read()’:
/home/iban/sketchbook/libraries/Adafruit_GPS/Adafruit_GPS.cpp:273:22: error: ‘class SoftwareSerial’ has no member named ‘available’
     if(!gpsSwSerial->available()) return c;

Parse function checksum issue

Hi,
I've recently been looking through this library with the idea of using it for a project, but I have noticed that there seems to be a slight issue with the check sum.
When calculating the check sum value, the start of the sentence found using the strchr and the "$" sign at line 65.
However, after the check sum is finished, its assumed that nmea[0] is the start of the sentence, this could possible cause data to be lost.

I don't currently have any hardware for this so i cannot fix it and make a PR, or know if this even has any effect.
The best fix that I can think of is to set the start of the sentence to "p" from line 65.

Thanks

Adafruit_GPS on Adalogger Feather M0

I've been having fun connecting an Ultimate GPS Breakout (V3) to an Adalogger M0 (hook-up details are appended below):

There are no examples for the Feather (yet) so I used code for the Flora:

The flora_gpstest example works straight out of the box.

To get flora_parsing to work, you need to make a few changes:

In flora_parsing:
Comment out the include for SoftwareSerial.h (line 14):

//#include <SoftwareSerial.h>

In the library Adafruit_GPS.cpp:
In the code for Adafruit_GPS::begin:
Add three lines just above the delay(10); (line 362):

void Adafruit_GPS::begin(uint16_t baud)
{
#ifdef __AVR__
  if(gpsSwSerial) 
    gpsSwSerial->begin(baud);
  else 
    gpsHwSerial->begin(baud);
#endif

#ifdef SAM // For the Adalogger Feather M0
  gpsHwSerial->begin(baud);
#endif

  delay(10);
}

After that, everything seems to work great!

(I haven't pulled this as it raises much bigger questions about softwareserial on the M0 in general. I'll leave it to Ada and the team to figure out the best approach for this!)

Hook-Up

Ultimate GPS Adalogger M0
TX RX0 (D0)
RX TX0 (D1)
GND GND
VIN USB (VBUS)

The Ultimate GPS draws power from the USB port or the LiPo battery and doesn't put any load on the Adalogger 3.3V regulator. Connecting VIN this way is OK as the Ultimate GPS has its own built-in regulator. You will need to choose a different power pin if your GPS module doesn't have a regulator!

Possible integration with the arduino mkr boards (SAMD21 architecture)??

Hi is it possible to modify the library to work with the SAMD21 architecture for the MKR boards??

I know that libraries such as SoftSerial, NeoSerial and AltSerial doesn't work with the SAMD21, this is not the issue as I can gain more HWSerials. However, it doesn't seem like I can generate any data output from the Ultimate GPS other than restart codes...

I've check the GPS and code on the UNO and everything works fine. It would really be helpful for alot of people (I think), as these boards have the size and functionality suited for small IoT projects.

thanks in advance

Data quality issue, simple fix?

Hi,

I noticed that my Adafruit Altimate GPS wing (and I would assume any MTK3339 based board) is reporting a satellite count, even if no fix is obtained:

$GPGGA,063633.000,,,,,**0**,**08**,,,M,,M,,*73

This results in GPS.satellites containing a value where it really should read zero if there is no fix obtained.

Updating the GPGGA parser to read:

satellites = atoi(p);
      if (!fix)
        satellites = 0;

Would address that data quality issue.

Or is there a known reason for the chip to actually report this value. GGA is fix related data, so it would make for the satellite field to reflect fix satellites (as it does after fix is obtained). The GSV sentence has a satellite field that maps to satellites in view if somebody would ever want that data.

Bas

baud rate 115200 - lib declaration

You have declared

void Adafruit_GPS::begin(uint16_t baud)

it is wrong, declare
void Adafruit_GPS::begin(unsigned long baud)

!! any incoming character is dirty !!

Uno WiFi Rev 2

Which example from Adafruit_GPS library I should be using for these two boards:
a) Uno WiFi Rev 2
b) MKR 1010

Thank you

Arduino 101 Compatibility

This library seems to be incompatible with the Arduino 101, with the line Adafruit_GPS GPS(&mySerial); in the example sketch giving the error "exit status 1
no matching function for call to ‘Adafruit_GPS::Adafruit_GPS(SoftwareSerial*)’"
I would appreciate some help to get this modified to work with the 101. Thanks.

Bug in read() routine

According to the NMEA specification, sentences start with a '$' character and end with a CR-LF pair.

The read() routine in the Adafruit GPS library terminates received NMEA sentences with a CR rather than a CR-LF pair. In addition, all returned NMEA sentences except the first begin with a LF rather than a '$'. (This LF is actually the final LF of the prior NMEA sentence received.)

When the read() routine sees the LF character ('\n'), it null terminates the current NMEA sentence in the buffer pointed to by currentline (which is either line1 or line2), and then switches currentline to point to the other buffer all before storing the LF character in the buffer.

The issue is that it then stores the LF character in the new buffer as the first character of the new buffer, rather than the last character of the prior buffer.

As a result, most NMEA sentences returned by lastNMEA() start with a LF character and end with a CR character rather than starting with a '$' and ending with a CR-LF pair. ( I say most because unlike all other NMEA setences, the first NMEA sentence returned by the parser does not start with a LF because there was no trailing LF from a previous NMEA sentence stored at the start of the first buffer.)

When/if you fix this incorrect behavior, you will need to make changes to other parts of the library. For example, the parse() routine relies on the fact that there is a single CR character at the end of NMEA sentences it receives rather than the standard CR-LF pair that is part of the specification. This dependency is in the checksum code at the top of the parse() routine. In particular, it looks for an asterisk character ('*') four characters from the end of the NMEA sentence rather than five characters from the end. The rest of the indices used for the checksum will also need to be adjusted.

Also, due to this bug, I believe the parse routine will always incorrectly determine that that the checksum on the first received NMEA sentence is incorrect, because it starts checksumming at offset 2 into the NMEA sentence. As noted above, the very first NMEA sentence buffered by the read() routine does NOT start with a LF since there was no previous NMEA sentence.

(I am opening a separate issue regarding the repeated use of strlen() in the checksum code at the top of parse. Processing NMEA sentences is somewhat time critical in order to keep up with them. So it is a bit ridiculous that strlen is used in the condition clause of the checksum for-loop. That invokes strlen once for every character in the NMEA sentence! The length of a NMEA sentence is invariant inside parse, so strlen should be evaluated once at the start of the routine and stored in a local variable.)

MPU6050 (jrowberg)+ Adafruit GPS

Hi
For my project I have to use mpu6050 and gps in same code. When I upload the mpu6050_dmp6 example, it run perfect but with the same example whenever I connect the rx and tx pin to the gps, it just freaked out. I dont now why it happens. (sorry for my bad english)

Checksum code nonfunctional

Your checksum code is actually inactive. If you look at the checksum portion of the parse() command you can see that the "return false" when the checksum is incorrect is commented out. That's because the code doesn't currently work, at the conclusion of every checksum check sum=36 which happens to be the value of nmea[1]. If you instead run the for loop from i=2 to strlen(nmea)-4, the code actually functions as anticipated.

Missing 'Serial1' instance when compiling 'GPS_HardwareSerial_EchoTest.ino' for ESP32

Basic Infos

Hardware

Adafruit HUZZAH32 - ESP32 Feather Board
https://www.adafruit.com/product/3405

Adalogger FeatherWing - RTC + SD Add-on For All Feather Boards
https://www.adafruit.com/product/2922

Adafruit Ultimate GPS FeatherWing
https://www.adafruit.com/product/3133

FeatherWing Tripler Mini Kit - Prototyping Add-on For Feathers
https://www.adafruit.com/product/3417

OS, IDE, and Commit

OS:       Windows 10 Professional
IDE:      1.8.5
COMMIT?:  via 'git branch -v'
          * master b855eb2 * arduino-esp32 release mgmt. update (#1557)

Settings in IDE

Module:            Adafruit ESP32 Feather
CPU Frequency:     80Mhz  
Core Debug Level:  None

Description

While bringing up the forementioned hardware assembly, my colleague and I found that the basic GPS Rx/Tx test sketch would not compile for the ESP32 using the Arduino IDE.

A search of the Arduino/ESP32 repository with term 'Serial1' found turned up sketch 'WiFiTelnetToSerial.ino', which defines 'Serial1' as an instance of 'HardwareSerial'.

HardwareSerial Serial1(2); // UART1/Serial1 pins 16,17

Adding this instance to the example allowed it to be compiled.

As the Adafruit GPS library includes a sketch 'GPS_HardwareSerial_EchoTest.ino' almost identical to the basic GPS Rx/Tx test, it also needs a 'Serial1' instance to compile correctly.

// Pick one up today at the Adafruit electronics shop
// and help support open source hardware & software! -ada

// ADD THIS LINE HERE FOR ESP32
HardwareSerial Serial1(2); // UART1/Serial1 pins 16,17

// what's the name of the hardware serial port?
#define GPSSerial Serial1

Copy Author: @ladyada

Bad Time Data Every 4 Seconds

It seems the Adafruit-GPS library is returning bad time data every 4 seconds because the time is being parsed internally as a floating point value. This causes a round-off error that causes the time with seconds of 1, 5, 9, 13, 17, 21, 25, 29, 33, 37, 41, 45, 49, 53 and 57 to be repeated. This problem happens between about 09:55 and 24:00 GMT. I've asked about this problem on the Adafruit forum, but figured I'd ask here since the issue seems to be in the library. It looks to me if the time in the RMC and GGA sentences was parsed using a series of 4 atoi commands instead of one atof command, this problem would be solved.

Inefficiencies in checksum code in parse()!

Processing NMEA sentences is somewhat time critical in order to keep up with them.

The checksum code at the start of parse() is extremely inefficient, as it invokes strlen() three times and then again in the condition portion of the checksum for-loop, which causes strlen to be invoked EVERY time through the loop (i.e., once for every character in the NMEA sentence)!

The parse() routine should compute strlen(nmea) ONCE at the top of the routine, and store the result in a local variable that is used throughout the routine, as the length is invariant inside parse().

Cleaning this up should save a ton of time.

Error in native Serial: Adafruit_GPS GPS(&Serial);

Now you cannot define: Adafruit_GPS GPS(&Serial); // because is not a HardwareSerial is a variable type Serial_

And you could add type Serial_ for people that want to use HardwareSerial in for example arduino Leonardo and not need use usb port. Maybe code should be transform in templates will be more easy to have multipleSerial types. And to have all to handle like this new: Serial_ *gpsHwSerial;

Arduino 101 Incompatible

Hi,

I am using an Intel Curie Arduino 101 board with IDE version 1.8.8. I successfully complied and uploaded the "echo" example sketch to an Arduino UNO, but when changing to hardware serial to use my Arduino 101 board (yes, I swapped COM ports and board type) and commenting out the software serial lines as directed in the script I obtain these error messages:

echo:98:8: error: expected constructor, destructor, or type conversion before ‘(’ token SIGNAL(TIMER0_COMPA_vect) { ^ echo:98:7: error: expected constructor, destructor, or type conversion before ‘(’ token SIGNAL(TIMER0_COMPA_vect) { ^ /tmp/arduino_modified_sketch_393384/echo.ino: In function ‘void useInterrupt(boolean)’: echo:111:5: error: ‘OCR0A’ was not declared in this scope OCR0A = 0xAF; ^ echo:112:5: error: ‘TIMSK0’ was not declared in this scope TIMSK0 |= _BV(OCIE0A); ^ In file included from /home/user/.arduino15/packages/Intel/hardware/arc32/2.0.4/system/libarc32_arduino101/common/board.h:42:0, from /home/user/.arduino15/packages/Intel/hardware/arc32/2.0.4/cores/arduino/UARTClass.h:25, from /home/user/.arduino15/packages/Intel/hardware/arc32/2.0.4/variants/arduino_101/variant.h:39, from /home/user/.arduino15/packages/Intel/hardware/arc32/2.0.4/cores/arduino/Arduino.h:118, from sketch/echo.ino.cpp:1: echo:112:19: error: ‘OCIE0A’ was not declared in this scope TIMSK0 |= _BV(OCIE0A); ^ /home/user/.arduino15/packages/Intel/hardware/arc32/2.0.4/system/libarc32_arduino101/common/misc/util.h:103:26: note: in definition of macro ‘_BV’ #define _BV(bit) (1U << (bit)) ^ echo:116:5: error: ‘TIMSK0’ was not declared in this scope TIMSK0 &= ~_BV(OCIE0A); ^ In file included from /home/user/.arduino15/packages/Intel/hardware/arc32/2.0.4/system/libarc32_arduino101/common/board.h:42:0, from /home/user/.arduino15/packages/Intel/hardware/arc32/2.0.4/cores/arduino/UARTClass.h:25, from /home/user/.arduino15/packages/Intel/hardware/arc32/2.0.4/variants/arduino_101/variant.h:39, from /home/user/.arduino15/packages/Intel/hardware/arc32/2.0.4/cores/arduino/Arduino.h:118, from sketch/echo.ino.cpp:1: echo:116:20: error: ‘OCIE0A’ was not declared in this scope TIMSK0 &= ~_BV(OCIE0A); ^ /home/user/.arduino15/packages/Intel/hardware/arc32/2.0.4/system/libarc32_arduino101/common/misc/util.h:103:26: note: in definition of macro ‘_BV’ #define _BV(bit) (1U << (bit)) ^ exit status 1 expected constructor, destructor, or type conversion before ‘(’ token

Any idea why this is not functioning? I can communicate with this board with other scripts, but the GPS ones (specifically echo and parsing) have compiling errors.

AIC

i have found in PMTK
(docs http://www.adafruit.com/datasheets/PMTK_A11.pdf)
the settings for Active Interference Cancellation
$PMTK286,1*23
but i can't find this command in the library

The cancellation seems to be active by default (so it can be pointless)

Initializing hardware serial on Mega.

Using Arduino 1.6.1 and an Arduino mega 2560.
In parsing.pde, line 42, I changed:
Adafruit_GPS GPS(&mySerial);
to:
Adafruit_GPS GPS(&Serial3);
After that change, it works for me.

shield_sdlog latest update (July 30 14) doesn't parse GPS data correctly

Hi,
Am new to this so apologies if I am mistaken or not using the proper format/forum. I am able to use the Adafruit Ultimate GPS Shield and all of the example functions in the Adafruit_GPS library correctly except the shield_sdlog. The if statement:

if (!GPS.parse(GPS.lastNMEA())) // this also sets the newNMEAreceived() flag to false
return; // we can fail to parse a sentence in which case we should just wait for another

fails and the GPS.lastNMEA is garbled. I tried the version of the code from Feb 2014 and it works just fine. I think something about the recent update has caused the problem. I am using an Arduino Uno R3.

Missing zeros in GPS.lat // GPS.lon

Hi there, I'm really new to arduinos (or in general with coding, started 3 days ago ) and have to use the adafruit gps for a university project when i'm using the standard method GPS.lat or GPS.lon
the method will give me
Location : 5345.2211N, 940.3187E
from this GGA line
$GPGGA,110758.000,5345.2215,N,00940.3184,E,1,05,3.42,-7.2,M,45.8,M,,*44

is there a possibility to rewrite the method so that one Zero will not be deleted so that you could use those coordinates directly in google maps ?

Sorry for such a newbie question ;)

Thanks for you help

Millisecond output bug in several parsing examples

In the examples parsing and due_parsing (and perhaps others), time is output using code which looks like the following:

Serial.print("\nTime: ");
Serial.print(GPS.hour, DEC); Serial.print(':');
Serial.print(GPS.minute, DEC); Serial.print(':');
Serial.print(GPS.seconds, DEC); Serial.print('.');
Serial.println(GPS.milliseconds);

Because GPS.milliseconds is actual milliseconds:
(unit16_t) milliseconds = fmod(timef, 1.0) * 1000;
the millisecond value needs to have some leading zeros added. Two if: value < 10 and one if: 9 < value < 100.

For example, say the seconds value of time is 3 seconds and 9 milliseconds, the value output by the code above would be 3.9, when it should be 3.009.

If checksum is corrupt don't assume message is OK

If an NMEA checksum is missing the library will assume everything is OK and continue to parse the message. This can cause problems if the message is so corrupt that the checksum itself is also corrupted, i.e. the * is missing or in the wrong place. I think a better approach would be to skip the message if the checksum is missing. The GPS unit on the v3 board always seems to have a checksum, so I can't see a benefit to ignoring missing values.

Relevant code here: https://github.com/adafruit/Adafruit_GPS/blob/master/Adafruit_GPS.cpp#L36

SAM-M8Q

This library is compatible with u-blox SAM-M8Q?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.