AP_Compass: Move health to cpp and add range check

Moved the health check to the cpp file and added checking of max instances
This commit is contained in:
Hayden 2023-05-22 14:04:04 +10:00 committed by Peter Barker
parent 30d575df12
commit fa800e23e2
2 changed files with 6 additions and 1 deletions

View File

@ -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
*/

View File

@ -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;