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

improve performance + precision #22

Closed
RobTillaart opened this issue Jun 13, 2021 · 0 comments
Closed

improve performance + precision #22

RobTillaart opened this issue Jun 13, 2021 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@RobTillaart
Copy link
Owner

There are 3 hypot() calls in read(). These can be replaced by the equivalent

    float a2 = a * a;
    float b2 = b * b;
    float c2 = c * c;
    x = sqrt(a2 + b2);
    y = sqrt(b2 + c2);
    z = sqrt(c2 + a2);

advantage is a slightly 26 us faster read() on an UNO (163 us -> 137 us) as squares are only calculated once, and smaller size ~258 bytes ~ (number based upon test sketch).


use micros() for the duration to correct pitch yaw etc.
NB with a throttle of 10 millis the accuracy of millis is typically in 2 decimals.
By using micros() one would expect one or two additional digits accuracy.


@RobTillaart RobTillaart self-assigned this Jun 13, 2021
@RobTillaart RobTillaart added the enhancement New feature or request label Jun 13, 2021
RobTillaart added a commit that referenced this issue Jul 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant