1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 16:55:36 +03:00

Merge pull request #9421 from etracer65/fix_compile_without_vtxtable

Fix compile errors if USE_VTX_TABLE is not defined
This commit is contained in:
Michael Keller 2020-01-31 01:06:37 +13:00 committed by mikeller
parent 5e35eb0d39
commit 6ad5314541

View file

@ -2558,6 +2558,15 @@ static void cliVtx(char *cmdline)
if (isEmpty(cmdline)) {
printVtx(DUMP_MASTER, vtxConfig(), NULL, NULL);
} else {
#ifdef USE_VTX_TABLE
const uint8_t maxBandIndex = vtxTableConfig()->bands;
const uint8_t maxChannelIndex = vtxTableConfig()->channels;
const uint8_t maxPowerIndex = vtxTableConfig()->powerLevels;
#else
const uint8_t maxBandIndex = VTX_TABLE_MAX_BANDS;
const uint8_t maxChannelIndex = VTX_TABLE_MAX_CHANNELS;
const uint8_t maxPowerIndex = VTX_TABLE_MAX_POWER_LEVELS;
#endif
ptr = cmdline;
i = atoi(ptr++);
if (i < MAX_CHANNEL_ACTIVATION_CONDITION_COUNT) {
@ -2574,7 +2583,7 @@ static void cliVtx(char *cmdline)
ptr = nextArg(ptr);
if (ptr) {
val = atoi(ptr);
if (val >= 0 && val <= vtxTableConfig()->bands) {
if (val >= 0 && val <= maxBandIndex) {
cac->band = val;
validArgumentCount++;
}
@ -2582,7 +2591,7 @@ static void cliVtx(char *cmdline)
ptr = nextArg(ptr);
if (ptr) {
val = atoi(ptr);
if (val >= 0 && val <= vtxTableConfig()->channels) {
if (val >= 0 && val <= maxChannelIndex) {
cac->channel = val;
validArgumentCount++;
}
@ -2590,7 +2599,7 @@ static void cliVtx(char *cmdline)
ptr = nextArg(ptr);
if (ptr) {
val = atoi(ptr);
if (val >= 0 && val <= vtxTableConfig()->powerLevels) {
if (val >= 0 && val <= maxPowerIndex) {
cac->power= val;
validArgumentCount++;
}