forked from iNavFlight/inav
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cms_menu_builtin.c
171 lines (141 loc) · 4.22 KB
/
cms_menu_builtin.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
/*
* This file is part of Cleanflight.
*
* Cleanflight is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Cleanflight is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Cleanflight. If not, see <http://www.gnu.org/licenses/>.
*/
//
// Built-in menu contents and support functions
//
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include <ctype.h>
#include "platform.h"
#ifdef USE_CMS
#include "build/version.h"
#include "drivers/time.h"
#include "cms/cms.h"
#include "cms/cms_types.h"
#include "cms/cms_menu_builtin.h"
// Sub menus
#include "cms/cms_menu_imu.h"
#include "cms/cms_menu_blackbox.h"
#include "cms/cms_menu_navigation.h"
#include "cms/cms_menu_vtx.h"
#include "cms/cms_menu_osd.h"
#include "cms/cms_menu_ledstrip.h"
#include "cms/cms_menu_misc.h"
// VTX supplied menus
#include "cms/cms_menu_vtx_smartaudio.h"
#include "cms/cms_menu_vtx_tramp.h"
// Info
static char infoGitRev[GIT_SHORT_REVISION_LENGTH + 1];
static char infoTargetName[] = __TARGET__;
#include "msp/msp_protocol.h" // XXX for FC identification... not available elsewhere
static long cmsx_InfoInit(void)
{
int i;
for ( i = 0 ; i < GIT_SHORT_REVISION_LENGTH ; i++) {
if (shortGitRevision[i] >= 'a' && shortGitRevision[i] <= 'f')
infoGitRev[i] = shortGitRevision[i] - 'a' + 'A';
else
infoGitRev[i] = shortGitRevision[i];
}
infoGitRev[i] = 0x0; // Terminate string
return 0;
}
static const OSD_Entry menuInfoEntries[] = {
OSD_LABEL_ENTRY("--- INFO ---"),
OSD_STRING_ENTRY("FWID", INAV_IDENTIFIER),
OSD_STRING_ENTRY("FWVER", FC_VERSION_STRING),
OSD_STRING_ENTRY("GITREV", infoGitRev),
OSD_STRING_ENTRY("TARGET", infoTargetName),
OSD_BACK_ENTRY,
OSD_END_ENTRY,
};
static const CMS_Menu menuInfo = {
#ifdef CMS_MENU_DEBUG
.GUARD_text = "MENUINFO",
.GUARD_type = OME_MENU,
#endif
.onEnter = cmsx_InfoInit,
.onExit = NULL,
.onGlobalExit = NULL,
.entries = menuInfoEntries
};
// Features
static const OSD_Entry menuFeaturesEntries[] =
{
OSD_LABEL_ENTRY("--- FEATURES ---"),
OSD_SUBMENU_ENTRY("BLACKBOX", &cmsx_menuBlackbox),
#if defined(USE_NAV)
OSD_SUBMENU_ENTRY("NAVIGATION", &cmsx_menuNavigation),
#endif
#if defined(VTX) || defined(USE_RTC6705)
OSD_SUBMENU_ENTRY("VTX", &cmsx_menuVtx),
#endif // VTX || USE_RTC6705
#if defined(VTX_CONTROL)
#if defined(VTX_SMARTAUDIO)
OSD_SUBMENU_ENTRY("VTX SA", &cmsx_menuVtxSmartAudio),
#endif
#if defined(VTX_TRAMP)
OSD_SUBMENU_ENTRY("VTX TR", &cmsx_menuVtxTramp),
#endif
#endif // VTX_CONTROL
#ifdef USE_LED_STRIP
OSD_SUBMENU_ENTRY("LED STRIP", &cmsx_menuLedstrip),
#endif // LED_STRIP
OSD_BACK_ENTRY,
OSD_END_ENTRY,
};
static const CMS_Menu menuFeatures = {
#ifdef CMS_MENU_DEBUG
.GUARD_text = "MENUFEATURES",
.GUARD_type = OME_MENU,
#endif
.onEnter = NULL,
.onExit = NULL,
.onGlobalExit = NULL,
.entries = menuFeaturesEntries,
};
// Main
static const OSD_Entry menuMainEntries[] =
{
OSD_LABEL_ENTRY("-- MAIN --"),
OSD_SUBMENU_ENTRY("PID TUNING", &cmsx_menuImu),
OSD_SUBMENU_ENTRY("FEATURES", &menuFeatures),
#ifdef USE_OSD
OSD_SUBMENU_ENTRY("SCR LAYOUT", &cmsx_menuOsdLayout),
OSD_SUBMENU_ENTRY("ALARMS", &cmsx_menuAlarms),
#endif
OSD_SUBMENU_ENTRY("FC&FW INFO", &menuInfo),
OSD_SUBMENU_ENTRY("MISC", &cmsx_menuMisc),
{"SAVE&REBOOT", OME_OSD_Exit, cmsMenuExit, (void*)CMS_EXIT_SAVEREBOOT, 0},
{"EXIT", OME_OSD_Exit, cmsMenuExit, (void*)CMS_EXIT, 0},
#ifdef CMS_MENU_DEBUG
OSD_SUBMENU_ENTRY("ERR SAMPLE", &menuInfoEntries[0]),
#endif
OSD_END_ENTRY,
};
const CMS_Menu menuMain = {
#ifdef CMS_MENU_DEBUG
.GUARD_text = "MENUMAIN",
.GUARD_type = OME_MENU,
#endif
.onEnter = NULL,
.onExit = NULL,
.onGlobalExit = NULL,
.entries = menuMainEntries,
};
#endif