diff --git a/libraries/AP_OSD/AP_OSD_Screen.cpp b/libraries/AP_OSD/AP_OSD_Screen.cpp index 3a8cc2fff6e..93622b87625 100644 --- a/libraries/AP_OSD/AP_OSD_Screen.cpp +++ b/libraries/AP_OSD/AP_OSD_Screen.cpp @@ -2388,13 +2388,10 @@ void AP_OSD_Screen::draw_btemp(uint8_t x, uint8_t y) void AP_OSD_Screen::draw_atemp(uint8_t x, uint8_t y) { #if AP_AIRSPEED_ENABLED - AP_Airspeed *airspeed = AP_Airspeed::get_singleton(); - if (!airspeed) { - return; - } + const AP_Airspeed &airspeed = AP::airspeed(); float temperature = 0; - airspeed->get_temperature(temperature); - if (airspeed->healthy()) { + airspeed.get_temperature(temperature); + if (airspeed.healthy()) { backend->write(x, y, false, "%3d%c", (int)u_scale(TEMPERATURE, temperature), u_icon(TEMPERATURE)); } else { backend->write(x, y, false, "--%c", u_icon(TEMPERATURE)); @@ -2415,12 +2412,9 @@ void AP_OSD_Screen::draw_bat2used(uint8_t x, uint8_t y) void AP_OSD_Screen::draw_aspd1(uint8_t x, uint8_t y) { #if AP_AIRSPEED_ENABLED - AP_Airspeed *airspeed = AP_Airspeed::get_singleton(); - if (!airspeed) { - return; - } - float asp1 = airspeed->get_airspeed(); - if (airspeed != nullptr && airspeed->healthy()) { + const AP_Airspeed &airspeed = AP::airspeed(); + float asp1 = airspeed.get_airspeed(); + if (airspeed.healthy()) { backend->write(x, y, false, "%c%4d%c", SYMBOL(SYM_ASPD), (int)u_scale(SPEED, asp1), u_icon(SPEED)); } else { backend->write(x, y, false, "%c ---%c", SYMBOL(SYM_ASPD), u_icon(SPEED)); @@ -2431,12 +2425,9 @@ void AP_OSD_Screen::draw_aspd1(uint8_t x, uint8_t y) void AP_OSD_Screen::draw_aspd2(uint8_t x, uint8_t y) { #if AP_AIRSPEED_ENABLED - AP_Airspeed *airspeed = AP_Airspeed::get_singleton(); - if (!airspeed) { - return; - } - float asp2 = airspeed->get_airspeed(1); - if (airspeed != nullptr && airspeed->healthy(1)) { + const AP_Airspeed &airspeed = AP::airspeed(); + float asp2 = airspeed.get_airspeed(1); + if (airspeed.healthy(1)) { backend->write(x, y, false, "%c%4d%c", SYMBOL(SYM_ASPD), (int)u_scale(SPEED, asp2), u_icon(SPEED)); } else { backend->write(x, y, false, "%c ---%c", SYMBOL(SYM_ASPD), u_icon(SPEED));