Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Sentence.cpp #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

muntheralnaeeme
Copy link

No description provided.

@porrey
Copy link
Owner

porrey commented Dec 4, 2020

Is this change correcting a bug or is it for a specific GPS device?

@muntheralnaeeme
Copy link
Author

muntheralnaeeme commented Dec 4, 2020 via email

@porrey
Copy link
Owner

porrey commented Dec 4, 2020

Thank you. Can you provide more details. What is the bug? What steps can be taken to reproduce it? What is the GPS unit you are using? Provides as much detail as possible.

@muntheralnaeeme
Copy link
Author

muntheralnaeeme commented Dec 4, 2020 via email

@ScruffR
Copy link

ScruffR commented Dec 4, 2020

@muntheralnaeeme, I don't think that's correct.
The current implementation is correct and your "fix" would break it as it assumes that the decimal point is only in the wrong place, where in fact you are looking at the NMEA standard which encodes it like this [-]DDDMM.mmmmm (DDD full degrees, MM minutes 0..59, and mmmmm fractional minutes.

A way to convert from this format to decimal degrees could look like this

double decDegFromDMMmm(const char* coord) { // coord as DDDMM.mmmmmm
  int32_t iDeg = atol(coord) / 100;         // full degrees
  double  dMin = atof(coord) - 100*iDeg;    // decimal minutes
  return iDeg + dMin / 60.0;
}

And it would be nice to have such a conversion function added to the library @porrey 😉

@porrey
Copy link
Owner

porrey commented Dec 4, 2020

I agree. I will add this conversion to library. Thanks!

@muntheralnaeeme
Copy link
Author

muntheralnaeeme commented Dec 4, 2020 via email

@muntheralnaeeme
Copy link
Author

muntheralnaeeme commented Dec 4, 2020 via email

@ScruffR
Copy link

ScruffR commented Dec 4, 2020

@muntheralnaeeme, as long it's not part of the library itself, you can put it in your own application code and convert the longitude/latitude strings returned from the library to double
e.g.

  double lon = 0;
  double lat = 0;
  Rmc rmc(gps);
  if (rmc.parse()) {
    lat = decDegFromDMMmm(rmc.latitude);
    lon = decDegFromDMMmm(rmc.longitude);
  }

@muntheralnaeeme
Copy link
Author

muntheralnaeeme commented Dec 4, 2020 via email

@muntheralnaeeme
Copy link
Author

muntheralnaeeme commented Dec 5, 2020 via email

@ScruffR
Copy link

ScruffR commented Dec 5, 2020

A question like this should better be posted at community.particle.io

However, I don't think there is one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants