mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-21 07:15:18 +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);
|
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)
|
static void osdShowStats(void)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
if (!isSomeStatEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t top = 2;
|
uint8_t top = 2;
|
||||||
char buff[10];
|
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.
|
* Performs a test of the OSD actions on disarming.
|
||||||
* (reused throughout the test suite)
|
* (reused throughout the test suite)
|
||||||
|
@ -147,10 +159,11 @@ void doTestDisarm()
|
||||||
|
|
||||||
// then
|
// then
|
||||||
// post flight statistics displayed
|
// post flight statistics displayed
|
||||||
|
if (isSomeStatEnabled()) {
|
||||||
displayPortTestBufferSubstring(2, 2, " --- STATS ---");
|
displayPortTestBufferSubstring(2, 2, " --- STATS ---");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Tests initialisation of the OSD and the power on splash screen.
|
* Tests initialisation of the OSD and the power on splash screen.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue