1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-15 20:35:33 +03:00

Make CMS OSD menu max7456 settings have realtime effect (#9275)

Make CMS OSD menu max7456 settings have realtime effect
This commit is contained in:
Michael Keller 2019-12-10 12:41:03 +13:00 committed by GitHub
commit dad2b244e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 4 deletions

View file

@ -961,6 +961,9 @@ STATIC_UNIT_TESTED uint16_t cmsHandleKey(displayPort_t *pDisplay, cms_key_e key)
if ((p->flags & REBOOT_REQUIRED) && (*val != previousValue)) { if ((p->flags & REBOOT_REQUIRED) && (*val != previousValue)) {
setRebootRequired(); setRebootRequired();
} }
if (p->func) {
p->func(pDisplay, p->data);
}
} }
break; break;

View file

@ -314,14 +314,23 @@ static const void *cmsx_menuOsdOnExit(const OSD_Entry *self)
changeOsdProfileIndex(osdConfig_osdProfileIndex); changeOsdProfileIndex(osdConfig_osdProfileIndex);
#endif #endif
return NULL;
}
#ifdef USE_MAX7456 #ifdef USE_MAX7456
static const void *cmsx_max7456Update(displayPort_t *pDisp, const void *self)
{
UNUSED(self);
displayPortProfileMax7456Mutable()->invert = displayPortProfileMax7456_invert; displayPortProfileMax7456Mutable()->invert = displayPortProfileMax7456_invert;
displayPortProfileMax7456Mutable()->blackBrightness = displayPortProfileMax7456_blackBrightness; displayPortProfileMax7456Mutable()->blackBrightness = displayPortProfileMax7456_blackBrightness;
displayPortProfileMax7456Mutable()->whiteBrightness = displayPortProfileMax7456_whiteBrightness; displayPortProfileMax7456Mutable()->whiteBrightness = displayPortProfileMax7456_whiteBrightness;
#endif
displayClearScreen(pDisp);
return NULL; return NULL;
} }
#endif // USE_MAX7456
const OSD_Entry cmsx_menuOsdEntries[] = const OSD_Entry cmsx_menuOsdEntries[] =
{ {
@ -335,9 +344,9 @@ const OSD_Entry cmsx_menuOsdEntries[] =
{"ALARMS", OME_Submenu, cmsMenuChange, &menuAlarms, 0}, {"ALARMS", OME_Submenu, cmsMenuChange, &menuAlarms, 0},
#endif #endif
#ifdef USE_MAX7456 #ifdef USE_MAX7456
{"INVERT", OME_Bool, NULL, &displayPortProfileMax7456_invert, 0}, {"INVERT", OME_Bool, cmsx_max7456Update, &displayPortProfileMax7456_invert, 0},
{"BRT BLACK", OME_UINT8, NULL, &(OSD_UINT8_t){&displayPortProfileMax7456_blackBrightness, 0, 3, 1}, 0}, {"BRT BLACK", OME_UINT8, cmsx_max7456Update, &(OSD_UINT8_t){&displayPortProfileMax7456_blackBrightness, 0, 3, 1}, 0},
{"BRT WHITE", OME_UINT8, NULL, &(OSD_UINT8_t){&displayPortProfileMax7456_whiteBrightness, 0, 3, 1}, 0}, {"BRT WHITE", OME_UINT8, cmsx_max7456Update, &(OSD_UINT8_t){&displayPortProfileMax7456_whiteBrightness, 0, 3, 1}, 0},
#endif #endif
{"BACK", OME_Back, NULL, NULL, 0}, {"BACK", OME_Back, NULL, NULL, 0},
{NULL, OME_END, NULL, NULL, 0} {NULL, OME_END, NULL, NULL, 0}