From fb0b92cc94c487db6e6ec4212330e0879caff8e2 Mon Sep 17 00:00:00 2001 From: Henry Wurzburg Date: Tue, 24 Sep 2019 10:30:43 -0500 Subject: [PATCH] AP_OSD: scale xtrack, add precision for distances <10 units --- libraries/AP_OSD/AP_OSD_Screen.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libraries/AP_OSD/AP_OSD_Screen.cpp b/libraries/AP_OSD/AP_OSD_Screen.cpp index 216c3ce595..996e91fdd9 100644 --- a/libraries/AP_OSD/AP_OSD_Screen.cpp +++ b/libraries/AP_OSD/AP_OSD_Screen.cpp @@ -1143,6 +1143,8 @@ void AP_OSD_Screen::draw_distance(uint8_t x, uint8_t y, float distance) } else { fmt = "%4.0f%c"; } + } else if (distance_scaled < 10.0f) { + fmt = "% 3.1f%c"; } backend->write(x, y, false, fmt, (double)distance_scaled, unit_icon); } @@ -1400,7 +1402,8 @@ void AP_OSD_Screen::draw_waypoint(uint8_t x, uint8_t y) void AP_OSD_Screen::draw_xtrack_error(uint8_t x, uint8_t y) { - backend->write(x, y, false, "%c%4d", SYM_XERR, (int)osd->nav_info.wp_xtrack_error); + backend->write(x, y, false, "%c", SYM_XERR); + draw_distance(x+1, y, osd->nav_info.wp_xtrack_error); } void AP_OSD_Screen::draw_stat(uint8_t x, uint8_t y)