AP_Proximity: add methods covering sensor health, enable and present

This commit is contained in:
Peter Barker 2018-06-25 19:50:47 +10:00 committed by Andrew Tridgell
parent a7a6cfa99f
commit e7e0ee0b50
2 changed files with 19 additions and 0 deletions

View File

@ -437,4 +437,17 @@ AP_Proximity::Proximity_Type AP_Proximity::get_type(uint8_t instance) const
return Proximity_Type_None;
}
bool AP_Proximity::sensor_present() const
{
return get_status() != Proximity_NotConnected;
}
bool AP_Proximity::sensor_enabled() const
{
return _type[primary_instance] != Proximity_Type_None;
}
bool AP_Proximity::sensor_failed() const
{
return get_status() != Proximity_Good;
}
AP_Proximity *AP_Proximity::_singleton;

View File

@ -134,6 +134,12 @@ public:
static AP_Proximity *get_singleton(void) { return _singleton; };
// methods for mavlink SYS_STATUS message (send_extended_status1)
// these methods cover only the primary instance
bool sensor_present() const;
bool sensor_enabled() const;
bool sensor_failed() const;
private:
static AP_Proximity *_singleton;
Proximity_State state[PROXIMITY_MAX_INSTANCES];