1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 08:45:36 +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

@ -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.
*/