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;
if (item == OSD_GPS_LAT) {
buff[0] = 0x64; // right arrow
buff[0] = SYM_ARROW_EAST;
val = GPS_coord[LAT];
} else {
buff[0] = 0x60; // down arrow
buff[0] = SYM_ARROW_SOUTH;
val = GPS_coord[LON];
}
if (val >= 0) {
val += 1000000000;
} else {
val -= 1000000000;
}
itoa(val, &buff[1], 10);
buff[1] = buff[2];
buff[2] = buff[3];
buff[3] = '.';
char wholeDegreeString[5];
tfp_sprintf(wholeDegreeString, "%d", val / GPS_DEGREES_DIVIDER);
char wholeUnshifted[12];
tfp_sprintf(wholeUnshifted, "%d", val);
tfp_sprintf(buff + 1, "%s.%s", wholeDegreeString, wholeUnshifted + strlen(wholeDegreeString));
break;
}