2 * This file is part of Cleanflight.
4 * Cleanflight is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * Cleanflight is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
19 // Built-in menu contents and support functions
31 #include "build/version.h"
33 #include "common/utils.h"
35 #include "drivers/time.h"
38 #include "cms/cms_types.h"
39 #include "cms/cms_menu_builtin.h"
43 #include "cms/cms_menu_imu.h"
44 #include "cms/cms_menu_blackbox.h"
45 #include "cms/cms_menu_mixer_servo.h"
46 #include "cms/cms_menu_navigation.h"
47 #include "cms/cms_menu_vtx.h"
48 #include "cms/cms_menu_osd.h"
49 #include "cms/cms_menu_ledstrip.h"
50 #include "cms/cms_menu_battery.h"
51 #include "cms/cms_menu_misc.h"
55 static char infoGitRev
[GIT_SHORT_REVISION_LENGTH
+ 1];
56 static char infoTargetName
[] = __TARGET__
;
58 #include "msp/msp_protocol.h" // XXX for FC identification... not available elsewhere
60 static long cmsx_InfoInit(const OSD_Entry
*from
)
65 for ( i
= 0 ; i
< GIT_SHORT_REVISION_LENGTH
; i
++) {
66 if (shortGitRevision
[i
] >= 'a' && shortGitRevision
[i
] <= 'f')
67 infoGitRev
[i
] = shortGitRevision
[i
] - 'a' + 'A';
69 infoGitRev
[i
] = shortGitRevision
[i
];
72 infoGitRev
[i
] = 0x0; // Terminate string
76 static const OSD_Entry menuInfoEntries
[] = {
77 OSD_LABEL_ENTRY("--- INFO ---"),
78 OSD_STRING_ENTRY("FWID", INAV_IDENTIFIER
),
79 OSD_STRING_ENTRY("FWVER", FC_VERSION_STRING
),
80 OSD_STRING_ENTRY("GITREV", infoGitRev
),
81 OSD_STRING_ENTRY("TARGET", infoTargetName
),
83 OSD_BACK_AND_END_ENTRY
,
86 static const CMS_Menu menuInfo
= {
88 .GUARD_text
= "MENUINFO",
89 .GUARD_type
= OME_MENU
,
91 .onEnter
= cmsx_InfoInit
,
94 .entries
= menuInfoEntries
99 static const OSD_Entry menuFeaturesEntries
[] =
101 OSD_LABEL_ENTRY("--- FEATURES ---"),
102 OSD_SUBMENU_ENTRY("BLACKBOX", &cmsx_menuBlackbox
),
103 OSD_SUBMENU_ENTRY("MIXER & SERVOS", &cmsx_menuMixerServo
),
104 OSD_SUBMENU_ENTRY("NAVIGATION", &cmsx_menuNavigation
),
105 #if defined(USE_VTX_CONTROL)
106 OSD_SUBMENU_ENTRY("VTX", &cmsx_menuVtxControl
),
107 #endif // VTX_CONTROL
109 OSD_SUBMENU_ENTRY("LED STRIP", &cmsx_menuLedstrip
),
112 OSD_BACK_AND_END_ENTRY
,
115 static const CMS_Menu menuFeatures
= {
116 #ifdef CMS_MENU_DEBUG
117 .GUARD_text
= "MENUFEATURES",
118 .GUARD_type
= OME_MENU
,
122 .onGlobalExit
= NULL
,
123 .entries
= menuFeaturesEntries
,
128 static const OSD_Entry menuMainEntries
[] =
130 OSD_LABEL_ENTRY("-- MAIN --"),
132 OSD_SUBMENU_ENTRY("PID TUNING", &cmsx_menuImu
),
133 OSD_SUBMENU_ENTRY("FEATURES", &menuFeatures
),
134 #if defined(USE_OSD) && defined(CMS_MENU_OSD)
135 OSD_SUBMENU_ENTRY("OSD", &cmsx_menuOsd
),
137 OSD_SUBMENU_ENTRY("BATTERY", &cmsx_menuBattery
),
138 OSD_SUBMENU_ENTRY("FC+FW INFO", &menuInfo
),
139 OSD_SUBMENU_ENTRY("MISC", &cmsx_menuMisc
),
141 {"SAVE+REBOOT", {.func
= cmsMenuExit
}, (void*)CMS_EXIT_SAVEREBOOT
, OME_OSD_Exit
, 0},
142 {"EXIT" , {.func
= cmsMenuExit
}, (void*)CMS_EXIT
, OME_OSD_Exit
, 0},
143 #ifdef CMS_MENU_DEBUG
144 OSD_SUBMENU_ENTRY("ERR SAMPLE", &menuInfoEntries
[0]),
150 const CMS_Menu menuMain
= {
151 #ifdef CMS_MENU_DEBUG
152 .GUARD_text
= "MENUMAIN",
153 .GUARD_type
= OME_MENU
,
157 .onGlobalExit
= NULL
,
158 .entries
= menuMainEntries
,