AP_ADSB: use AP::ahrs() singleton

This commit is contained in:
Peter Barker 2018-01-02 07:41:20 +11:00 committed by Francisco Ferreira
parent dc30197ca7
commit ae3099ef4b
2 changed files with 3 additions and 8 deletions

View File

@ -161,7 +161,7 @@ void AP_ADSB::deinit(void)
void AP_ADSB::update(void)
{
// update _my_loc
if (!_ahrs.get_position(_my_loc)) {
if (!AP::ahrs().get_position(_my_loc)) {
_my_loc.zero();
}
@ -506,7 +506,7 @@ void AP_ADSB::send_dynamic_out(const mavlink_channel_t chan)
const uint64_t gps_time = gps.time_epoch_usec();
const uint32_t utcTime = gps_time / 1000000ULL;
const AP_Baro &baro = _ahrs.get_baro();
const AP_Baro &baro = AP::ahrs().get_baro();
int32_t altPres = INT_MAX;
if (baro.healthy()) {
// Altitude difference between 101325 (Pascals) and current pressure. Result in millimeters

View File

@ -31,8 +31,7 @@
class AP_ADSB {
public:
AP_ADSB(const AP_AHRS &ahrs)
: _ahrs(ahrs)
AP_ADSB()
{
AP_Param::setup_object_defaults(this, var_info);
}
@ -109,10 +108,6 @@ private:
// handle ADS-B transceiver report for ping2020
void handle_transceiver_report(mavlink_channel_t chan, const mavlink_message_t* msg);
// reference to AHRS, so we can ask for our position,
// heading and speed
const AP_AHRS &_ahrs;
AP_Int8 _enabled;
Location_Class _my_loc;