2 * This file is part of INAV.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
6 * You can obtain one at http://mozilla.org/MPL/2.0/.
8 * Alternatively, the contents of this file may be used under the terms
9 * of the GNU General Public License Version 3, as described below:
11 * This file is free software: you may copy, redistribute and/or modify
12 * it under the terms of the GNU General Public License as published by the
13 * Free Software Foundation, either version 3 of the License, or (at your
14 * option) any later version.
16 * This file is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
19 * Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see http://www.gnu.org/licenses/.
24 * @author Alberto Garcia Hierro <alberto@garciahierro.com>
33 #include "cms/cms_types.h"
35 #include "fc/runtime_config.h"
36 #include "fc/settings.h"
38 #include "navigation/navigation.h"
40 static const OSD_Entry cmsx_menuNavSettingsEntries
[] =
42 OSD_LABEL_ENTRY("-- BASIC SETTINGS --"),
44 OSD_SETTING_ENTRY("CONTROL MODE", SETTING_NAV_USER_CONTROL_MODE
),
45 OSD_SETTING_ENTRY("MC NAV SPEED", SETTING_NAV_AUTO_SPEED
),
46 OSD_SETTING_ENTRY("MC MAX NAV SPEED", SETTING_NAV_MAX_AUTO_SPEED
),
47 OSD_SETTING_ENTRY("MAX CRUISE SPEED", SETTING_NAV_MANUAL_SPEED
),
48 OSD_SETTING_ENTRY("MAX NAV CLIMB RATE", SETTING_NAV_MC_AUTO_CLIMB_RATE
),
49 OSD_SETTING_ENTRY("MAX MC AH CLIMB RATE", SETTING_NAV_MC_MANUAL_CLIMB_RATE
),
50 OSD_SETTING_ENTRY("MAX FW AH CLIMB RATE", SETTING_NAV_FW_MANUAL_CLIMB_RATE
),
51 OSD_SETTING_ENTRY("MC MAX BANK ANGLE", SETTING_NAV_MC_BANK_ANGLE
),
52 OSD_SETTING_ENTRY("MC ALTHOLD THROT", SETTING_NAV_MC_ALTHOLD_THROTTLE
),
53 OSD_SETTING_ENTRY("MC HOVER THR", SETTING_NAV_MC_HOVER_THR
),
54 OSD_SETTING_ENTRY("LANDING DISARM", SETTING_NAV_DISARM_ON_LANDING
),
56 OSD_BACK_AND_END_ENTRY
,
59 static const CMS_Menu cmsx_menuNavSettings
= {
61 .GUARD_text
= "MENUNAVSETTINGS",
62 .GUARD_type
= OME_MENU
,
67 .entries
= cmsx_menuNavSettingsEntries
70 static const OSD_Entry cmsx_menuRTHEntries
[] =
72 OSD_LABEL_ENTRY("-- RTH --"),
74 OSD_SETTING_ENTRY("RTH ALT MODE", SETTING_NAV_RTH_ALT_MODE
),
75 OSD_SETTING_ENTRY("RTH ALT", SETTING_NAV_RTH_ALTITUDE
),
76 OSD_SETTING_ENTRY("RTH HOME ALT", SETTING_NAV_RTH_HOME_ALTITUDE
),
77 OSD_SETTING_ENTRY("CLIMB FIRST", SETTING_NAV_RTH_CLIMB_FIRST
),
78 OSD_SETTING_ENTRY("CLIMB 1ST STAGE MODE", SETTING_NAV_RTH_CLIMB_FIRST_STAGE_MODE
),
79 OSD_SETTING_ENTRY("CLIMB 1ST STAGE ALT", SETTING_NAV_RTH_CLIMB_FIRST_STAGE_ALTITUDE
),
80 OSD_SETTING_ENTRY("TAIL FIRST", SETTING_NAV_RTH_TAIL_FIRST
),
81 OSD_SETTING_ENTRY("LAND AFTER RTH", SETTING_NAV_RTH_ALLOW_LANDING
),
82 OSD_SETTING_ENTRY("LAND MINALT VSPD", SETTING_NAV_LAND_MINALT_VSPD
),
83 OSD_SETTING_ENTRY("LAND MAXALT VSPD", SETTING_NAV_LAND_MAXALT_VSPD
),
84 OSD_SETTING_ENTRY("LAND SPEED MIN AT", SETTING_NAV_LAND_SLOWDOWN_MINALT
),
85 OSD_SETTING_ENTRY("LAND SPEED SLOW AT", SETTING_NAV_LAND_SLOWDOWN_MAXALT
),
86 OSD_SETTING_ENTRY("MIN RTH DISTANCE", SETTING_NAV_MIN_RTH_DISTANCE
),
87 OSD_SETTING_ENTRY("RTH ABORT THRES", SETTING_NAV_RTH_ABORT_THRESHOLD
),
88 OSD_SETTING_ENTRY("EMERG LANDING SPEED", SETTING_NAV_EMERG_LANDING_SPEED
),
89 OSD_SETTING_ENTRY("SAFEHOME USAGE MODE", SETTING_SAFEHOME_USAGE_MODE
),
90 OSD_SETTING_ENTRY("RTH TRACKBACK MODE", SETTING_NAV_RTH_TRACKBACK_MODE
),
91 OSD_SETTING_ENTRY("RTH TRACKBACK DIST", SETTING_NAV_RTH_TRACKBACK_DISTANCE
),
93 OSD_BACK_AND_END_ENTRY
,
96 static const CMS_Menu cmsx_menuRTH
= {
98 .GUARD_text
= "MENUNAVRTH",
99 .GUARD_type
= OME_MENU
,
103 .onGlobalExit
= NULL
,
104 .entries
= cmsx_menuRTHEntries
107 static const OSD_Entry cmsx_menuFWCruiseEntries
[] =
109 OSD_LABEL_ENTRY("-- CRUISE --"),
111 OSD_SETTING_ENTRY("CRUISE THROTTLE", SETTING_NAV_FW_CRUISE_THR
),
112 OSD_SETTING_ENTRY("MIN THROTTLE", SETTING_NAV_FW_MIN_THR
),
113 OSD_SETTING_ENTRY("MAX THROTTLE", SETTING_NAV_FW_MAX_THR
),
114 OSD_SETTING_ENTRY("MAX BANK ANGLE", SETTING_NAV_FW_BANK_ANGLE
),
115 OSD_SETTING_ENTRY("MAX CLIMB ANGLE", SETTING_NAV_FW_CLIMB_ANGLE
),
116 OSD_SETTING_ENTRY("MAX DIVE ANGLE", SETTING_NAV_FW_DIVE_ANGLE
),
117 OSD_SETTING_ENTRY("PITCH TO THR RATIO", SETTING_NAV_FW_PITCH2THR
),
118 OSD_SETTING_ENTRY("LOITER RADIUS", SETTING_NAV_FW_LOITER_RADIUS
),
119 OSD_SETTING_ENTRY("CONTROL SMOOTHNESS", SETTING_NAV_FW_CONTROL_SMOOTHNESS
),
120 OSD_SETTING_ENTRY("PITCH TO THR SMOOTHING", SETTING_NAV_FW_PITCH2THR_SMOOTHING
),
121 OSD_SETTING_ENTRY("PITCH TO THR THRESHOLD", SETTING_NAV_FW_PITCH2THR_THRESHOLD
),
122 OSD_SETTING_ENTRY("MANUAL THR INCREASE", SETTING_NAV_FW_ALLOW_MANUAL_THR_INCREASE
),
124 OSD_BACK_AND_END_ENTRY
,
127 static const CMS_Menu cmsx_menuFWCruise
= {
128 #ifdef CMS_MENU_DEBUG
129 .GUARD_text
= "MENUNAVFWCRUISE",
130 .GUARD_type
= OME_MENU
,
134 .onGlobalExit
= NULL
,
135 .entries
= cmsx_menuFWCruiseEntries
138 static const OSD_Entry cmsx_menuFWLaunchEntries
[] =
140 OSD_LABEL_ENTRY("-- AUTOLAUNCH --"),
142 OSD_SETTING_ENTRY("LAUNCH THR", SETTING_NAV_FW_LAUNCH_THR
),
143 OSD_SETTING_ENTRY("IDLE THROTTLE", SETTING_NAV_FW_LAUNCH_IDLE_THR
),
144 OSD_SETTING_ENTRY("MOTOR SPINUP TIME", SETTING_NAV_FW_LAUNCH_SPINUP_TIME
),
145 OSD_SETTING_ENTRY("TIMEOUT", SETTING_NAV_FW_LAUNCH_TIMEOUT
),
146 OSD_SETTING_ENTRY("END TRANSITION TIME", SETTING_NAV_FW_LAUNCH_END_TIME
),
147 OSD_SETTING_ENTRY("MAX ALTITUDE", SETTING_NAV_FW_LAUNCH_MAX_ALTITUDE
),
148 OSD_SETTING_ENTRY("CLIMB ANGLE", SETTING_NAV_FW_LAUNCH_CLIMB_ANGLE
),
149 OSD_SETTING_ENTRY("MAX BANK ANGLE", SETTING_NAV_FW_LAUNCH_MAX_ANGLE
),
150 OSD_SETTING_ENTRY("MOTOR DELAY", SETTING_NAV_FW_LAUNCH_MOTOR_DELAY
),
151 OSD_SETTING_ENTRY("VELOCITY", SETTING_NAV_FW_LAUNCH_VELOCITY
),
152 OSD_SETTING_ENTRY("ACCELERATION", SETTING_NAV_FW_LAUNCH_ACCEL
),
153 OSD_SETTING_ENTRY("DETECT TIME", SETTING_NAV_FW_LAUNCH_DETECT_TIME
),
154 OSD_SETTING_ENTRY("MANUAL THROTTLE", SETTING_NAV_FW_LAUNCH_MANUAL_THROTTLE
),
156 OSD_BACK_AND_END_ENTRY
,
159 static const CMS_Menu cmsx_menuFWLaunch
= {
160 #ifdef CMS_MENU_DEBUG
161 .GUARD_text
= "MENUNAVFWLAUNCH",
162 .GUARD_type
= OME_MENU
,
166 .onGlobalExit
= NULL
,
167 .entries
= cmsx_menuFWLaunchEntries
170 static const OSD_Entry cmsx_menuFWSettingsEntries
[] =
172 OSD_LABEL_ENTRY("-- FIXED WING --"),
174 OSD_SUBMENU_ENTRY("AUTOLAUNCH", &cmsx_menuFWLaunch
),
175 OSD_SUBMENU_ENTRY("CRUISE", &cmsx_menuFWCruise
),
177 OSD_BACK_AND_END_ENTRY
,
180 static const CMS_Menu cmsx_menuFWSettings
= {
181 #ifdef CMS_MENU_DEBUG
182 .GUARD_text
= "MENUNAVFW",
183 .GUARD_type
= OME_MENU
,
187 .onGlobalExit
= NULL
,
188 .entries
= cmsx_menuFWSettingsEntries
191 static const OSD_Entry cmsx_menuMissionSettingsEntries
[] =
193 OSD_LABEL_ENTRY("-- MISSIONS --"),
195 OSD_SETTING_ENTRY("MC WP SLOWDOWN", SETTING_NAV_MC_WP_SLOWDOWN
),
196 OSD_SETTING_ENTRY("WP FAILSAFE DELAY", SETTING_FAILSAFE_MISSION_DELAY
),
197 OSD_SETTING_ENTRY("WP LOAD ON BOOT", SETTING_NAV_WP_LOAD_ON_BOOT
),
198 OSD_SETTING_ENTRY("WP REACHED RADIUS", SETTING_NAV_WP_RADIUS
),
199 OSD_SETTING_ENTRY("WP ENFORCE ALTITUDE", SETTING_NAV_WP_ENFORCE_ALTITUDE
),
200 OSD_SETTING_ENTRY("WP SAFE DISTANCE", SETTING_NAV_WP_MAX_SAFE_DISTANCE
),
201 #ifdef USE_MULTI_MISSION
202 OSD_SETTING_ENTRY("MULTI MISSION NUMBER", SETTING_NAV_WP_MULTI_MISSION_INDEX
),
204 OSD_SETTING_ENTRY("MISSION RESTART", SETTING_NAV_WP_MISSION_RESTART
),
205 OSD_SETTING_ENTRY("WP TURN SMOOTHING", SETTING_NAV_FW_WP_TURN_SMOOTHING
),
206 OSD_SETTING_ENTRY("WP TRACKING ACCURACY", SETTING_NAV_FW_WP_TRACKING_ACCURACY
),
207 OSD_BACK_AND_END_ENTRY
,
210 static const CMS_Menu cmsx_menuMissionSettings
= {
211 #ifdef CMS_MENU_DEBUG
212 .GUARD_text
= "MENUMISSIONSETTINGS",
213 .GUARD_type
= OME_MENU
,
217 .onGlobalExit
= NULL
,
218 .entries
= cmsx_menuMissionSettingsEntries
221 static const OSD_Entry cmsx_menuNavigationEntries
[] =
223 OSD_LABEL_ENTRY("-- NAVIGATION --"),
225 OSD_SUBMENU_ENTRY("BASIC SETTINGS", &cmsx_menuNavSettings
),
226 OSD_SUBMENU_ENTRY("RTH", &cmsx_menuRTH
),
227 OSD_SUBMENU_ENTRY("FIXED WING", &cmsx_menuFWSettings
),
228 OSD_SUBMENU_ENTRY("MISSIONS", &cmsx_menuMissionSettings
),
230 OSD_BACK_AND_END_ENTRY
,
233 const CMS_Menu cmsx_menuNavigation
= {
234 #ifdef CMS_MENU_DEBUG
235 .GUARD_text
= "MENUNAV",
236 .GUARD_type
= OME_MENU
,
240 .onGlobalExit
= NULL
,
241 .entries
= cmsx_menuNavigationEntries