AP_InertialSensor: External: report name in output banner

This commit is contained in:
Iampete1 2022-12-21 15:52:22 +00:00 committed by Andrew Tridgell
parent ec1814da34
commit 2e465b4c18
2 changed files with 13 additions and 0 deletions

View File

@ -1,6 +1,7 @@
#include <AP_HAL/AP_HAL.h>
#include "AP_InertialSensor_ExternalAHRS.h"
#include <AP_ExternalAHRS/AP_ExternalAHRS.h>
#include <stdio.h>
#if HAL_EXTERNAL_AHRS_ENABLED
@ -55,5 +56,16 @@ void AP_InertialSensor_ExternalAHRS::accumulate()
AP::externalAHRS().update();
}
// get a startup banner to output to the GCS
bool AP_InertialSensor_ExternalAHRS::get_output_banner(char* banner, uint8_t banner_len)
{
const char* name = AP::externalAHRS().get_name();
snprintf(banner, banner_len, "IMU%u: External: %s %0.0fHz",
gyro_instance,
(name != nullptr) ? name : "",
AP::externalAHRS().get_IMU_rate());
return true;
}
#endif // HAL_EXTERNAL_AHRS_ENABLED

View File

@ -18,6 +18,7 @@ public:
void accumulate() override;
void handle_external(const AP_ExternalAHRS::ins_data_message_t &pkt) override;
bool get_output_banner(char* banner, uint8_t banner_len) override;
private:
uint8_t gyro_instance;