From 8fd2d4b1fc31ee0807ef00a5f20a869418e9106e Mon Sep 17 00:00:00 2001 From: Craig Leres Date: Sun, 22 Dec 2019 16:55:08 -0800 Subject: [PATCH] ADSB RX: fix negative lat/lon formatting and insure two decimal places (#293) --- firmware/application/apps/ui_adsb_rx.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/firmware/application/apps/ui_adsb_rx.cpp b/firmware/application/apps/ui_adsb_rx.cpp index 608af90ac..76d22730c 100644 --- a/firmware/application/apps/ui_adsb_rx.cpp +++ b/firmware/application/apps/ui_adsb_rx.cpp @@ -226,9 +226,9 @@ void ADSBRxView::on_frame(const ADSBFrameMessage * message) { if (entry.pos.valid) { str_info = "Alt:" + to_string_dec_uint(entry.pos.altitude) + " Lat" + to_string_dec_int(entry.pos.latitude) + - "." + to_string_dec_int((int)(entry.pos.latitude * 1000) % 100) + + "." + to_string_dec_int((int)abs(entry.pos.latitude * 1000) % 100, 2, '0') + " Lon" + to_string_dec_int(entry.pos.longitude) + - "." + to_string_dec_int((int)(entry.pos.longitude * 1000) % 100); + "." + to_string_dec_int((int)abs(entry.pos.longitude * 1000) % 100, 2, '0'); entry.set_info_string(str_info); logentry+=str_info+ " ";