AP_ExternalAHRS: add get_name function for reporting

This commit is contained in:
Iampete1 2022-12-21 15:51:42 +00:00 committed by Andrew Tridgell
parent 33b09ff0cb
commit ec1814da34
5 changed files with 24 additions and 0 deletions

View File

@ -213,6 +213,15 @@ void AP_ExternalAHRS::update(void)
}
}
// Get model/type name
const char* AP_ExternalAHRS::get_name() const
{
if (backend) {
return backend->get_name();
}
return nullptr;
}
namespace AP {
AP_ExternalAHRS &externalAHRS()

View File

@ -55,6 +55,9 @@ public:
return rate.get();
}
// Get model/type name
const char* get_name() const;
// get serial port number, -1 for not enabled
int8_t get_port(void) const;

View File

@ -440,6 +440,12 @@ int8_t AP_ExternalAHRS_LORD::get_port(void) const
return port_num;
};
// Get model/type name
const char* AP_ExternalAHRS_LORD::get_name() const
{
return "LORD";
}
bool AP_ExternalAHRS_LORD::healthy(void) const
{
uint32_t now = AP_HAL::millis();

View File

@ -35,6 +35,9 @@ public:
// get serial port number, -1 for not enabled
int8_t get_port(void) const override;
// Get model/type name
const char* get_name() const override;
// accessors for AP_AHRS
bool healthy(void) const override;
bool initialised(void) const override;

View File

@ -29,6 +29,9 @@ public:
// get serial port number, -1 for not enabled
virtual int8_t get_port(void) const { return -1; }
// Get model/type name
virtual const char* get_name() const = 0;
// accessors for AP_AHRS
virtual bool healthy(void) const = 0;
virtual bool initialised(void) const = 0;