From b2a100f41bd5f28a9ca297fbe29c71065c7e08db Mon Sep 17 00:00:00 2001 From: Hwurzburg Date: Wed, 28 Jul 2021 18:29:37 -0500 Subject: [PATCH] AP_OSD: correct OSD horizon for VTOL modes and TRIM_PITCH_CD in FW modes --- libraries/AP_OSD/AP_OSD_Screen.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/libraries/AP_OSD/AP_OSD_Screen.cpp b/libraries/AP_OSD/AP_OSD_Screen.cpp index 2282268cc6..2385978844 100644 --- a/libraries/AP_OSD/AP_OSD_Screen.cpp +++ b/libraries/AP_OSD/AP_OSD_Screen.cpp @@ -40,6 +40,7 @@ #include #include #include +#include #if APM_BUILD_TYPE(APM_BUILD_Rover) #include #endif @@ -1455,8 +1456,10 @@ void AP_OSD_Screen::draw_horizon(uint8_t x, uint8_t y) { AP_AHRS &ahrs = AP::ahrs(); WITH_SEMAPHORE(ahrs.get_semaphore()); - float roll = ahrs.roll; - float pitch = -ahrs.pitch; + float roll; + float pitch; + AP::vehicle()->get_osd_roll_pitch_rad(roll,pitch); + pitch *= -1; //inverted roll AH if (check_option(AP_OSD::OPTION_INVERTED_AH_ROLL)) {