2 * This file is part of Cleanflight and Betaflight.
4 * Cleanflight and Betaflight are free software. You can redistribute
5 * this software and/or modify this software under the terms of the
6 * GNU General Public License as published by the Free Software
7 * Foundation, either version 3 of the License, or (at your option)
10 * Cleanflight and Betaflight are distributed in the hope that they
11 * will be useful, but WITHOUT ANY WARRANTY; without even the implied
12 * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this software.
18 * If not, see <http://www.gnu.org/licenses/>.
23 // XXX Upon separation, all OME would be renamed to CME_ or similar.
45 OME_FLOAT
, //only up to 255 value and cant be 2.55 or 25.5, just for PID's
46 //wlasciwosci elementow
59 typedef const void *(*CMSEntryFuncPtr
)(displayPort_t
*displayPort
, const void *ptr
);
64 // Logical OR of OSD_MenuElement and flags below
68 } __attribute__((packed
)) OSD_Entry
;
71 #define OSD_MENU_ELEMENT_MASK 0x001f
72 #define PRINT_VALUE 0x0020 // Value has been changed, need to redraw
73 #define PRINT_LABEL 0x0040 // Text label should be printed
74 #define DYNAMIC 0x0080 // Value should be updated dynamically
75 #define OPTSTRING 0x0100 // (Temporary) Flag for OME_Submenu, indicating func should be called to get a string to display.
76 #define REBOOT_REQUIRED 0x0200 // Reboot is required if the value is changed
77 #define SCROLLING_TICKER 0x0400 // Long values are displayed as horizontally scrolling tickers (OME_TAB only)
78 #define SLIDER_RP 0x0800 // Value should be read only if simplified RP slider is enabled
79 #define SLIDER_RPY 0x1000 // Value should be read only if simplified RPY slider is enabled
80 #define SLIDER_GYRO 0x2000 // Value should be read only if simplified gyro slider is enabled
81 #define SLIDER_DTERM 0x4000 // Value should be read only if simplified D term slider is enabled
83 #define IS_PRINTVALUE(x) ((x) & PRINT_VALUE)
84 #define SET_PRINTVALUE(x) do { (x) |= PRINT_VALUE; } while (0)
85 #define CLR_PRINTVALUE(x) do { (x) &= ~PRINT_VALUE; } while (0)
87 #define IS_PRINTLABEL(x) ((x) & PRINT_LABEL)
88 #define SET_PRINTLABEL(x) do { (x) |= PRINT_LABEL; } while (0)
89 #define CLR_PRINTLABEL(x) do { (x) &= ~PRINT_LABEL; } while (0)
91 #define IS_DYNAMIC(p) ((p)->flags & DYNAMIC)
93 #define IS_SCROLLINGTICKER(x) ((x) & SCROLLING_TICKER)
94 #define SET_SCROLLINGTICKER(x) do { (x) |= SCROLLING_TICKER; } while (0)
95 #define CLR_SCROLLINGTICKER(x) do { (x) &= ~SCROLLING_TICKER; } while (0)
97 typedef const void *(*CMSMenuFuncPtr
)(displayPort_t
*pDisp
);
99 // Special return value(s) for function chaining by CMSMenuFuncPtr
100 extern int menuChainBack
;
101 #define MENU_CHAIN_BACK (&menuChainBack) // Causes automatic cmsMenuBack
104 onExit function is called with self:
105 (1) Pointer to an OSD_Entry when cmsMenuBack() was called.
106 Point to an OSD_Entry with type == OME_Back if BACK was selected.
107 (2) NULL if called from menu exit (forced exit at top level).
110 typedef const void *(*CMSMenuOnExitPtr
)(displayPort_t
*pDisp
, const OSD_Entry
*self
);
112 typedef const void *(*CMSMenuOnDisplayUpdatePtr
)(displayPort_t
*pDisp
, const OSD_Entry
*selected
);
116 #ifdef CMS_MENU_DEBUG
117 // These two are debug aids for menu content creators.
118 const char *GUARD_text
;
119 const OSD_MenuElement GUARD_type
;
121 const CMSMenuFuncPtr onEnter
;
122 const CMSMenuOnExitPtr onExit
;
123 const CMSMenuOnDisplayUpdatePtr onDisplayUpdate
;
124 const OSD_Entry
*entries
;
188 const char * const *names
;