AP_Proximity: add methods covering sensor health, enable and present
This commit is contained in:
parent
a7a6cfa99f
commit
e7e0ee0b50
@ -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;
|
||||
|
@ -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];
|
||||
|
Loading…
Reference in New Issue
Block a user