1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-13 19:40:31 +03:00

vtxtable powerlevels with no parameters returns the vtxtable po… (#9122)

vtxtable powerlevels with no parameters returns the vtxtable power levels extract with SA2.1
This commit is contained in:
Michael Keller 2019-11-05 22:04:22 +13:00 committed by GitHub
commit e34ba7f534
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 95 additions and 11 deletions

View file

@ -1598,8 +1598,8 @@ static void cliAdjustmentRange(char *cmdline)
ptr = nextArg(ptr);
if (ptr) {
val = atoi(ptr);
// Was: slot
// Keeping the parameter to retain backwards compatibility for the command format.
// Was: slot
// Keeping the parameter to retain backwards compatibility for the command format.
validArgumentCount++;
}
ptr = nextArg(ptr);
@ -2993,6 +2993,29 @@ static void cliVtxTable(char *cmdline)
cliPrintErrorLinef("INVALID SUBCOMMAND %s", tok);
}
}
static void cliVtxInfo(char *cmdline)
{
UNUSED(cmdline);
// Display the available power levels
uint16_t levels[VTX_TABLE_MAX_POWER_LEVELS];
uint16_t powers[VTX_TABLE_MAX_POWER_LEVELS];
vtxDevice_t *vtxDevice = vtxCommonDevice();
if (vtxDevice) {
uint8_t level_count = vtxCommonGetVTXPowerLevels(vtxDevice, levels, powers);
if (level_count) {
for (int i = 0; i < level_count; i++) {
cliPrintLinef("level %d dBm, power %d mW", levels[i], powers[i]);
}
} else {
cliPrintErrorLinef("NO POWER VALUES DEFINED");
}
} else {
cliPrintErrorLinef("NO VTX");
}
}
#endif // USE_VTX_TABLE
static void printName(dumpFlags_t dumpMask, const pilotConfig_t *pilotConfig)
@ -5832,7 +5855,7 @@ static void cliResource(char *cmdline)
return;
}
const char * resourceName = ownerNames[resourceTable[resourceIndex].owner];
const char * resourceName = ownerNames[resourceTable[resourceIndex].owner];
if (strncasecmp(pch, resourceName, strlen(resourceName)) == 0) {
break;
}
@ -6370,6 +6393,7 @@ const clicmd_t cmdTable[] = {
#endif
#endif
#ifdef USE_VTX_TABLE
CLI_COMMAND_DEF("vtx_info", "vtx power config dump", NULL, cliVtxInfo),
CLI_COMMAND_DEF("vtxtable", "vtx frequency table", "<band> <bandname> <bandletter> [FACTORY|CUSTOM] <freq> ... <freq>\r\n", cliVtxTable),
#endif
};