Correct magnetometer calibration
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
This commit is contained in:
parent
dfd8a23937
commit
b01eef4fcd
1 changed files with 4 additions and 4 deletions
|
@ -624,8 +624,8 @@ static void apply_calibration(const device3_type* device,
|
||||||
|
|
||||||
static FusionVector max = { FLT_MIN, FLT_MIN, FLT_MIN }, min = { FLT_MAX, FLT_MAX, FLT_MAX };
|
static FusionVector max = { FLT_MIN, FLT_MIN, FLT_MIN }, min = { FLT_MAX, FLT_MAX, FLT_MAX };
|
||||||
for (int i = 0; i < 3; i++) {
|
for (int i = 0; i < 3; i++) {
|
||||||
max.array[i] = max(max.array[i], magnetometer->array[i]);
|
max.array[i] = max(max.array[i], m.array[i]);
|
||||||
min.array[i] = min(min.array[i], magnetometer->array[i]);
|
min.array[i] = min(min.array[i], m.array[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
const float mx = (max.axis.x - min.axis.x) / 2.0f;
|
const float mx = (max.axis.x - min.axis.x) / 2.0f;
|
||||||
|
@ -649,8 +649,8 @@ static void apply_calibration(const device3_type* device,
|
||||||
device->calibration->hardIronOffset = hardIronOffset;
|
device->calibration->hardIronOffset = hardIronOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
*magnetometer = FusionCalibrationMagnetic(
|
m = FusionCalibrationMagnetic(
|
||||||
*magnetometer,
|
m,
|
||||||
softIronMatrix,
|
softIronMatrix,
|
||||||
hardIronOffset
|
hardIronOffset
|
||||||
);
|
);
|
||||||
|
|
Reference in a new issue