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

Added onChange function call to scalar data types

This will make changed values to take effect immediately in the profile
related menus.

It’s only used for profile selection now; will be used more through out
the menu contents.
This commit is contained in:
jflyper 2016-11-08 18:22:00 +09:00
parent 0f121c69bb
commit c9b7ac21c1
2 changed files with 27 additions and 5 deletions

View file

@ -264,15 +264,25 @@ CMS_Menu menuImuMisc = {
menuImuMiscEntries,
};
static long onProfileChange(displayPort_t *pDisplay, void *ptr)
{
UNUSED(pDisplay);
UNUSED(ptr);
masterConfig.current_profile_index = tmpProfileIndex - 1;
return 0;
}
static OSD_Entry cmsx_menuImuEntries[] =
{
{ "-- IMU --", OME_Label, NULL, NULL, 0},
{"PID PROF", OME_UINT8, NULL, &(OSD_UINT8_t){ &tmpProfileIndex, 1, MAX_PROFILE_COUNT, 1}, 0},
{"PID", OME_Submenu, cmsMenuChange, &cmsx_menuPid, 0},
{"RATE&RXPO", OME_Submenu, cmsMenuChange, &cmsx_menuRateExpo, 0},
{"RC PREV", OME_Submenu, cmsMenuChange, &cmsx_menuRcPreview, 0},
{"MISC", OME_Submenu, cmsMenuChange, &menuImuMisc, 0},
{"PID PROF", OME_UINT8, onProfileChange, &(OSD_UINT8_t){ &tmpProfileIndex, 1, MAX_PROFILE_COUNT, 1}, 0},
{"PID", OME_Submenu, cmsMenuChange, &cmsx_menuPid, 0},
{"RATE&RXPO", OME_Submenu, cmsMenuChange, &cmsx_menuRateExpo, 0},
{"RC PREV", OME_Submenu, cmsMenuChange, &cmsx_menuRcPreview, 0},
{"MISC", OME_Submenu, cmsMenuChange, &menuImuMisc, 0},
{"BACK", OME_Back, NULL, NULL, 0},
{NULL, OME_END, NULL, NULL, 0}