AP_Baro: added all_healthy() method

This commit is contained in:
Andrew Tridgell 2015-01-07 12:45:01 +11:00
parent 8359c082ca
commit 1c2a6deaaf
2 changed files with 16 additions and 0 deletions

View File

@ -329,3 +329,16 @@ uint8_t AP_Baro::register_sensor(void)
return _num_sensors++;
}
/*
check if all barometers are healthy
*/
bool AP_Baro::all_healthy(void) const
{
for (uint8_t i=0; i<_num_sensors; i++) {
if (!healthy(i)) {
return false;
}
}
return _num_sensors > 0;
}

View File

@ -44,6 +44,9 @@ public:
bool healthy(void) const { return healthy(_primary); }
bool healthy(uint8_t instance) const { return sensors[instance].healthy && sensors[instance].alt_ok; }
// check if all baros are healthy - used for SYS_STATUS report
bool all_healthy(void) const;
// pressure in Pascal. Divide by 100 for millibars or hectopascals
float get_pressure(void) const { return get_pressure(_primary); }
float get_pressure(uint8_t instance) const { return sensors[instance].pressure; }