1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-14 11:59:58 +03:00

Added selection by alternate function to CLI 'timer'. (#8306)

Added selection by alternate function to CLI 'timer'.
This commit is contained in:
Michael Keller 2019-05-21 02:40:11 +12:00 committed by GitHub
commit ae9f938cb5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5412,6 +5412,23 @@ static void cliTimer(char *cmdline)
return;
} else if (strcasecmp(pch, "none") == 0) {
timerIndex = TIMER_INDEX_UNDEFINED;
} else if (strncasecmp(pch, "af", 2) == 0) {
unsigned alternateFunction = atoi(&pch[2]);
const timerHardware_t *timer;
for (unsigned index = 0; (timer = timerGetByTagAndIndex(ioTag, index + 1)); index++) {
if (timer->alternateFunction == alternateFunction) {
timerIndex = index;
break;
}
}
if (!timer) {
cliPrintErrorLinef("INVALID ALTERNATE FUNCTION FOR %c%02d: '%s'", IO_GPIOPortIdxByTag(ioTag) + 'A', IO_GPIOPinIdxByTag(ioTag), pch);
return;
}
} else {
timerIndex = atoi(pch);
@ -5906,7 +5923,7 @@ const clicmd_t cmdTable[] = {
CLI_COMMAND_DEF("tasks", "show task stats", NULL, cliTasks),
#endif
#ifdef USE_TIMER_MGMT
CLI_COMMAND_DEF("timer", "show/set timers", "<> | <pin> list | <pin> [<option>|none] | list | show", cliTimer),
CLI_COMMAND_DEF("timer", "show/set timers", "<> | <pin> list | <pin> [<option>|af<altenate function>|none] | list | show", cliTimer),
#endif
CLI_COMMAND_DEF("version", "show version", NULL, cliVersion),
#ifdef USE_VTX_CONTROL