mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-15 20:35:33 +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:
parent
0f121c69bb
commit
c9b7ac21c1
2 changed files with 27 additions and 5 deletions
|
@ -698,6 +698,9 @@ STATIC_UNIT_TESTED uint16_t cmsHandleKey(displayPort_t *pDisplay, uint8_t key)
|
|||
*ptr->val -= ptr->step;
|
||||
}
|
||||
SET_PRINTVALUE(p);
|
||||
if (p->func) {
|
||||
p->func(pDisplay, p);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OME_TAB:
|
||||
|
@ -729,6 +732,9 @@ STATIC_UNIT_TESTED uint16_t cmsHandleKey(displayPort_t *pDisplay, uint8_t key)
|
|||
*ptr->val -= ptr->step;
|
||||
}
|
||||
SET_PRINTVALUE(p);
|
||||
if (p->func) {
|
||||
p->func(pDisplay, p);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OME_UINT16:
|
||||
|
@ -743,6 +749,9 @@ STATIC_UNIT_TESTED uint16_t cmsHandleKey(displayPort_t *pDisplay, uint8_t key)
|
|||
*ptr->val -= ptr->step;
|
||||
}
|
||||
SET_PRINTVALUE(p);
|
||||
if (p->func) {
|
||||
p->func(pDisplay, p);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OME_INT16:
|
||||
|
@ -757,6 +766,9 @@ STATIC_UNIT_TESTED uint16_t cmsHandleKey(displayPort_t *pDisplay, uint8_t key)
|
|||
*ptr->val -= ptr->step;
|
||||
}
|
||||
SET_PRINTVALUE(p);
|
||||
if (p->func) {
|
||||
p->func(pDisplay, p);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case OME_String:
|
||||
|
|
|
@ -264,11 +264,21 @@ 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 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},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue