mirror of
https://bitbucket.org/librepilot/librepilot.git
synced 2025-01-29 14:52:12 +01:00
gpsdisplay: correct lat/lon minute calculation for 3/4 of earth
The computation of the minutes portion of the lat/lon was wrong for any negative values. lat-deg was effectively doubling the whole degree part rather than removing it for any negative whole degree part so you would get huge whole minute parts. git-svn-id: svn://svn.openpilot.org/OpenPilot/trunk@1542 ebee16cc-31ac-478f-84a7-5cbb03baadba
This commit is contained in:
parent
95595664c3
commit
44b41c32d2
@ -113,8 +113,8 @@ void GpsDisplayWidget::setPosition(double lat, double lon, double alt)
|
||||
{
|
||||
//lat *= 1E-7;
|
||||
//lon *= 1E-7;
|
||||
double deg = (lat>0) ? floor(lat):ceil(lat);
|
||||
double min = fabs(lat-deg)*60;
|
||||
double deg = floor(fabs(lat));
|
||||
double min = (fabs(lat)-deg)*60;
|
||||
QString str1;
|
||||
str1.sprintf("%.0f%c%.3f' ", deg,0x00b0, min);
|
||||
if (lat>0)
|
||||
@ -122,8 +122,8 @@ void GpsDisplayWidget::setPosition(double lat, double lon, double alt)
|
||||
else
|
||||
str1.append("S");
|
||||
coord_value->setText(str1);
|
||||
deg = floor(fabs(lon)); // ABS takes an int.
|
||||
min = fabs(lon-deg)*60;
|
||||
deg = floor(fabs(lon));
|
||||
min = (fabs(lon)-deg)*60;
|
||||
QString str2;
|
||||
str2.sprintf("%.0f%c%.3f' ", deg,0x00b0, min);
|
||||
if (lon>0)
|
||||
|
Loading…
x
Reference in New Issue
Block a user