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

Fix double promotion #163

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Fusion/FusionAhrs.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <float.h> // FLT_MAX
#include "FusionAhrs.h"
#include <math.h> // atan2f, cosf, powf, sinf
#include <math.h> // atan2f, cosf, fabsf, powf, sinf

//------------------------------------------------------------------------------
// Definitions
Expand Down Expand Up @@ -117,7 +117,7 @@ void FusionAhrsUpdate(FusionAhrs *const ahrs, const FusionVector gyroscope, cons
ahrs->accelerometer = accelerometer;

// Reinitialise if gyroscope range exceeded
if ((fabs(gyroscope.axis.x) > ahrs->settings.gyroscopeRange) || (fabs(gyroscope.axis.y) > ahrs->settings.gyroscopeRange) || (fabs(gyroscope.axis.z) > ahrs->settings.gyroscopeRange)) {
if ((fabsf(gyroscope.axis.x) > ahrs->settings.gyroscopeRange) || (fabsf(gyroscope.axis.y) > ahrs->settings.gyroscopeRange) || (fabsf(gyroscope.axis.z) > ahrs->settings.gyroscopeRange)) {
const FusionQuaternion quaternion = ahrs->quaternion;
FusionAhrsReset(ahrs);
ahrs->quaternion = quaternion;
Expand Down
4 changes: 2 additions & 2 deletions Fusion/FusionOffset.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// Includes

#include "FusionOffset.h"
#include <math.h> // fabs
#include <math.h> // fabsf

//------------------------------------------------------------------------------
// Definitions
Expand Down Expand Up @@ -57,7 +57,7 @@ FusionVector FusionOffsetUpdate(FusionOffset *const offset, FusionVector gyrosco
gyroscope = FusionVectorSubtract(gyroscope, offset->gyroscopeOffset);

// Reset timer if gyroscope not stationary
if ((fabs(gyroscope.axis.x) > THRESHOLD) || (fabs(gyroscope.axis.y) > THRESHOLD) || (fabs(gyroscope.axis.z) > THRESHOLD)) {
if ((fabsf(gyroscope.axis.x) > THRESHOLD) || (fabsf(gyroscope.axis.y) > THRESHOLD) || (fabsf(gyroscope.axis.z) > THRESHOLD)) {
offset->timer = 0;
return gyroscope;
}
Expand Down
Loading