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

Don't rely on arduino #68

Open
feliwir opened this issue Jan 6, 2020 · 2 comments
Open

Don't rely on arduino #68

feliwir opened this issue Jan 6, 2020 · 2 comments

Comments

@feliwir
Copy link

feliwir commented Jan 6, 2020

Hello everyone,

why exactly does this library rely on arduino functionality? Mathematical functions could also be used from cmath. I'd love to use this great library with other microcontrollers.
Thanks

@codygray
Copy link

codygray commented Jan 7, 2020

I agree. There is no reason for this library to be Arduino-dependent. It is almost trivial to make it more universal. I have just submitted a pull request that does exactly that. In the meantime, you are welcome to use my fork.

@mmaxxza
Copy link

mmaxxza commented Feb 5, 2020

Since @codygray 's fork did not compile for my board, we fixed tinygps plus by putting this in the start of the functions that depend on degrees and radians (courseto and distancefrom).
Else you can simply delete these functions if you are only logging or reporting backend.

#define _USE_MATH_DEFINES
#include <cmath>

#define PI           (M_PI)
#define HALF_PI      (M_PI / 2.0)
#define TWO_PI       (M_PI * 2.0)
#define DEG_TO_RAD   (M_PI / 180.0)
#define RAD_TO_DEG   (180.0 / M_PI)

#define radians(deg) ((deg)*DEG_TO_RAD)
#define degrees(rad) ((rad)*RAD_TO_DEG)
#define sq(x)        ((x)*(x))

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

No branches or pull requests

3 participants