1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-19 22:35:23 +03:00

Reordered Max Altitude and Total Distance in stats screen

This commit is contained in:
Tony Cabello 2018-12-01 08:54:12 +01:00
parent c39ea81b6a
commit a0604dd1a5
2 changed files with 24 additions and 25 deletions

View file

@ -1787,16 +1787,29 @@ static void osdShowStats(uint16_t endBatteryVoltage)
osdDisplayStatisticLabel(top++, osdTimerSourceNames[OSD_TIMER_SRC(osdConfig()->timers[OSD_TIMER_2])], buff); osdDisplayStatisticLabel(top++, osdTimerSourceNames[OSD_TIMER_SRC(osdConfig()->timers[OSD_TIMER_2])], buff);
} }
if (osdStatGetState(OSD_STAT_MAX_ALTITUDE)) {
osdFormatAltitudeString(buff, stats.max_altitude);
osdDisplayStatisticLabel(top++, "MAX ALTITUDE", buff);
}
#ifdef USE_GPS #ifdef USE_GPS
if (osdStatGetState(OSD_STAT_MAX_SPEED) && featureIsEnabled(FEATURE_GPS)) { if (featureIsEnabled(FEATURE_GPS)) {
if (osdStatGetState(OSD_STAT_MAX_SPEED)) {
itoa(stats.max_speed, buff, 10); itoa(stats.max_speed, buff, 10);
osdDisplayStatisticLabel(top++, "MAX SPEED", buff); osdDisplayStatisticLabel(top++, "MAX SPEED", buff);
} }
if (osdStatGetState(OSD_STAT_MAX_DISTANCE) && featureIsEnabled(FEATURE_GPS)) { if (osdStatGetState(OSD_STAT_MAX_DISTANCE)) {
tfp_sprintf(buff, "%d%c", osdGetMetersToSelectedUnit(stats.max_distance), osdGetMetersToSelectedUnitSymbol()); tfp_sprintf(buff, "%d%c", osdGetMetersToSelectedUnit(stats.max_distance), osdGetMetersToSelectedUnitSymbol());
osdDisplayStatisticLabel(top++, "MAX DISTANCE", buff); osdDisplayStatisticLabel(top++, "MAX DISTANCE", buff);
} }
if (osdStatGetState(OSD_STAT_FLIGHT_DISTANCE)) {
const uint32_t distanceFlown = GPS_distanceFlownInCm / 100;
tfp_sprintf(buff, "%d%c", osdGetMetersToSelectedUnit(distanceFlown), osdGetMetersToSelectedUnitSymbol());
osdDisplayStatisticLabel(top++, "FLIGHT DISTANCE", buff);
}
}
#endif #endif
if (osdStatGetState(OSD_STAT_MIN_BATTERY)) { if (osdStatGetState(OSD_STAT_MIN_BATTERY)) {
@ -1833,11 +1846,6 @@ static void osdShowStats(uint16_t endBatteryVoltage)
} }
} }
if (osdStatGetState(OSD_STAT_MAX_ALTITUDE)) {
osdFormatAltitudeString(buff, stats.max_altitude);
osdDisplayStatisticLabel(top++, "MAX ALTITUDE", buff);
}
#ifdef USE_BLACKBOX #ifdef USE_BLACKBOX
if (osdStatGetState(OSD_STAT_BLACKBOX) && blackboxConfig()->device && blackboxConfig()->device != BLACKBOX_DEVICE_SERIAL) { if (osdStatGetState(OSD_STAT_BLACKBOX) && blackboxConfig()->device && blackboxConfig()->device != BLACKBOX_DEVICE_SERIAL) {
osdGetBlackboxStatusString(buff); osdGetBlackboxStatusString(buff);
@ -1876,14 +1884,6 @@ static void osdShowStats(uint16_t endBatteryVoltage)
} }
#endif #endif
#ifdef USE_GPS
if (osdStatGetState(OSD_STAT_FLIGHT_DISTANCE) && featureIsEnabled(FEATURE_GPS)) {
const uint32_t distanceFlown = GPS_distanceFlownInCm / 100;
tfp_sprintf(buff, "%d%c", osdGetMetersToSelectedUnit(distanceFlown), osdGetMetersToSelectedUnitSymbol());
osdDisplayStatisticLabel(top++, "FLIGHT DISTANCE", buff);
}
#endif
#if defined(USE_GYRO_DATA_ANALYSE) #if defined(USE_GYRO_DATA_ANALYSE)
if (osdStatGetState(OSD_STAT_MAX_FFT) && featureIsEnabled(FEATURE_DYNAMIC_FILTER)) { if (osdStatGetState(OSD_STAT_MAX_FFT) && featureIsEnabled(FEATURE_DYNAMIC_FILTER)) {
int value = getMaxFFT(); int value = getMaxFFT();
@ -1895,7 +1895,6 @@ static void osdShowStats(uint16_t endBatteryVoltage)
} }
} }
#endif #endif
} }
static void osdShowArmed(void) static void osdShowArmed(void)

View file

@ -394,13 +394,13 @@ TEST(OsdTest, TestStatsImperial)
displayPortTestBufferSubstring(2, row++, "2017-11-19 10:12:"); displayPortTestBufferSubstring(2, row++, "2017-11-19 10:12:");
displayPortTestBufferSubstring(2, row++, "TOTAL ARM : 00:05.00"); displayPortTestBufferSubstring(2, row++, "TOTAL ARM : 00:05.00");
displayPortTestBufferSubstring(2, row++, "LAST ARM : 00:03"); displayPortTestBufferSubstring(2, row++, "LAST ARM : 00:03");
displayPortTestBufferSubstring(2, row++, "MAX ALTITUDE : 6.5%c", SYM_FT);
displayPortTestBufferSubstring(2, row++, "MAX SPEED : 17"); displayPortTestBufferSubstring(2, row++, "MAX SPEED : 17");
displayPortTestBufferSubstring(2, row++, "MAX DISTANCE : 328%c", SYM_FT); displayPortTestBufferSubstring(2, row++, "MAX DISTANCE : 328%c", SYM_FT);
displayPortTestBufferSubstring(2, row++, "FLIGHT DISTANCE : 656%c", SYM_FT);
displayPortTestBufferSubstring(2, row++, "MIN BATTERY : 14.70%c", SYM_VOLT); displayPortTestBufferSubstring(2, row++, "MIN BATTERY : 14.70%c", SYM_VOLT);
displayPortTestBufferSubstring(2, row++, "END BATTERY : 15.20%c", SYM_VOLT); displayPortTestBufferSubstring(2, row++, "END BATTERY : 15.20%c", SYM_VOLT);
displayPortTestBufferSubstring(2, row++, "MIN RSSI : 25%%"); displayPortTestBufferSubstring(2, row++, "MIN RSSI : 25%%");
displayPortTestBufferSubstring(2, row++, "MAX ALTITUDE : 6.5%c", SYM_FT);
displayPortTestBufferSubstring(2, row++, "FLIGHT DISTANCE : 656%c", SYM_FT);
} }
/* /*
@ -447,13 +447,13 @@ TEST(OsdTest, TestStatsMetric)
displayPortTestBufferSubstring(2, row++, "2017-11-19 10:12:"); displayPortTestBufferSubstring(2, row++, "2017-11-19 10:12:");
displayPortTestBufferSubstring(2, row++, "TOTAL ARM : 00:07.50"); displayPortTestBufferSubstring(2, row++, "TOTAL ARM : 00:07.50");
displayPortTestBufferSubstring(2, row++, "LAST ARM : 00:02"); displayPortTestBufferSubstring(2, row++, "LAST ARM : 00:02");
displayPortTestBufferSubstring(2, row++, "MAX ALTITUDE : 2.0%c", SYM_M);
displayPortTestBufferSubstring(2, row++, "MAX SPEED : 28"); displayPortTestBufferSubstring(2, row++, "MAX SPEED : 28");
displayPortTestBufferSubstring(2, row++, "MAX DISTANCE : 100%c", SYM_M); displayPortTestBufferSubstring(2, row++, "MAX DISTANCE : 100%c", SYM_M);
displayPortTestBufferSubstring(2, row++, "FLIGHT DISTANCE : 100%c", SYM_M);
displayPortTestBufferSubstring(2, row++, "MIN BATTERY : 14.70%c", SYM_VOLT); displayPortTestBufferSubstring(2, row++, "MIN BATTERY : 14.70%c", SYM_VOLT);
displayPortTestBufferSubstring(2, row++, "END BATTERY : 15.20%c", SYM_VOLT); displayPortTestBufferSubstring(2, row++, "END BATTERY : 15.20%c", SYM_VOLT);
displayPortTestBufferSubstring(2, row++, "MIN RSSI : 25%%"); displayPortTestBufferSubstring(2, row++, "MIN RSSI : 25%%");
displayPortTestBufferSubstring(2, row++, "MAX ALTITUDE : 2.0%c", SYM_M);
displayPortTestBufferSubstring(2, row++, "FLIGHT DISTANCE : 100%c", SYM_M);
} }
/* /*