Merge pull request #7605 from jflyper/bfdev-fix-hard-fault-in-cms-VTX_TR-menu

[CMS, TRAMP] One level back if Tramp is not configured
This commit is contained in:
Michael Keller 2019-02-20 06:42:28 +13:00 committed by GitHub
commit 08004e2652
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 4 deletions

View File

@ -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;
}