AP_Compass: use compass get_{field,offsets}() functions

Both functions are equivalent, so we're going to simply use
get_{field,offsets}() instead of get_{field,offsets}_milligauss().
This commit is contained in:
Gustavo Jose de Sousa 2015-09-28 16:56:49 -03:00 committed by Randy Mackay
parent 9a2808a593
commit 99a55f9379
2 changed files with 5 additions and 5 deletions

View File

@ -635,7 +635,7 @@ Compass::calculate_heading(const Matrix3f &dcm_matrix) const
float cos_pitch_sq = 1.0f-(dcm_matrix.c.x*dcm_matrix.c.x); float cos_pitch_sq = 1.0f-(dcm_matrix.c.x*dcm_matrix.c.x);
// Tilt compensated magnetic field Y component: // Tilt compensated magnetic field Y component:
const Vector3f &field = get_field_milligauss(); const Vector3f &field = get_field();
float headY = field.y * dcm_matrix.c.z - field.z * dcm_matrix.c.y; float headY = field.y * dcm_matrix.c.z - field.z * dcm_matrix.c.y;
@ -676,7 +676,7 @@ bool Compass::configured(uint8_t i)
} }
// exit immediately if all offsets (mG) are zero // exit immediately if all offsets (mG) are zero
if (is_zero(get_offsets_milligauss(i).length())) { if (is_zero(get_offsets(i).length())) {
return false; return false;
} }
@ -784,7 +784,7 @@ void Compass::motor_compensation_type(const uint8_t comp_type)
bool Compass::consistent() const bool Compass::consistent() const
{ {
Vector3f primary_mag_field = get_field_milligauss(); Vector3f primary_mag_field = get_field();
Vector3f primary_mag_field_norm; Vector3f primary_mag_field_norm;
if (!primary_mag_field.is_zero()) { if (!primary_mag_field.is_zero()) {
@ -804,7 +804,7 @@ bool Compass::consistent() const
for (uint8_t i=0; i<get_count(); i++) { for (uint8_t i=0; i<get_count(); i++) {
if (use_for_yaw(i)) { if (use_for_yaw(i)) {
Vector3f mag_field = get_field_milligauss(i); Vector3f mag_field = get_field(i);
Vector3f mag_field_norm; Vector3f mag_field_norm;
if (!mag_field.is_zero()) { if (!mag_field.is_zero()) {

View File

@ -84,7 +84,7 @@ void loop()
compass.learn_offsets(); compass.learn_offsets();
// capture min // capture min
const Vector3f &mag = compass.get_field_milligauss(); const Vector3f &mag = compass.get_field();
if( mag.x < min[0] ) if( mag.x < min[0] )
min[0] = mag.x; min[0] = mag.x;
if( mag.y < min[1] ) if( mag.y < min[1] )