Skip to content

Examples display incorrect fractional lat/long #19

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

Closed
nseidle opened this issue Mar 31, 2021 · 2 comments · Fixed by #21
Closed

Examples display incorrect fractional lat/long #19

nseidle opened this issue Mar 31, 2021 · 2 comments · Fixed by #21

Comments

@nseidle
Copy link
Member

nseidle commented Mar 31, 2021

If the lat_frac has leading zeros, they are dropped, leading to the incorrect value being printed:

image

I know examples 10 and 11 are effected but there may be others:

image

image

One solution is to use printf

Serial.printf("%d.%07d\n", lat_int, lat_frac); // Print the integer part of the latitude

But I know its support is iffy. We might have to break down and just write a silly helper function inside these examples.

@PaulZC
Copy link
Collaborator

PaulZC commented Apr 1, 2021

Fixed in this commit.
I've searched, and I think this is one of a kind...
A couple of examples weren't using nanoseconds correctly (nanoseconds can be negative) so I've corrected those too, but that's a different issue.

@PaulZC
Copy link
Collaborator

PaulZC commented Apr 1, 2021

I don't think this issue affects Example11 as the printing there is done all in one go (using double)?

@PaulZC PaulZC linked a pull request Apr 1, 2021 that will close this issue
@PaulZC PaulZC closed this as completed in #21 Apr 1, 2021
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 a pull request may close this issue.

2 participants