sensor calibration: apply board level adjustment to external sensors (#16127)

- apply SENS_BOARD_{X,Y,Z}_OFF to external sensors to prevent unnecessary misalignment with internal IMU
This commit is contained in:
Daniel Agar
2020-11-12 10:37:30 -05:00
committed by GitHub
parent 5f0c572c61
commit d14b4221f1
7 changed files with 58 additions and 24 deletions

View File

@@ -126,7 +126,9 @@ void Accelerometer::SensorCorrectionsUpdate(bool force)
void Accelerometer::set_rotation(Rotation rotation)
{
_rotation_enum = rotation;
_rotation = get_rot_matrix(rotation);
// always apply board level adjustments
_rotation = Dcmf(GetSensorLevelAdjustment()) * get_rot_matrix(rotation);
}
void Accelerometer::ParametersUpdate()
@@ -151,8 +153,7 @@ void Accelerometer::ParametersUpdate()
SetCalibrationParam(SensorString(), "ROT", _calibration_index, rotation_value);
}
_rotation_enum = static_cast<Rotation>(rotation_value);
_rotation = get_rot_matrix(_rotation_enum);
set_rotation(static_cast<Rotation>(rotation_value));
} else {
// internal, CAL_ACCx_ROT -1
@@ -162,8 +163,8 @@ void Accelerometer::ParametersUpdate()
SetCalibrationParam(SensorString(), "ROT", _calibration_index, -1);
}
_rotation = GetBoardRotation();
_rotation_enum = ROTATION_NONE;
// internal sensors follow board rotation
set_rotation(GetBoardRotation());
}
// CAL_ACCx_PRIO