mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-19 14:25:20 +03:00
Merge pull request #4428 from McGiverGim/bf-osd_stats_only_when_enabled
Show stats only if enabled
This commit is contained in:
commit
10c18d8473
2 changed files with 32 additions and 2 deletions
|
@ -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];
|
||||
|
||||
|
|
|
@ -131,6 +131,18 @@ void doTestArm(bool testEmpty = true)
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Auxiliary function. Test is there're stats that must be shown
|
||||
*/
|
||||
bool isSomeStatEnabled(void) {
|
||||
for (int i = 0; i < OSD_STAT_COUNT; i++) {
|
||||
if (osdConfigMutable()->enabled_stats[i]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Performs a test of the OSD actions on disarming.
|
||||
* (reused throughout the test suite)
|
||||
|
@ -147,10 +159,11 @@ void doTestDisarm()
|
|||
|
||||
// then
|
||||
// post flight statistics displayed
|
||||
displayPortTestBufferSubstring(2, 2, " --- STATS ---");
|
||||
if (isSomeStatEnabled()) {
|
||||
displayPortTestBufferSubstring(2, 2, " --- STATS ---");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Tests initialisation of the OSD and the power on splash screen.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue