diff --git a/libraries/AP_Compass/AP_Compass.cpp b/libraries/AP_Compass/AP_Compass.cpp index 517d98ee6a..3501ebd17c 100644 --- a/libraries/AP_Compass/AP_Compass.cpp +++ b/libraries/AP_Compass/AP_Compass.cpp @@ -2066,6 +2066,11 @@ bool Compass::consistent() const return true; } +bool Compass::healthy(uint8_t i) const +{ + return (i < COMPASS_MAX_INSTANCES) ? _get_state(Priority(i)).healthy : false; +} + /* return true if we have a valid scale factor */ diff --git a/libraries/AP_Compass/AP_Compass.h b/libraries/AP_Compass/AP_Compass.h index 53d760404d..609ee970b5 100644 --- a/libraries/AP_Compass/AP_Compass.h +++ b/libraries/AP_Compass/AP_Compass.h @@ -205,7 +205,7 @@ public: bool consistent() const; /// Return the health of a compass - bool healthy(uint8_t i) const { return _get_state(Priority(i)).healthy; } + bool healthy(uint8_t i) const; bool healthy(void) const { return healthy(_first_usable); } uint8_t get_healthy_mask() const;