From d95e0a1513e5688a9deeaaa0663c5082f584b7db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niccol=C3=B2=20Izzo?= Date: Wed, 24 Mar 2021 08:48:30 +0100 Subject: [PATCH] Print signed GPS longitude as unsigned+direction --- openrtx/src/ui/ui_menu.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/openrtx/src/ui/ui_menu.c b/openrtx/src/ui/ui_menu.c index 3492340c..f60bd1b6 100644 --- a/openrtx/src/ui/ui_menu.c +++ b/openrtx/src/ui/ui_menu.c @@ -349,9 +349,13 @@ void _ui_drawMenuGPS() color_white); gfx_print(layout.line2_pos, type_buf, layout.top_font, TEXT_ALIGN_LEFT, color_white); - gfx_print(layout.line2_pos, "E ", layout.top_font, TEXT_ALIGN_CENTER, + // Convert from signed longitude, to unsigned + direction + float longitude = last_state.gps_data.longitude; + char *direction = (longitude < 0) ? "W " : "E "; + longitude = (longitude < 0) ? -longitude : longitude; + gfx_print(layout.line2_pos, direction, layout.top_font, TEXT_ALIGN_CENTER, color_white); - snprintf(lon_buf, 12, "%8.6f", last_state.gps_data.longitude); + snprintf(lon_buf, 12, "%8.6f", longitude); gfx_print(layout.line2_pos, lon_buf, layout.top_font, TEXT_ALIGN_RIGHT, color_white); snprintf(data_buf, 25, "S %4.1fkm/h A %4.1fm",