Merge pull request #3269 from McGiverGim/bf-fix_gps_coordinates_OSD

Fix GPS coordinates in OSD
This commit is contained in:
Michael Keller 2017-06-14 12:07:29 +12:00 committed by GitHub
commit 0f951ae716
1 changed files with 10 additions and 11 deletions

View File

@ -262,21 +262,20 @@ static void osdDrawSingleElement(uint8_t item)
{ {
int32_t val; int32_t val;
if (item == OSD_GPS_LAT) { if (item == OSD_GPS_LAT) {
buff[0] = 0x64; // right arrow buff[0] = SYM_ARROW_EAST;
val = GPS_coord[LAT]; val = GPS_coord[LAT];
} else { } else {
buff[0] = 0x60; // down arrow buff[0] = SYM_ARROW_SOUTH;
val = GPS_coord[LON]; val = GPS_coord[LON];
} }
if (val >= 0) {
val += 1000000000; char wholeDegreeString[5];
} else { tfp_sprintf(wholeDegreeString, "%d", val / GPS_DEGREES_DIVIDER);
val -= 1000000000;
} char wholeUnshifted[12];
itoa(val, &buff[1], 10); tfp_sprintf(wholeUnshifted, "%d", val);
buff[1] = buff[2];
buff[2] = buff[3]; tfp_sprintf(buff + 1, "%s.%s", wholeDegreeString, wholeUnshifted + strlen(wholeDegreeString));
buff[3] = '.';
break; break;
} }