AP_Compass: make get_field() and get_offsets() return milligauss

This is part of a transition to make AP_Compass always use a single unit for
magnetic field values, namely milligauss.
This commit is contained in:
Gustavo Jose de Sousa 2015-09-28 16:36:23 -03:00 committed by Randy Mackay
parent e357be3d85
commit 4375606eeb

View File

@ -119,9 +119,9 @@ public:
uint8_t get_count(void) const { return _compass_count; }
/// Return the current field as a Vector3f
const Vector3f &get_field(uint8_t i) const { return _state[i].field; }
const Vector3f &get_field(uint8_t i) const { return _state[i].field * _state[i].milligauss_ratio; }
const Vector3f &get_field(void) const { return get_field(get_primary()); }
const Vector3f get_field_milligauss(uint8_t i) const { return get_field(i) * _state[i].milligauss_ratio; }
const Vector3f get_field_milligauss(uint8_t i) const { return get_field(i); }
const Vector3f get_field_milligauss(void) const { return get_field_milligauss(get_primary()); }
// raw/unfiltered measurement interface
@ -182,9 +182,9 @@ public:
///
/// @returns The current compass offsets.
///
const Vector3f &get_offsets(uint8_t i) const { return _state[i].offset; }
const Vector3f &get_offsets(uint8_t i) const { return _state[i].offset * _state[i].milligauss_ratio; }
const Vector3f &get_offsets(void) const { return get_offsets(get_primary()); }
const Vector3f get_offsets_milligauss(uint8_t i) const { return get_offsets(i) * _state[i].milligauss_ratio; }
const Vector3f get_offsets_milligauss(uint8_t i) const { return get_offsets(i); }
const Vector3f get_offsets_milligauss(void) const { return get_offsets_milligauss(get_primary()); }
/// Sets the initial location used to get declination