From 0169a9287d24b329e5c3f3240e5d3db8869c7cf3 Mon Sep 17 00:00:00 2001 From: Alexander Malishev Date: Sun, 1 Jul 2018 08:22:58 +0400 Subject: [PATCH] AP_OSD: fixed issues with horizont and home Fixed roll direction. Fixed home direction at small distances --- libraries/AP_OSD/AP_OSD_Screen.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/AP_OSD/AP_OSD_Screen.cpp b/libraries/AP_OSD/AP_OSD_Screen.cpp index 18d00691ee..a2c1b68650 100644 --- a/libraries/AP_OSD/AP_OSD_Screen.cpp +++ b/libraries/AP_OSD/AP_OSD_Screen.cpp @@ -253,7 +253,7 @@ void AP_OSD_Screen::draw_gspeed(uint8_t x, uint8_t y) void AP_OSD_Screen::draw_horizon(uint8_t x, uint8_t y) { AP_AHRS &ahrs = AP::ahrs(); - float roll = ahrs.roll; + float roll = -ahrs.roll; float pitch = ahrs.pitch; roll = constrain_float(roll, -ah_max_roll, ah_max_roll); @@ -281,6 +281,10 @@ void AP_OSD_Screen::draw_home(uint8_t x, uint8_t y) float distance = get_distance(home_loc, loc); int32_t angle = get_bearing_cd(loc, home_loc); int32_t interval = 36000 / SYM_ARROW_COUNT; + if (distance < 2.0f) { + //avoid fast rotating arrow at small distances + angle = 0; + } char arrow = SYM_ARROW_START + ((angle + interval / 2) / interval) % SYM_ARROW_COUNT; if (distance < 999.0f) { backend->write(x, y, false, "%c%c%3.0f%c", SYM_HOME, arrow, distance, SYM_M);