adafruit / Adafruit_GPS

An interrupt-based GPS Arduino library for no-parsing-required use
Other
471 stars 319 forks source link

parseLatDir and parseLonDir difference #114

Closed loky32 closed 4 years ago

loky32 commented 4 years ago

Hi, I write because found a difference between this two functions that need similar treatment:

https://github.com/adafruit/Adafruit_GPS/blob/24715012b3dcf05e47073e523d2ad5aac4ad2ed5/src/Adafruit_GPS.cpp#L233-L246

https://github.com/adafruit/Adafruit_GPS/blob/24715012b3dcf05e47073e523d2ad5aac4ad2ed5/src/Adafruit_GPS.cpp#L282-L297

My question is, ¿Why in latitude the condition (if (!isEmpty(p))) is not requiered? I think that this is a problem because when the value is not present, if you are in the south of Ecuador your latitude value can change of sign.

sellensr commented 4 years ago

Good catch! Coordinates always arrive as DDMM.mmmm,S for a southern latitude, so it should always find an S and does in my tests. In any case I hope it will soon be moot, as parseCoord() will replace all four lat lon in the pending pull request.

sellensr commented 4 years ago

The new parseCoord() function explicitly tests that the direction field is not empty, that the direction field is one of N, E, S, W, and that the magnitude of the angle agrees with the direction. https://github.com/adafruit/Adafruit_GPS/pull/113 was merged about an hour ago, so the issue is solved. Thanks for the input!