Add MSP API features for OSD stat screen toggling
This commit is contained in:
parent
d83f0ddf5e
commit
5f4a72ad5b
|
@ -775,6 +775,9 @@ static bool mspCommonProcessOutCommand(uint8_t cmdMSP, sbuf_t *dst, mspPostProce
|
|||
for (int i = 0; i < OSD_ITEM_COUNT; i++) {
|
||||
sbufWriteU16(dst, osdConfig()->item_pos[i]);
|
||||
}
|
||||
for (int i = 0; i < OSD_STAT_COUNT; i++ ) {
|
||||
sbufWriteU8(dst, osdConfig()->enabled_stats[i]);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
@ -2039,8 +2042,9 @@ static mspResult_e mspCommonProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
|||
case MSP_SET_OSD_CONFIG:
|
||||
{
|
||||
const uint8_t addr = sbufReadU8(src);
|
||||
// set all the other settings
|
||||
|
||||
if ((int8_t)addr == -1) {
|
||||
/* Set general OSD settings */
|
||||
#ifdef USE_MAX7456
|
||||
vcdProfileMutable()->video_system = sbufReadU8(src);
|
||||
#else
|
||||
|
@ -2055,10 +2059,17 @@ static mspResult_e mspCommonProcessInCommand(uint8_t cmdMSP, sbuf_t *src)
|
|||
#endif
|
||||
} else {
|
||||
#if defined(OSD)
|
||||
// set a position setting
|
||||
const uint16_t pos = sbufReadU16(src);
|
||||
if (addr < OSD_ITEM_COUNT) {
|
||||
osdConfigMutable()->item_pos[addr] = pos;
|
||||
const uint16_t value = sbufReadU16(src);
|
||||
|
||||
/* Get screen index, 0 is post flight statsitsics, 1 and above are in flight OSD screens */
|
||||
const uint8_t screen = (sbufBytesRemaining(src) >= 1) ? sbufReadU8(src) : 1;
|
||||
|
||||
if (screen == 0 && addr < OSD_STAT_COUNT) {
|
||||
/* Set statistic item enable */
|
||||
osdConfigMutable()->enabled_stats[addr] = value;
|
||||
} else if (addr < OSD_ITEM_COUNT) {
|
||||
/* Set element positions */
|
||||
osdConfigMutable()->item_pos[addr] = value;
|
||||
}
|
||||
#else
|
||||
return MSP_RESULT_ERROR;
|
||||
|
|
Loading…
Reference in New Issue