1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-16 12:55:19 +03:00

Change enabled OSD stats storage to bitmap

Previously the flags controlling the enabled OSD stats were stored as an array of boolean. This change reduces config storage by storing the flags as bits inside a single uint32.
This commit is contained in:
Bruce Luckcuck 2018-05-07 08:40:16 -04:00
parent 7b831f94ee
commit 905f14d86c
5 changed files with 79 additions and 71 deletions

View file

@ -699,7 +699,7 @@ static bool mspCommonProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProce
// Post flight statistics
sbufWriteU8(dst, OSD_STAT_COUNT);
for (int i = 0; i < OSD_STAT_COUNT; i++ ) {
sbufWriteU8(dst, osdConfig()->enabled_stats[i]);
sbufWriteU8(dst, osdStatGetState(i));
}
// Timers
@ -2191,7 +2191,7 @@ static mspResult_e mspCommonProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
if (screen == 0 && addr < OSD_STAT_COUNT) {
/* Set statistic item enable */
osdConfigMutable()->enabled_stats[addr] = value;
osdStatSetState(addr, (value != 0));
} else if (addr < OSD_ITEM_COUNT) {
/* Set element positions */
osdConfigMutable()->item_pos[addr] = value;