From 9ecf76534433bcc41216d923adeb27df35b7ab87 Mon Sep 17 00:00:00 2001 From: mjwaxios Date: Sun, 5 May 2019 11:48:12 -0400 Subject: [PATCH] Fixed negative lat and log deg, min, sec to decimal deg. (#240) --- firmware/application/ui/ui_geomap.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/firmware/application/ui/ui_geomap.cpp b/firmware/application/ui/ui_geomap.cpp index 724665a0e..a8a47fd6e 100644 --- a/firmware/application/ui/ui_geomap.cpp +++ b/firmware/application/ui/ui_geomap.cpp @@ -120,11 +120,19 @@ void GeoPos::set_lon(float lon) { } float GeoPos::lat() { - return field_lat_degrees.value() + (field_lat_minutes.value() / 60.0) + (field_lat_seconds.value() / 3600.0); + if (field_lat_degrees.value() < 0) { + return -1 * ( -1 * field_lat_degrees.value() + (field_lat_minutes.value() / 60.0) + (field_lat_seconds.value() / 3600.0)); + } else { + return field_lat_degrees.value() + (field_lat_minutes.value() / 60.0) + (field_lat_seconds.value() / 3600.0); + } }; float GeoPos::lon() { - return field_lon_degrees.value() + (field_lon_minutes.value() / 60.0) + (field_lon_seconds.value() / 3600.0); + if (field_lon_degrees.value() < 0) { + return -1 * (-1 * field_lon_degrees.value() + (field_lon_minutes.value() / 60.0) + (field_lon_seconds.value() / 3600.0)); + } else { + return field_lon_degrees.value() + (field_lon_minutes.value() / 60.0) + (field_lon_seconds.value() / 3600.0); + } }; int32_t GeoPos::altitude() {