Skip to content

Commit

Permalink
Correct calculation for offset values for mag on GetMagOffset
Browse files Browse the repository at this point in the history
  • Loading branch information
asukiaaa committed Nov 7, 2019
1 parent 5056f90 commit 71e31d2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions examples/GetMagOffset/GetMagOffset.ino
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ void setMagMinMaxAndSetOffset(MPU9250_asukiaaa* sensor, int seconds) {
if (magZ < magZMin) magZMin = magZ;
}

sensor->magXOffset = - (magXMax - magXMin) / 2;
sensor->magYOffset = - (magYMax - magYMin) / 2;
sensor->magZOffset = - (magZMax - magZMin) / 2;
sensor->magXOffset = - (magXMax + magXMin) / 2;
sensor->magYOffset = - (magYMax + magYMin) / 2;
sensor->magZOffset = - (magZMax + magZMin) / 2;
}

void loop() {
Expand Down

0 comments on commit 71e31d2

Please sign in to comment.