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))
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_types.h"
37 #include "drivers/vtx_common.h"
39 #include "cms_menu_vtx_common.h"
41 #define MAX_STATUS_LINE_LENGTH 21
43 static char statusLine1
[MAX_STATUS_LINE_LENGTH
] = "";
44 static char statusLine2
[MAX_STATUS_LINE_LENGTH
] = "";
46 static const void *setStatusMessage(displayPort_t
*pDisp
)
50 vtxDevice_t
*device
= vtxCommonDevice();
56 tfp_sprintf(&statusLine1
[0], "VTX NOT RESPONDING");
57 tfp_sprintf(&statusLine2
[0], "OR NOT CONFIGURED");
59 vtxDevType_e vtxType
= vtxCommonGetDeviceType(device
);
60 if (vtxType
== VTXDEV_UNSUPPORTED
) {
61 tfp_sprintf(&statusLine1
[0], "UNSUPPORTED VTX TYPE");
63 tfp_sprintf(&statusLine1
[0], "UNKNOWN VTX TYPE");
69 static const OSD_Entry vtxErrorMenuEntries
[] =
71 { "", OME_Label
| DYNAMIC
, NULL
, statusLine1
},
72 { "", OME_Label
| DYNAMIC
, NULL
, statusLine2
},
73 { "", OME_Label
, NULL
, NULL
},
74 { "BACK", OME_Back
, NULL
, NULL
},
75 { NULL
, OME_END
, NULL
, NULL
}
78 static CMS_Menu cmsx_menuVtxError
= {
80 .GUARD_text
= "XVTXERROR",
81 .GUARD_type
= OME_MENU
,
83 .onEnter
= setStatusMessage
,
85 .onDisplayUpdate
= NULL
,
86 .entries
= vtxErrorMenuEntries
,
89 // Redirect to the proper menu based on the vtx device type
90 // If device isn't valid or not a supported type then don't
91 // redirect and instead display a local informational menu.
92 const void *cmsSelectVtx(displayPort_t
*pDisplay
, const void *ptr
)
96 vtxDevice_t
*device
= vtxCommonDevice();
99 vtxDevType_e vtxType
= vtxCommonGetDeviceType(device
);
103 #if defined(USE_VTX_RTC6705)
105 cmsMenuChange(pDisplay
, &cmsx_menuVtxRTC6705
);
109 #if defined(USE_VTX_SMARTAUDIO)
110 case VTXDEV_SMARTAUDIO
:
111 cmsMenuChange(pDisplay
, &cmsx_menuVtxSmartAudio
);
115 #if defined(USE_VTX_TRAMP)
117 cmsMenuChange(pDisplay
, &cmsx_menuVtxTramp
);
123 cmsMenuChange(pDisplay
, &cmsx_menuVtxError
);
128 cmsMenuChange(pDisplay
, &cmsx_menuVtxError
);