[SITL] Enable telemetry: LTM and MAVLink (#8940)
[inav.git] / src / main / cms / cms_menu_osd.c
blobd482635db2f56aed4a2655880e2a5571070e1b53
1 /*
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/>.
18 #include <stdbool.h>
19 #include <stdint.h>
20 #include <string.h>
22 #include "platform.h"
24 #if defined(USE_OSD) && defined(USE_CMS) && defined(CMS_MENU_OSD)
26 #include "build/debug.h"
28 #include "common/utils.h"
30 #include "cms/cms.h"
31 #include "cms/cms_types.h"
32 #include "cms/cms_menu_osd.h"
34 #include "fc/settings.h"
36 #include "io/osd.h"
38 #define OSD_ITEM_ENTRY(label, item_id) ((OSD_Entry){ label, {.itemId = item_id}, &cmsx_menuOsdElementActions, OME_Submenu, 0 })
40 static int osdCurrentLayout = -1;
41 static int osdCurrentItem = -1;
43 static uint8_t osdCurrentElementRow = 0;
44 static uint8_t osdCurrentElementColumn = 0;
45 static uint8_t osdCurrentElementVisible = 0;
47 static long osdElementsOnEnter(const OSD_Entry *from);
48 static long osdElementsOnExit(const OSD_Entry *from);
49 static long osdElemActionsOnEnter(const OSD_Entry *from);
51 static const OSD_Entry cmsx_menuAlarmsEntries[] = {
52 OSD_LABEL_ENTRY("--- ALARMS ---"),
54 OSD_SETTING_ENTRY("RSSI", SETTING_OSD_RSSI_ALARM),
55 OSD_SETTING_ENTRY("FLY TIME", SETTING_OSD_TIME_ALARM),
56 OSD_SETTING_ENTRY("MAX ALT", SETTING_OSD_ALT_ALARM),
57 OSD_SETTING_ENTRY("MAX DIST", SETTING_OSD_DIST_ALARM),
58 OSD_SETTING_ENTRY("MAX NEG ALT", SETTING_OSD_NEG_ALT_ALARM),
60 OSD_BACK_AND_END_ENTRY,
63 static const CMS_Menu cmsx_menuAlarms = {
64 #ifdef CMS_MENU_DEBUG
65 .GUARD_text = "MENUOSDA",
66 .GUARD_type = OME_MENU,
67 #endif
68 .onEnter = NULL,
69 .onExit = NULL,
70 .onGlobalExit = NULL,
71 .entries = cmsx_menuAlarmsEntries,
74 static long cmsx_osdElementOnChange(displayPort_t *displayPort, const void *ptr)
76 UNUSED(ptr);
78 uint16_t *pos = &osdLayoutsConfigMutable()->item_pos[osdCurrentLayout][osdCurrentItem];
79 *pos = OSD_POS(osdCurrentElementColumn, osdCurrentElementRow);
80 if (osdCurrentElementVisible) {
81 *pos |= OSD_VISIBLE_FLAG;
83 cmsYieldDisplay(displayPort, 500);
84 return 0;
87 static long osdElementPreview(displayPort_t *displayPort, const void *ptr)
89 UNUSED(ptr);
91 cmsYieldDisplay(displayPort, 2000);
93 return 0;
96 static const OSD_Entry menuOsdElemActionsEntries[] = {
98 OSD_BOOL_CALLBACK_ENTRY("ENABLED", cmsx_osdElementOnChange, &osdCurrentElementVisible),
99 OSD_UINT8_CALLBACK_ENTRY("ROW", cmsx_osdElementOnChange, (&(const OSD_UINT8_t){ &osdCurrentElementRow, 0, OSD_X(OSD_POS_MAX), 1 })),
100 OSD_UINT8_CALLBACK_ENTRY("COLUMN", cmsx_osdElementOnChange, (&(const OSD_UINT8_t){ &osdCurrentElementColumn, 0, OSD_Y(OSD_POS_MAX), 1 })),
101 OSD_FUNC_CALL_ENTRY("PREVIEW", osdElementPreview),
103 OSD_BACK_AND_END_ENTRY,
106 static const OSD_Entry menuOsdFixedElemActionsEntries[] = {
108 OSD_BOOL_CALLBACK_ENTRY("ENABLED", cmsx_osdElementOnChange, &osdCurrentElementVisible),
109 OSD_FUNC_CALL_ENTRY("PREVIEW", osdElementPreview),
111 OSD_BACK_AND_END_ENTRY,
114 static CMS_Menu cmsx_menuOsdElementActions = {
115 #ifdef CMS_MENU_DEBUG
116 .GUARD_text = "MENUOSDELEM",
117 .GUARD_type = OME_MENU,
118 #endif
119 .onEnter = osdElemActionsOnEnter,
120 .onExit = NULL,
121 .onGlobalExit = NULL,
122 .entries = menuOsdElemActionsEntries,
125 static long osdElemActionsOnEnter(const OSD_Entry *from)
127 osdCurrentItem = from->itemId;
128 uint16_t pos = osdLayoutsConfig()->item_pos[osdCurrentLayout][osdCurrentItem];
129 osdCurrentElementColumn = OSD_X(pos);
130 osdCurrentElementRow = OSD_Y(pos);
131 osdCurrentElementVisible = OSD_VISIBLE(pos) ? 1 : 0;
132 if (osdItemIsFixed(osdCurrentItem)) {
133 cmsx_menuOsdElementActions.entries = menuOsdFixedElemActionsEntries;
134 } else {
135 cmsx_menuOsdElementActions.entries = menuOsdElemActionsEntries;
137 return 0;
140 #define OSD_ELEMENT_ENTRY(name, osd_item_id) OSD_ITEM_ENTRY(name, osd_item_id)
142 static const OSD_Entry menuCrsfRxEntries[]=
144 OSD_LABEL_ENTRY("-- CRSF RX --"),
146 OSD_SETTING_ENTRY("LQ FORMAT", SETTING_OSD_CRSF_LQ_FORMAT),
147 OSD_SETTING_ENTRY("LQ ALARM LEVEL", SETTING_OSD_LINK_QUALITY_ALARM),
148 OSD_SETTING_ENTRY("SNR ALARM LEVEL", SETTING_OSD_SNR_ALARM),
149 OSD_SETTING_ENTRY("RX SENSITIVITY", SETTING_OSD_RSSI_DBM_MIN),
150 OSD_ELEMENT_ENTRY("RX RSSI DBM", OSD_CRSF_RSSI_DBM),
151 OSD_ELEMENT_ENTRY("RX LQ", OSD_CRSF_LQ),
152 OSD_ELEMENT_ENTRY("RX SNR ALARM", OSD_CRSF_SNR_DB),
153 OSD_ELEMENT_ENTRY("TX POWER", OSD_CRSF_TX_POWER),
155 OSD_BACK_AND_END_ENTRY,
158 const CMS_Menu cmsx_menuCrsf = {
159 #ifdef CMS_MENU_DEBUG
160 .GUARD_text = "MENUCRF",
161 .GUARD_type = OME_MENU,
162 #endif
163 .onEnter = NULL,
164 .onExit = NULL,
165 .onGlobalExit = NULL,
166 .entries = menuCrsfRxEntries,
169 static const OSD_Entry menuOsdElemsEntries[] =
171 OSD_LABEL_ENTRY("--- OSD ITEMS ---"),
173 OSD_ELEMENT_ENTRY("RSSI", OSD_RSSI_VALUE),
174 #ifdef USE_SERIALRX_CRSF
175 OSD_SUBMENU_ENTRY("CRSF RX", &cmsx_menuCrsf),
176 #endif // CRSF Menu
177 OSD_ELEMENT_ENTRY("MAIN BATTERY", OSD_MAIN_BATT_VOLTAGE),
178 OSD_ELEMENT_ENTRY("MAIN BATT SC", OSD_SAG_COMPENSATED_MAIN_BATT_VOLTAGE),
179 OSD_ELEMENT_ENTRY("CELL VOLTAGE", OSD_MAIN_BATT_CELL_VOLTAGE),
180 OSD_ELEMENT_ENTRY("CELL VOLT. SC", OSD_MAIN_BATT_SAG_COMPENSATED_CELL_VOLTAGE),
181 OSD_ELEMENT_ENTRY("BAT IMPEDANCE", OSD_POWER_SUPPLY_IMPEDANCE),
182 OSD_ELEMENT_ENTRY("CROSSHAIRS", OSD_CROSSHAIRS),
183 OSD_ELEMENT_ENTRY("HORIZON", OSD_ARTIFICIAL_HORIZON),
184 OSD_ELEMENT_ENTRY("HORIZON SIDEBARS", OSD_HORIZON_SIDEBARS),
185 OSD_ELEMENT_ENTRY("ON TIME", OSD_ONTIME),
186 OSD_ELEMENT_ENTRY("FLY TIME", OSD_FLYTIME),
187 OSD_ELEMENT_ENTRY("ON/FLY TIME", OSD_ONTIME_FLYTIME),
188 OSD_ELEMENT_ENTRY("REM. TIME", OSD_REMAINING_FLIGHT_TIME_BEFORE_RTH),
189 OSD_ELEMENT_ENTRY("REM. DIST", OSD_REMAINING_DISTANCE_BEFORE_RTH),
190 OSD_ELEMENT_ENTRY("TIME (HOUR)", OSD_RTC_TIME),
191 OSD_ELEMENT_ENTRY("FLY MODE", OSD_FLYMODE),
192 OSD_ELEMENT_ENTRY("NAME", OSD_CRAFT_NAME),
193 OSD_ELEMENT_ENTRY("THR. (MANU)", OSD_THROTTLE_POS),
194 OSD_ELEMENT_ENTRY("THR. (MANU/AUTO)", OSD_THROTTLE_POS_AUTO_THR),
195 OSD_ELEMENT_ENTRY("SYS MESSAGES", OSD_MESSAGES),
196 OSD_ELEMENT_ENTRY("VTX CHAN", OSD_VTX_CHANNEL),
197 OSD_ELEMENT_ENTRY("CURRENT (A)", OSD_CURRENT_DRAW),
198 OSD_ELEMENT_ENTRY("POWER", OSD_POWER),
199 OSD_ELEMENT_ENTRY("USED MAH", OSD_MAH_DRAWN),
200 OSD_ELEMENT_ENTRY("USED WH", OSD_WH_DRAWN),
201 OSD_ELEMENT_ENTRY("EFF/KM (AH)", OSD_EFFICIENCY_MAH_PER_KM),
202 OSD_ELEMENT_ENTRY("EFF/KM (WH)", OSD_EFFICIENCY_WH_PER_KM),
203 OSD_ELEMENT_ENTRY("BATT CAP REM", OSD_BATTERY_REMAINING_CAPACITY),
204 OSD_ELEMENT_ENTRY("BATT % REM", OSD_BATTERY_REMAINING_PERCENT),
205 #ifdef USE_GPS
206 OSD_ELEMENT_ENTRY("HOME DIR", OSD_HOME_DIR),
207 OSD_ELEMENT_ENTRY("HOME HEAD. ERR", OSD_HOME_HEADING_ERROR),
208 OSD_ELEMENT_ENTRY("HOME DIST", OSD_HOME_DIST),
209 OSD_ELEMENT_ENTRY("TRIP DIST", OSD_TRIP_DIST),
210 OSD_ELEMENT_ENTRY("GPS SPEED", OSD_GPS_SPEED),
211 OSD_ELEMENT_ENTRY("GPS SATS", OSD_GPS_SATS),
212 OSD_ELEMENT_ENTRY("GPS LAT", OSD_GPS_LAT),
213 OSD_ELEMENT_ENTRY("GPS LON", OSD_GPS_LON),
214 OSD_ELEMENT_ENTRY("GPS HDOP", OSD_GPS_HDOP),
215 OSD_ELEMENT_ENTRY("3D SPEED", OSD_3D_SPEED),
216 OSD_ELEMENT_ENTRY("PLUS CODE", OSD_PLUS_CODE),
217 OSD_ELEMENT_ENTRY("AZIMUTH", OSD_AZIMUTH),
218 OSD_ELEMENT_ENTRY("GRD COURSE", OSD_GROUND_COURSE),
219 OSD_ELEMENT_ENTRY("X TRACK ERR", OSD_CROSS_TRACK_ERROR),
220 #endif // GPS
221 OSD_ELEMENT_ENTRY("HEADING", OSD_HEADING),
222 OSD_ELEMENT_ENTRY("HEADING GR.", OSD_HEADING_GRAPH),
223 OSD_ELEMENT_ENTRY("CRS HLD ERR", OSD_COURSE_HOLD_ERROR),
224 OSD_ELEMENT_ENTRY("CRS HLD ADJ", OSD_COURSE_HOLD_ADJUSTMENT),
225 #if defined(USE_BARO) || defined(USE_GPS)
226 OSD_ELEMENT_ENTRY("VARIO", OSD_VARIO),
227 OSD_ELEMENT_ENTRY("VARIO NUM", OSD_VARIO_NUM),
228 #endif // defined
229 OSD_ELEMENT_ENTRY("ALTITUDE", OSD_ALTITUDE),
230 OSD_ELEMENT_ENTRY("ALTITUDE MSL", OSD_ALTITUDE_MSL),
231 #if defined(USE_PITOT)
232 OSD_ELEMENT_ENTRY("AIR SPEED", OSD_AIR_SPEED),
233 #endif
234 #if defined(USE_GPS)
235 OSD_ELEMENT_ENTRY("MAP NORTH", OSD_MAP_NORTH),
236 OSD_ELEMENT_ENTRY("MAP TAKE OFF", OSD_MAP_TAKEOFF),
237 OSD_ELEMENT_ENTRY("RADAR", OSD_RADAR),
238 OSD_ELEMENT_ENTRY("MAP SCALE", OSD_MAP_SCALE),
239 OSD_ELEMENT_ENTRY("MAP REFERENCE", OSD_MAP_REFERENCE),
240 #endif
241 OSD_ELEMENT_ENTRY("EXPO", OSD_RC_EXPO),
242 OSD_ELEMENT_ENTRY("YAW EXPO", OSD_RC_YAW_EXPO),
243 OSD_ELEMENT_ENTRY("THR EXPO", OSD_THROTTLE_EXPO),
244 OSD_ELEMENT_ENTRY("ROLL RATE", OSD_ROLL_RATE),
245 OSD_ELEMENT_ENTRY("PITCH RATE", OSD_PITCH_RATE),
246 OSD_ELEMENT_ENTRY("YAW RATE", OSD_YAW_RATE),
247 OSD_ELEMENT_ENTRY("M EXPO", OSD_MANUAL_RC_EXPO),
248 OSD_ELEMENT_ENTRY("M YAW EXPO", OSD_MANUAL_RC_YAW_EXPO),
249 OSD_ELEMENT_ENTRY("M ROLL RATE", OSD_MANUAL_ROLL_RATE),
250 OSD_ELEMENT_ENTRY("M PITCH RATE", OSD_MANUAL_PITCH_RATE),
251 OSD_ELEMENT_ENTRY("M YAW RATE", OSD_MANUAL_YAW_RATE),
252 OSD_ELEMENT_ENTRY("CRUISE THR", OSD_NAV_FW_CRUISE_THR),
253 OSD_ELEMENT_ENTRY("PITCH TO THR", OSD_NAV_FW_PITCH2THR),
254 OSD_ELEMENT_ENTRY("ROLL PIDS", OSD_ROLL_PIDS),
255 OSD_ELEMENT_ENTRY("PITCH PIDS", OSD_PITCH_PIDS),
256 OSD_ELEMENT_ENTRY("YAW PIDS", OSD_YAW_PIDS),
257 OSD_ELEMENT_ENTRY("LEVEL PIDS", OSD_LEVEL_PIDS),
258 OSD_ELEMENT_ENTRY("POSXY PIDS", OSD_POS_XY_PIDS),
259 OSD_ELEMENT_ENTRY("POSZ PIDS", OSD_POS_Z_PIDS),
260 OSD_ELEMENT_ENTRY("VELXY PIDS", OSD_VEL_XY_PIDS),
261 OSD_ELEMENT_ENTRY("VELZ PIDS", OSD_VEL_Z_PIDS),
262 OSD_ELEMENT_ENTRY("HEAD P", OSD_HEADING_P),
263 OSD_ELEMENT_ENTRY("ALIGN ROLL", OSD_BOARD_ALIGN_ROLL),
264 OSD_ELEMENT_ENTRY("ALIGN PITCH", OSD_BOARD_ALIGN_PITCH),
265 OSD_ELEMENT_ENTRY("0THR PITCH", OSD_FW_MIN_THROTTLE_DOWN_PITCH_ANGLE),
267 OSD_ELEMENT_ENTRY("FW ALT PID OUT", OSD_FW_ALT_PID_OUTPUTS),
268 OSD_ELEMENT_ENTRY("FW POS PID OUT", OSD_FW_POS_PID_OUTPUTS),
269 OSD_ELEMENT_ENTRY("MC VELX PID OUT", OSD_MC_VEL_X_PID_OUTPUTS),
270 OSD_ELEMENT_ENTRY("MC VELY PID OUT", OSD_MC_VEL_Y_PID_OUTPUTS),
271 OSD_ELEMENT_ENTRY("MC VELZ PID OUT", OSD_MC_VEL_Z_PID_OUTPUTS),
272 OSD_ELEMENT_ENTRY("MC POS PID OUT", OSD_MC_POS_XYZ_P_OUTPUTS),
274 OSD_ELEMENT_ENTRY("ATTI PITCH", OSD_ATTITUDE_PITCH),
275 OSD_ELEMENT_ENTRY("ATTI ROLL", OSD_ATTITUDE_ROLL),
277 OSD_ELEMENT_ENTRY("WIND HOR", OSD_WIND_SPEED_HORIZONTAL),
278 OSD_ELEMENT_ENTRY("WIND VERT", OSD_WIND_SPEED_VERTICAL),
280 OSD_ELEMENT_ENTRY("G-FORCE", OSD_GFORCE),
281 OSD_ELEMENT_ENTRY("G-FORCE X", OSD_GFORCE_X),
282 OSD_ELEMENT_ENTRY("G-FORCE Y", OSD_GFORCE_Y),
283 OSD_ELEMENT_ENTRY("G-FORCE Z", OSD_GFORCE_Z),
285 OSD_ELEMENT_ENTRY("VTX POWER", OSD_VTX_POWER),
287 #if defined(USE_RX_MSP) && defined(USE_MSP_RC_OVERRIDE)
288 OSD_ELEMENT_ENTRY("RC SOURCE", OSD_RC_SOURCE),
289 #endif
291 OSD_ELEMENT_ENTRY("IMU TEMP", OSD_IMU_TEMPERATURE),
292 #ifdef USE_BARO
293 OSD_ELEMENT_ENTRY("BARO TEMP", OSD_BARO_TEMPERATURE),
294 #endif
296 #ifdef USE_TEMPERATURE_SENSOR
297 OSD_ELEMENT_ENTRY("SENSOR 0 TEMP", OSD_TEMP_SENSOR_0_TEMPERATURE),
298 OSD_ELEMENT_ENTRY("SENSOR 1 TEMP", OSD_TEMP_SENSOR_1_TEMPERATURE),
299 OSD_ELEMENT_ENTRY("SENSOR 2 TEMP", OSD_TEMP_SENSOR_2_TEMPERATURE),
300 OSD_ELEMENT_ENTRY("SENSOR 3 TEMP", OSD_TEMP_SENSOR_3_TEMPERATURE),
301 OSD_ELEMENT_ENTRY("SENSOR 4 TEMP", OSD_TEMP_SENSOR_4_TEMPERATURE),
302 OSD_ELEMENT_ENTRY("SENSOR 5 TEMP", OSD_TEMP_SENSOR_5_TEMPERATURE),
303 OSD_ELEMENT_ENTRY("SENSOR 6 TEMP", OSD_TEMP_SENSOR_6_TEMPERATURE),
304 OSD_ELEMENT_ENTRY("SENSOR 7 TEMP", OSD_TEMP_SENSOR_7_TEMPERATURE),
305 #endif
307 OSD_ELEMENT_ENTRY("GVAR 0", OSD_GVAR_0),
308 OSD_ELEMENT_ENTRY("GVAR 1", OSD_GVAR_1),
309 OSD_ELEMENT_ENTRY("GVAR 2", OSD_GVAR_2),
310 OSD_ELEMENT_ENTRY("GVAR 3", OSD_GVAR_3),
312 OSD_ELEMENT_ENTRY("TPA", OSD_TPA),
313 OSD_ELEMENT_ENTRY("FW CTRL SMOOTH", OSD_NAV_FW_CONTROL_SMOOTHNESS),
314 OSD_ELEMENT_ENTRY("VERSION", OSD_VERSION),
315 OSD_ELEMENT_ENTRY("RANGEFINDER", OSD_RANGEFINDER),
317 #ifdef USE_ESC_SENSOR
318 OSD_ELEMENT_ENTRY("ESC RPM", OSD_ESC_RPM),
319 OSD_ELEMENT_ENTRY("ESC TEMPERATURE", OSD_ESC_TEMPERATURE),
320 #endif
322 #ifdef USE_POWER_LIMITS
323 OSD_ELEMENT_ENTRY("PLIM BURST TIME", OSD_PLIMIT_REMAINING_BURST_TIME),
324 OSD_ELEMENT_ENTRY("PLIM CURR LIMIT", OSD_PLIMIT_ACTIVE_CURRENT_LIMIT),
325 #ifdef USE_ADC
326 OSD_ELEMENT_ENTRY("PLIM POWER LIMIT", OSD_PLIMIT_ACTIVE_POWER_LIMIT),
327 #endif // USE_ADC
328 #endif // USE_POWER_LIMITS
330 OSD_BACK_AND_END_ENTRY,
333 #if defined(USE_GPS) && defined(USE_BARO) && defined(USE_PITOT) && defined(USE_TEMPERATURE_SENSOR) && defined(USE_RX_MSP) && defined(USE_MSP_RC_OVERRIDE)
334 // All CMS OSD elements should be enabled in this case. The menu has 2 extra
335 // elements (label, back+end), but there's an OSD element that we intentionally
336 // don't show here (OSD_DEBUG).
337 _Static_assert(ARRAYLEN(menuOsdElemsEntries) - 2 + 1 == OSD_ITEM_COUNT, "missing OSD elements in CMS");
338 #endif
340 const CMS_Menu menuOsdElements = {
341 #ifdef CMS_MENU_DEBUG
342 .GUARD_text = "MENUOSDE",
343 .GUARD_type = OME_MENU,
344 #endif
345 .onEnter = osdElementsOnEnter,
346 .onExit = osdElementsOnExit,
347 .onGlobalExit = NULL,
348 .entries = menuOsdElemsEntries,
352 #define OSD_LAYOUT_SUBMENU_ENTRY(label) OSD_SUBMENU_ENTRY(label, &menuOsdElements)
354 static const OSD_Entry cmsx_menuOsdLayoutEntries[] =
356 OSD_LABEL_ENTRY("---SCREEN LAYOUT---"),
358 OSD_LAYOUT_SUBMENU_ENTRY("DEFAULT"),
359 #if OSD_ALTERNATE_LAYOUT_COUNT > 0
360 OSD_LAYOUT_SUBMENU_ENTRY("ALTERNATE 1"),
361 #if OSD_ALTERNATE_LAYOUT_COUNT > 1
362 OSD_LAYOUT_SUBMENU_ENTRY("ALTERNATE 2"),
363 #if OSD_ALTERNATE_LAYOUT_COUNT > 2
364 OSD_LAYOUT_SUBMENU_ENTRY("ALTERNATE 3"),
365 #endif
366 #endif
367 #endif
369 OSD_BACK_AND_END_ENTRY,
372 const CMS_Menu cmsx_menuOsdLayout = {
373 #ifdef CMS_MENU_DEBUG
374 .GUARD_text = "MENUOSDL",
375 .GUARD_type = OME_MENU,
376 #endif
377 .onEnter = NULL,
378 .onExit = NULL,
379 .onGlobalExit = NULL,
380 .entries = cmsx_menuOsdLayoutEntries,
383 static long osdElementsOnEnter(const OSD_Entry *from)
385 // First entry is the label. Store the current layout
386 // and override it on the OSD so previews so this layout.
387 osdCurrentLayout = from - cmsx_menuOsdLayoutEntries - 1;
388 osdOverrideLayout(osdCurrentLayout, 0);
389 return 0;
392 static long osdElementsOnExit(const OSD_Entry *from)
394 UNUSED(from);
396 // Stop overriding OSD layout
397 osdOverrideLayout(-1, 0);
398 return 0;
401 static const OSD_Entry menuOsdSettingsEntries[] = {
402 OSD_LABEL_ENTRY("--- OSD SETTINGS ---"),
404 OSD_SETTING_ENTRY("VOLT. DECIMALS", SETTING_OSD_MAIN_VOLTAGE_DECIMALS),
405 OSD_SETTING_ENTRY("COORD. DIGITS", SETTING_OSD_COORDINATE_DIGITS),
406 OSD_SETTING_ENTRY("LEFT SCROLL", SETTING_OSD_LEFT_SIDEBAR_SCROLL),
407 OSD_SETTING_ENTRY("RIGHT SCROLL", SETTING_OSD_RIGHT_SIDEBAR_SCROLL),
408 OSD_SETTING_ENTRY("SCROLL ARROWS", SETTING_OSD_SIDEBAR_SCROLL_ARROWS),
410 OSD_BACK_AND_END_ENTRY,
413 static const CMS_Menu cmsx_menuOsdSettings = {
414 #ifdef CMS_MENU_DEBUG
415 .GUARD_text = "MENUOSDS",
416 .GUARD_type = OME_MENU,
417 #endif
418 .onEnter = NULL,
419 .onExit = NULL,
420 .onGlobalExit = NULL,
421 .entries = menuOsdSettingsEntries,
424 static const OSD_Entry menuOsdHud2Entries[] = {
425 OSD_LABEL_ENTRY("--- HUD ITEMS ---"),
427 OSD_SETTING_ENTRY("HOMING ARROWS", SETTING_OSD_HUD_HOMING),
428 OSD_SETTING_ENTRY("HOME POINT", SETTING_OSD_HUD_HOMEPOINT),
429 OSD_SETTING_ENTRY("RADAR MAX AIRCRAFT", SETTING_OSD_HUD_RADAR_DISP),
430 OSD_SETTING_ENTRY("RADAR MIN RANGE", SETTING_OSD_HUD_RADAR_RANGE_MIN),
431 OSD_SETTING_ENTRY("RADAR MAX RANGE", SETTING_OSD_HUD_RADAR_RANGE_MAX),
432 OSD_SETTING_ENTRY("NEXT WAYPOINTS", SETTING_OSD_HUD_WP_DISP),
433 OSD_BACK_ENTRY,
434 OSD_END_ENTRY,
437 static const CMS_Menu cmsx_menuOsdHud2 = {
438 #ifdef CMS_MENU_DEBUG
439 .GUARD_text = "MENUOSDH2",
440 .GUARD_type = OME_MENU,
441 #endif
442 .onEnter = NULL,
443 .onExit = NULL,
444 .onGlobalExit = NULL,
445 .entries = menuOsdHud2Entries,
448 static const OSD_Entry menuOsdHudEntries[] = {
449 OSD_LABEL_ENTRY("--- HUD ---"),
451 OSD_SETTING_ENTRY("CROSSHAIRS STYLE", SETTING_OSD_CROSSHAIRS_STYLE),
452 OSD_SETTING_ENTRY("HORIZON OFFSET", SETTING_OSD_HORIZON_OFFSET),
453 OSD_SETTING_ENTRY("CAMERA UPTILT", SETTING_OSD_CAMERA_UPTILT),
454 OSD_SETTING_ENTRY("CAMERA FOV HORI", SETTING_OSD_CAMERA_FOV_H),
455 OSD_SETTING_ENTRY("CAMERA FOV VERT", SETTING_OSD_CAMERA_FOV_V),
456 OSD_SETTING_ENTRY("HUD MARGIN HORI", SETTING_OSD_HUD_MARGIN_H),
457 OSD_SETTING_ENTRY("HUD MARGIN VERT", SETTING_OSD_HUD_MARGIN_V),
458 OSD_SUBMENU_ENTRY("DISPLAYED ITEMS", &cmsx_menuOsdHud2),
460 OSD_BACK_ENTRY,
461 OSD_END_ENTRY,
464 static const CMS_Menu cmsx_menuOsdHud = {
465 #ifdef CMS_MENU_DEBUG
466 .GUARD_text = "MENUOSDH",
467 .GUARD_type = OME_MENU,
468 #endif
469 .onEnter = NULL,
470 .onExit = NULL,
471 .onGlobalExit = NULL,
472 .entries = menuOsdHudEntries,
475 static const OSD_Entry menuOsdEntries[] = {
476 OSD_LABEL_ENTRY("--- OSD ---"),
478 OSD_SUBMENU_ENTRY("LAYOUTS", &cmsx_menuOsdLayout),
479 OSD_SUBMENU_ENTRY("SETTINGS", &cmsx_menuOsdSettings),
480 OSD_SUBMENU_ENTRY("ALARMS", &cmsx_menuAlarms),
481 OSD_SUBMENU_ENTRY("HUD", &cmsx_menuOsdHud),
483 OSD_BACK_AND_END_ENTRY,
487 const CMS_Menu cmsx_menuOsd = {
488 #ifdef CMS_MENU_DEBUG
489 .GUARD_text = "MENUOSD",
490 .GUARD_type = OME_MENU,
491 #endif
492 .onEnter = NULL,
493 .onExit = NULL,
494 .onGlobalExit = NULL,
495 .entries = menuOsdEntries,
498 #endif // CMS