From 69f6088497ca94f33d7c6355eab7430b0761a074 Mon Sep 17 00:00:00 2001 From: jflyper Date: Mon, 18 Feb 2019 21:30:31 +0900 Subject: [PATCH] One level back if Tramp is not configured --- src/main/cms/cms_menu_vtx_tramp.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/cms/cms_menu_vtx_tramp.c b/src/main/cms/cms_menu_vtx_tramp.c index c307a1abe6..739ad601ec 100644 --- a/src/main/cms/cms_menu_vtx_tramp.c +++ b/src/main/cms/cms_menu_vtx_tramp.c @@ -172,8 +172,14 @@ static long trampCmsCommence(displayPort_t *pDisp, const void *self) return MENU_CHAIN_BACK; } -static void trampCmsInitSettings(void) +static bool trampCmsInitSettings(void) { + vtxDevice_t *device = vtxCommonDevice(); + + if (!device) { + return false; + } + if (trampBand > 0) trampCmsBand = trampBand; if (trampChannel > 0) trampCmsChan = trampChannel; @@ -186,8 +192,6 @@ static void trampCmsInitSettings(void) } } - vtxDevice_t *device = vtxCommonDevice(); - trampCmsEntBand.val = &trampCmsBand; trampCmsEntBand.max = device->capability.bandCount; trampCmsEntBand.names = device->bandNames; @@ -199,11 +203,16 @@ static void trampCmsInitSettings(void) trampCmsEntPower.val = &trampCmsPower; trampCmsEntPower.max = device->capability.powerCount; trampCmsEntPower.names = device->powerNames; + + return true; } static long trampCmsOnEnter(void) { - trampCmsInitSettings(); + if (!trampCmsInitSettings()) { + return MENU_CHAIN_BACK; + } + return 0; }