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

Show stats only if enabled

If no enabled stat to show, don't show the stats page in the OSD
This commit is contained in:
Miguel Angel Mulero Martinez 2017-10-24 08:35:02 +02:00
parent 94db0c925b
commit dadedd059f
2 changed files with 32 additions and 2 deletions

View file

@ -1015,8 +1015,25 @@ static void osdDisplayStatisticLabel(uint8_t y, const char * text, const char *
displayWrite(osdDisplayPort, 22, y, value);
}
/*
* Test if there's some stat enabled
*/
static bool isSomeStatEnabled(void) {
for (int i = 0; i < OSD_STAT_COUNT; i++) {
if (osdConfig()->enabled_stats[i]) {
return true;
}
}
return false;
}
static void osdShowStats(void)
{
if (!isSomeStatEnabled()) {
return;
}
uint8_t top = 2;
char buff[10];