1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-17 05:15:25 +03:00

Move the Altitude alignment left in the OSD (#8339)

Move the Altitude alignment left in the OSD
This commit is contained in:
Michael Keller 2019-05-25 22:30:19 +12:00 committed by GitHub
commit 339621ced3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 10 deletions

View file

@ -211,9 +211,12 @@ static void osdFormatAltitudeString(char * buff, int32_t altitudeCm)
{
const int alt = osdGetMetersToSelectedUnit(altitudeCm) / 10;
tfp_sprintf(buff, "%c%5d %c", SYM_ALTITUDE, alt, osdGetMetersToSelectedUnitSymbol());
buff[6] = buff[5];
buff[5] = '.';
int pos = 0;
buff[pos++] = SYM_ALTITUDE;
if (alt < 0) {
buff[pos++] = '-';
}
tfp_sprintf(buff + pos, "%01d.%01d%c", abs(alt) / 10 , abs(alt) % 10, osdGetMetersToSelectedUnitSymbol());
}
#ifdef USE_GPS

View file

@ -524,7 +524,7 @@ TEST(OsdTest, TestAlarms)
displayPortTestBufferSubstring(12, 1, "%c16.8%c", SYM_BATT_FULL, SYM_VOLT);
displayPortTestBufferSubstring(1, 1, "%c00:", SYM_FLY_M); // only test the minute part of the timer
displayPortTestBufferSubstring(20, 1, "%c01:", SYM_ON_M); // only test the minute part of the timer
displayPortTestBufferSubstring(23, 7, "%c .0%c", SYM_ALTITUDE, SYM_M);
displayPortTestBufferSubstring(23, 7, "%c0.0%c", SYM_ALTITUDE, SYM_M);
}
// when
@ -774,7 +774,7 @@ TEST(OsdTest, TestElementAltitude)
osdRefresh(simulationTime);
// then
displayPortTestBufferSubstring(23, 7, "%c .0%c", SYM_ALTITUDE, SYM_M);
displayPortTestBufferSubstring(23, 7, "%c0.0%c", SYM_ALTITUDE, SYM_M);
// when
simulationAltitude = 247;
@ -806,7 +806,8 @@ TEST(OsdTest, TestElementAltitude)
osdRefresh(simulationTime);
// then
displayPortTestBufferSubstring(23, 7, "%c -.7%c", SYM_ALTITUDE, SYM_M);
displayPortTestBufferSubstring(23, 7, "%c-0.7%c", SYM_ALTITUDE, SYM_M);
}
/*