diff --git a/libraries/AP_ADSB/AP_ADSB.cpp b/libraries/AP_ADSB/AP_ADSB.cpp index b467a6dfd79..0b6287fe3a5 100644 --- a/libraries/AP_ADSB/AP_ADSB.cpp +++ b/libraries/AP_ADSB/AP_ADSB.cpp @@ -518,7 +518,12 @@ void AP_ADSB::send_dynamic_out(const mavlink_channel_t chan) // -------------- // Unknowns // TODO: implement http://www.srh.noaa.gov/images/epz/wxcalc/pressureAltitude.pdf - int32_t altPres = INT_MAX; //_ahrs.get_baro().get_altitude() relative to home, not MSL + AP_Baro baro = _ahrs.get_baro(); + int32_t altPres = INT_MAX; + if (baro.healthy()) { + // Altitude difference between 101325 (Pascals) and current pressure. Result in millimeters + altPres = baro.get_altitude_difference(101325, baro.get_pressure()) * 1E3; // convert m to mm; + }