From 5e54d26ac5262d510b4ba298eecab39059c9c0e9 Mon Sep 17 00:00:00 2001 From: Henry Wurzburg Date: Tue, 2 May 2023 21:56:58 -0500 Subject: [PATCH] AP_OSD: fix format of RF panel and check for out of range --- libraries/AP_OSD/AP_OSD_Screen.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/libraries/AP_OSD/AP_OSD_Screen.cpp b/libraries/AP_OSD/AP_OSD_Screen.cpp index 86ca4647db..64285146b4 100644 --- a/libraries/AP_OSD/AP_OSD_Screen.cpp +++ b/libraries/AP_OSD/AP_OSD_Screen.cpp @@ -2201,12 +2201,11 @@ void AP_OSD_Screen::draw_rngf(uint8_t x, uint8_t y) if (rangefinder == nullptr) { return; } - if (rangefinder->status_orient(ROTATION_PITCH_270) <= RangeFinder::Status::NoData) { - backend->write(x, y, false, "%c----%c", SYMBOL(SYM_RNGFD), u_icon(DISTANCE)); + if (rangefinder->status_orient(ROTATION_PITCH_270) < RangeFinder::Status::Good) { + backend->write(x, y, false, "%c---%c", SYMBOL(SYM_RNGFD), u_icon(DISTANCE)); } else { const float distance = rangefinder->distance_orient(ROTATION_PITCH_270); - const char *format = distance < 9.995 ? "%c %1.2f%c" : "%c%2.2f%c"; - backend->write(x, y, false, format, SYMBOL(SYM_RNGFD), u_scale(DISTANCE, distance), u_icon(DISTANCE)); + backend->write(x, y, false, "%c%4.1f%c", SYMBOL(SYM_RNGFD), u_scale(DISTANCE, distance), u_icon(DISTANCE)); } }