mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-23 08:15:30 +03:00
Add OSD profile switching to MSP and CMS
Update the active OSD profile based on the MSP message. Makes the OSD show the selected profile immediately when the drop-down is changed in the Configurator. All other elements have "live" updates so this should a well. Add CMS menu to select the OSD profile.
This commit is contained in:
parent
2c739346c6
commit
1d6f86d234
2 changed files with 17 additions and 0 deletions
|
@ -250,8 +250,16 @@ static uint8_t displayPortProfileMax7456_blackBrightness;
|
||||||
static uint8_t displayPortProfileMax7456_whiteBrightness;
|
static uint8_t displayPortProfileMax7456_whiteBrightness;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef USE_OSD_PROFILES
|
||||||
|
static uint8_t osdConfig_osdProfileIndex;
|
||||||
|
#endif
|
||||||
|
|
||||||
static long cmsx_menuOsdOnEnter(void)
|
static long cmsx_menuOsdOnEnter(void)
|
||||||
{
|
{
|
||||||
|
#ifdef USE_OSD_PROFILES
|
||||||
|
osdConfig_osdProfileIndex = osdConfig()->osdProfileIndex;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_MAX7456
|
#ifdef USE_MAX7456
|
||||||
displayPortProfileMax7456_invert = displayPortProfileMax7456()->invert;
|
displayPortProfileMax7456_invert = displayPortProfileMax7456()->invert;
|
||||||
displayPortProfileMax7456_blackBrightness = displayPortProfileMax7456()->blackBrightness;
|
displayPortProfileMax7456_blackBrightness = displayPortProfileMax7456()->blackBrightness;
|
||||||
|
@ -265,6 +273,11 @@ static long cmsx_menuOsdOnExit(const OSD_Entry *self)
|
||||||
{
|
{
|
||||||
UNUSED(self);
|
UNUSED(self);
|
||||||
|
|
||||||
|
#ifdef USE_OSD_PROFILES
|
||||||
|
osdConfigMutable()->osdProfileIndex = osdConfig_osdProfileIndex;
|
||||||
|
setOsdProfile(osdConfig()->osdProfileIndex);
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef USE_MAX7456
|
#ifdef USE_MAX7456
|
||||||
displayPortProfileMax7456Mutable()->invert = displayPortProfileMax7456_invert;
|
displayPortProfileMax7456Mutable()->invert = displayPortProfileMax7456_invert;
|
||||||
displayPortProfileMax7456Mutable()->blackBrightness = displayPortProfileMax7456_blackBrightness;
|
displayPortProfileMax7456Mutable()->blackBrightness = displayPortProfileMax7456_blackBrightness;
|
||||||
|
@ -277,6 +290,9 @@ static long cmsx_menuOsdOnExit(const OSD_Entry *self)
|
||||||
OSD_Entry cmsx_menuOsdEntries[] =
|
OSD_Entry cmsx_menuOsdEntries[] =
|
||||||
{
|
{
|
||||||
{"---OSD---", OME_Label, NULL, NULL, 0},
|
{"---OSD---", OME_Label, NULL, NULL, 0},
|
||||||
|
#ifdef USE_OSD_PROFILES
|
||||||
|
{"OSD PROFILE", OME_UINT8, NULL, &(OSD_UINT8_t){&osdConfig_osdProfileIndex, 1, 3, 1}, 0},
|
||||||
|
#endif
|
||||||
#ifdef USE_EXTENDED_CMS_MENUS
|
#ifdef USE_EXTENDED_CMS_MENUS
|
||||||
{"ACTIVE ELEM", OME_Submenu, cmsMenuChange, &menuOsdActiveElems, 0},
|
{"ACTIVE ELEM", OME_Submenu, cmsMenuChange, &menuOsdActiveElems, 0},
|
||||||
{"TIMERS", OME_Submenu, cmsMenuChange, &menuTimers, 0},
|
{"TIMERS", OME_Submenu, cmsMenuChange, &menuTimers, 0},
|
||||||
|
|
|
@ -2655,6 +2655,7 @@ static mspResult_e mspCommonProcessInCommand(uint8_t cmdMSP, sbuf_t *src, mspPos
|
||||||
// selected OSD profile
|
// selected OSD profile
|
||||||
#ifdef USE_OSD_PROFILES
|
#ifdef USE_OSD_PROFILES
|
||||||
osdConfigMutable()->osdProfileIndex = sbufReadU8(src);
|
osdConfigMutable()->osdProfileIndex = sbufReadU8(src);
|
||||||
|
setOsdProfile(osdConfig()->osdProfileIndex);
|
||||||
#else
|
#else
|
||||||
sbufReadU8(src);
|
sbufReadU8(src);
|
||||||
#endif // USE_OSD_PROFILES
|
#endif // USE_OSD_PROFILES
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue