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/>.
27 #if defined(USE_CMS) && defined(USE_VTX_CONTROL) && (defined(USE_VTX_TRAMP) || defined(USE_VTX_SMARTAUDIO) || defined(USE_VTX_RTC6705) || defined(USE_VTX_MSP))
29 #include "common/printf.h"
32 #include "cms/cms_menu_vtx_rtc6705.h"
33 #include "cms/cms_menu_vtx_smartaudio.h"
34 #include "cms/cms_menu_vtx_tramp.h"
35 #include "cms/cms_menu_vtx_msp.h"
36 #include "cms/cms_types.h"
38 #include "drivers/vtx_common.h"
40 #include "cms_menu_vtx_common.h"
42 #define MAX_STATUS_LINE_LENGTH 21
44 static char statusLine1
[MAX_STATUS_LINE_LENGTH
] = "";
45 static char statusLine2
[MAX_STATUS_LINE_LENGTH
] = "";
47 static const void *setStatusMessage(displayPort_t
*pDisp
)
51 vtxDevice_t
*device
= vtxCommonDevice();
57 tfp_sprintf(&statusLine1
[0], "VTX NOT RESPONDING");
58 tfp_sprintf(&statusLine2
[0], "OR NOT CONFIGURED");
60 vtxDevType_e vtxType
= vtxCommonGetDeviceType(device
);
61 if (vtxType
== VTXDEV_UNSUPPORTED
) {
62 tfp_sprintf(&statusLine1
[0], "UNSUPPORTED VTX TYPE");
64 tfp_sprintf(&statusLine1
[0], "UNKNOWN VTX TYPE");
70 static const OSD_Entry vtxErrorMenuEntries
[] =
72 { "", OME_Label
| DYNAMIC
, NULL
, statusLine1
},
73 { "", OME_Label
| DYNAMIC
, NULL
, statusLine2
},
74 { "", OME_Label
, NULL
, NULL
},
75 { "BACK", OME_Back
, NULL
, NULL
},
76 { NULL
, OME_END
, NULL
, NULL
}
79 static CMS_Menu cmsx_menuVtxError
= {
81 .GUARD_text
= "XVTXERROR",
82 .GUARD_type
= OME_MENU
,
84 .onEnter
= setStatusMessage
,
86 .onDisplayUpdate
= NULL
,
87 .entries
= vtxErrorMenuEntries
,
90 // Redirect to the proper menu based on the vtx device type
91 // If device isn't valid or not a supported type then don't
92 // redirect and instead display a local informational menu.
93 const void *cmsSelectVtx(displayPort_t
*pDisplay
, const void *ptr
)
97 vtxDevice_t
*device
= vtxCommonDevice();
100 vtxDevType_e vtxType
= vtxCommonGetDeviceType(device
);
104 #if defined(USE_VTX_RTC6705)
106 cmsMenuChange(pDisplay
, &cmsx_menuVtxRTC6705
);
110 #if defined(USE_VTX_SMARTAUDIO)
111 case VTXDEV_SMARTAUDIO
:
112 cmsMenuChange(pDisplay
, &cmsx_menuVtxSmartAudio
);
116 #if defined(USE_VTX_TRAMP)
118 cmsMenuChange(pDisplay
, &cmsx_menuVtxTramp
);
122 #if defined(USE_VTX_MSP)
124 cmsMenuChange(pDisplay
, &cmsx_menuVtxMsp
);
129 cmsMenuChange(pDisplay
, &cmsx_menuVtxError
);
134 cmsMenuChange(pDisplay
, &cmsx_menuVtxError
);