mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-14 20:10:18 +03:00
Added selection by alternate function to CLI 'timer'. (#8306)
Added selection by alternate function to CLI 'timer'.
This commit is contained in:
commit
ae9f938cb5
1 changed files with 18 additions and 1 deletions
|
@ -5412,6 +5412,23 @@ static void cliTimer(char *cmdline)
|
||||||
return;
|
return;
|
||||||
} else if (strcasecmp(pch, "none") == 0) {
|
} else if (strcasecmp(pch, "none") == 0) {
|
||||||
timerIndex = TIMER_INDEX_UNDEFINED;
|
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 {
|
} else {
|
||||||
timerIndex = atoi(pch);
|
timerIndex = atoi(pch);
|
||||||
|
|
||||||
|
@ -5906,7 +5923,7 @@ const clicmd_t cmdTable[] = {
|
||||||
CLI_COMMAND_DEF("tasks", "show task stats", NULL, cliTasks),
|
CLI_COMMAND_DEF("tasks", "show task stats", NULL, cliTasks),
|
||||||
#endif
|
#endif
|
||||||
#ifdef USE_TIMER_MGMT
|
#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
|
#endif
|
||||||
CLI_COMMAND_DEF("version", "show version", NULL, cliVersion),
|
CLI_COMMAND_DEF("version", "show version", NULL, cliVersion),
|
||||||
#ifdef USE_VTX_CONTROL
|
#ifdef USE_VTX_CONTROL
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue